org.apache.servicemix.common.endpoints
Class PollingEndpoint

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ConsumerEndpoint
              extended by org.apache.servicemix.common.endpoints.PollingEndpoint
All Implemented Interfaces:
Endpoint

public abstract class PollingEndpoint
extends ConsumerEndpoint

An implementation inheritance class for an endpoint which polls some resource at periodic intervals to decide if there is an event to process.

Version:
$Revision: 464478 $

Field Summary
 
Fields inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
logger
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, service, serviceUnit
 
Constructor Summary
PollingEndpoint()
           
PollingEndpoint(DefaultComponent component, javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
PollingEndpoint(ServiceUnit serviceUnit, javax.xml.namespace.QName service, java.lang.String endpoint)
           
 
Method Summary
 long getDelay()
           
 org.apache.servicemix.executors.Executor getExecutor()
           
 java.util.Date getFirstTime()
           
 long getPeriod()
           
 Scheduler getScheduler()
           
protected  void handlePollException(java.lang.Exception e)
           
 boolean isConcurrentPolling()
           
abstract  void poll()
           Polls the underlying resource to see if some event is required.
 void setConcurrentPolling(boolean concurrentPolling)
           Sets whether more than one poll can be active at a time (true means yes).
 void setDelay(long delay)
           Sets the amount of time in milliseconds that the endpoint should wait before making the first poll.
 void setFirstTime(java.util.Date firstTime)
           Sets the date on which the first poll will be executed.
 void setPeriod(long period)
           Sets the number of milliseconds between polling attempts.
 void setScheduler(Scheduler scheduler)
           Sets a custom scheduler implementation if you need more fine-grained control over the polling schedule.
 void start()
          Start consumption of external requests.
 void stop()
          Stop consumption of external requests.
 
Methods inherited from class org.apache.servicemix.common.endpoints.ConsumerEndpoint
activate, configureExchangeTarget, deactivate, getLocationURI, getRole, getTargetEndpoint, getTargetInterface, getTargetOperation, getTargetService, getTargetUri, setTargetEndpoint, setTargetInterface, setTargetOperation, setTargetService, setTargetUri, validate
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
done, fail, getChannel, getContext, getExchangeFactory, send, sendSync
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getDefinition, getDescription, getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, process, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PollingEndpoint

public PollingEndpoint()

PollingEndpoint

public PollingEndpoint(ServiceUnit serviceUnit,
                       javax.xml.namespace.QName service,
                       java.lang.String endpoint)

PollingEndpoint

public PollingEndpoint(DefaultComponent component,
                       javax.jbi.servicedesc.ServiceEndpoint endpoint)
Method Detail

poll

public abstract void poll()
                   throws java.lang.Exception

Polls the underlying resource to see if some event is required.

Throws:
javax.jbi.JBIException
java.lang.Exception

getExecutor

public org.apache.servicemix.executors.Executor getExecutor()

setDelay

public void setDelay(long delay)

Sets the amount of time in milliseconds that the endpoint should wait before making the first poll.

Parameters:
delay - a long specifying the number of milliseconds to wait.

getDelay

public long getDelay()

setFirstTime

public void setFirstTime(java.util.Date firstTime)

Sets the date on which the first poll will be executed. If a delay is also set using setDelay, the delay interval will be added after the date specified.

Parameters:
firstTime - a Date specifying when to make the first polling attempt.

getFirstTime

public java.util.Date getFirstTime()

setConcurrentPolling

public void setConcurrentPolling(boolean concurrentPolling)

Sets whether more than one poll can be active at a time (true means yes). Default value is false.

Parameters:
concurrentPolling - The concurrentPolling to set.

isConcurrentPolling

public boolean isConcurrentPolling()

setPeriod

public void setPeriod(long period)

Sets the number of milliseconds between polling attempts.

Parameters:
period - a long specifying the gap between polling attempts.

getPeriod

public long getPeriod()

getScheduler

public Scheduler getScheduler()

setScheduler

public void setScheduler(Scheduler scheduler)

Sets a custom scheduler implementation if you need more fine-grained control over the polling schedule.

Parameters:
scheduler - the customer scheduler.

start

public void start()
           throws java.lang.Exception
Description copied from interface: Endpoint
Start consumption of external requests.

Specified by:
start in interface Endpoint
Overrides:
start in class SimpleEndpoint
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Description copied from interface: Endpoint
Stop consumption of external requests.

Specified by:
stop in interface Endpoint
Overrides:
stop in class SimpleEndpoint
Throws:
java.lang.Exception

handlePollException

protected void handlePollException(java.lang.Exception e)


Copyright © 2005-2012 FuseSource. All Rights Reserved.