org.springframework.integration.endpoint
Class AbstractEndpoint

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
Direct Known Subclasses:
AbstractMessagingGateway, AbstractPollingEndpoint, EventDrivenConsumer, GatewayProxyFactoryBean, JmsMessageDrivenEndpoint, MessageProducerSupport

public abstract class AbstractEndpoint
extends IntegrationObjectSupport
implements org.springframework.context.SmartLifecycle, org.springframework.beans.factory.InitializingBean

The base class for Message Endpoint implementations.

This class implements Lifecycle and provides an autoStartup property. If true, the endpoint will start automatically upon initialization. Otherwise, it will require an explicit invocation of its start() method. The default value is true. To require explicit startup, provide a value of false to the setAutoStartup(boolean) method.

Author:
Mark Fisher

Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
AbstractEndpoint()
           
 
Method Summary
 void afterPropertiesSet()
           
protected abstract  void doStart()
          Subclasses must implement this method with the start behavior.
protected abstract  void doStop()
          Subclasses must implement this method with the stop behavior.
 int getPhase()
           
 boolean isAutoStartup()
           
 boolean isRunning()
           
protected  void onInit()
           
 void setAutoStartup(boolean autoStartup)
           
 void setPhase(int phase)
           
 void setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
           
 void start()
           
 void stop()
           
 void stop(java.lang.Runnable callback)
           
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
getBeanFactory, getBeanName, getChannelResolver, getTaskScheduler, setBeanFactory, setBeanName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractEndpoint

public AbstractEndpoint()
Method Detail

setAutoStartup

public void setAutoStartup(boolean autoStartup)

setPhase

public void setPhase(int phase)

setTaskScheduler

public void setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
Overrides:
setTaskScheduler in class IntegrationObjectSupport

afterPropertiesSet

public final void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

isAutoStartup

public final boolean isAutoStartup()
Specified by:
isAutoStartup in interface org.springframework.context.SmartLifecycle

getPhase

public final int getPhase()
Specified by:
getPhase in interface org.springframework.context.Phased

isRunning

public final boolean isRunning()
Specified by:
isRunning in interface org.springframework.context.Lifecycle

start

public final void start()
Specified by:
start in interface org.springframework.context.Lifecycle

stop

public final void stop()
Specified by:
stop in interface org.springframework.context.Lifecycle

stop

public final void stop(java.lang.Runnable callback)
Specified by:
stop in interface org.springframework.context.SmartLifecycle

onInit

protected void onInit()
               throws java.lang.Exception
Throws:
java.lang.Exception

doStart

protected abstract void doStart()
Subclasses must implement this method with the start behavior. This method will be invoked while holding the lifecycleLock.


doStop

protected abstract void doStop()
Subclasses must implement this method with the stop behavior. This method will be invoked while holding the lifecycleLock.