org.apache.servicemix.components.util
Class PollingComponentSupport

java.lang.Object
  extended by org.apache.servicemix.jbi.management.BaseLifeCycle
      extended by org.apache.servicemix.components.util.PojoSupport
          extended by org.apache.servicemix.components.util.ComponentSupport
              extended by org.apache.servicemix.components.util.PollingComponentSupport
All Implemented Interfaces:
Runnable, javax.jbi.component.Component, javax.jbi.component.ComponentLifeCycle, javax.jbi.management.LifeCycleMBean, Work, MBeanInfoProvider

public abstract class PollingComponentSupport
extends ComponentSupport
implements Work

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

Version:
$Revision: 564374 $

Field Summary
 
Fields inherited from class org.apache.servicemix.components.util.PojoSupport
logger
 
Fields inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
currentState, INITIALIZED, listener
 
Fields inherited from interface javax.jbi.management.LifeCycleMBean
SHUTDOWN, STARTED, STOPPED, UNKNOWN
 
Constructor Summary
PollingComponentSupport()
           
 
Method Summary
 long getDelay()
           
 org.apache.servicemix.executors.Executor getExecutor()
           
 Date getFirstTime()
           
 long getPeriod()
           
 Scheduler getScheduler()
           
protected  void init()
          A helper method to allow a component to initialise prior to the endpoint being activated but after the component context has been configured.
abstract  void poll()
          Polls the underlying resource to see if some event is required
 void release()
           
 void run()
           
 void setDelay(long delay)
           
 void setFirstTime(Date firstTime)
           
 void setPeriod(long period)
           
 void setScheduler(Scheduler scheduler)
           
 void shutDown()
          Shut down the item.
 void start()
          Start the item.
 void stop()
          Stop the item.
 
Methods inherited from class org.apache.servicemix.components.util.ComponentSupport
createComponentLifeCycle, createInOnlyExchange, createInOnlyExchange, createInOnlyExchange, createInOptionalOutExchange, createInOutExchange, createInOutExchange, createRobustInOnlyExchange, createServiceUnitManager, creatInOutExchange, forwardToExchange, forwardToExchange, getInMessage, getLifeCycle, getMessageTransformer, getServiceDescription, getServiceUnitManager, initializeServiceUnitManager, invoke, isExchangeWithConsumerOkay, isExchangeWithProviderOkay, propagateCorrelationId, resolveEndpointReference, setMessageTransformer
 
Methods inherited from class org.apache.servicemix.components.util.PojoSupport
answer, done, fail, fail, getBody, getContext, getDeliveryChannel, getDescription, getEndpoint, getExchangeFactory, getExtensionMBeanName, getService, init, isInAndOut, send, sendSync, sendSync, setBody, setEndpoint, setExtensionMBeanName, setService
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
firePropertyChanged, getAttributeInfos, getCurrentState, getName, getObjectToManage, getOperationInfos, getSubType, getType, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PollingComponentSupport

public PollingComponentSupport()
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

release

public void release()
Specified by:
release in interface Work

run

public void run()
Specified by:
run in interface Runnable

getExecutor

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

getDelay

public long getDelay()

setDelay

public void setDelay(long delay)

getFirstTime

public Date getFirstTime()

setFirstTime

public void setFirstTime(Date firstTime)

getPeriod

public long getPeriod()

setPeriod

public void setPeriod(long period)

getScheduler

public Scheduler getScheduler()

setScheduler

public void setScheduler(Scheduler scheduler)

start

public void start()
           throws javax.jbi.JBIException
Description copied from class: BaseLifeCycle
Start the item.

Specified by:
start in interface javax.jbi.component.ComponentLifeCycle
Specified by:
start in interface javax.jbi.management.LifeCycleMBean
Overrides:
start in class BaseLifeCycle
Throws:
javax.jbi.JBIException - if the item fails to start.

stop

public void stop()
          throws javax.jbi.JBIException
Description copied from class: BaseLifeCycle
Stop the item. This suspends current messaging activities.

Specified by:
stop in interface javax.jbi.component.ComponentLifeCycle
Specified by:
stop in interface javax.jbi.management.LifeCycleMBean
Overrides:
stop in class BaseLifeCycle
Throws:
javax.jbi.JBIException - if the item fails to stop.

shutDown

public void shutDown()
              throws javax.jbi.JBIException
Description copied from class: PojoSupport
Shut down the item. The releases resources, preparing to uninstall

Specified by:
shutDown in interface javax.jbi.component.ComponentLifeCycle
Specified by:
shutDown in interface javax.jbi.management.LifeCycleMBean
Overrides:
shutDown in class PojoSupport
Throws:
javax.jbi.JBIException - if the item fails to shut down.

init

protected void init()
             throws javax.jbi.JBIException
Description copied from class: PojoSupport
A helper method to allow a component to initialise prior to the endpoint being activated but after the component context has been configured.

Overrides:
init in class PojoSupport
Throws:
javax.jbi.JBIException


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