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 inheritence 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.AbstractEndpoint
definition, description, endpoint, interfaceName, logger, service, serviceUnit
 
Constructor Summary
PollingEndpoint()
           
PollingEndpoint(DefaultComponent component, javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
PollingEndpoint(ServiceUnit serviceUnit, QName service, String endpoint)
           
 
Method Summary
 long getDelay()
           
 org.apache.servicemix.executors.Executor getExecutor()
           
 Date getFirstTime()
           
 long getPeriod()
           
 Scheduler getScheduler()
           
protected  void handlePollException(Exception e)
           
 boolean isConcurrentPolling()
          returns if more than one poll can be active at a time
abstract  void poll()
          Polls the underlying resource to see if some event is required
 void setConcurrentPolling(boolean concurrentPolling)
          sets if more than one poll can be active at a time (true means yes)
 void setDelay(long delay)
          Sets the amount of time the endpoint waits before making the first poll.
 void setFirstTime(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)
           
 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,
                       QName service,
                       String endpoint)

PollingEndpoint

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

poll

public abstract void poll()
                   throws Exception
Polls the underlying resource to see if some event is required

Throws:
javax.jbi.JBIException
Exception

getExecutor

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

getDelay

public long getDelay()

setDelay

public void setDelay(long delay)
Sets the amount of time the endpoint waits before making the first poll.

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

getFirstTime

public Date getFirstTime()

setFirstTime

public void setFirstTime(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

getPeriod

public long getPeriod()

isConcurrentPolling

public boolean isConcurrentPolling()
returns if more than one poll can be active at a time

Returns:
Returns the concurrentPolling flag.

setConcurrentPolling

public void setConcurrentPolling(boolean concurrentPolling)
sets if more than one poll can be active at a time (true means yes)

Parameters:
concurrentPolling - The concurrentPolling to set.

setPeriod

public void setPeriod(long period)
Sets the number of milliseconds between polling attempts.

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

getScheduler

public Scheduler getScheduler()

setScheduler

public void setScheduler(Scheduler scheduler)

start

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

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

stop

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

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

handlePollException

protected void handlePollException(Exception e)


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.