Spring Integration

org.springframework.integration.file.remote.synchronizer
Class AbstractInboundFileSynchronizingMessageSource<F>

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.endpoint.MessageProducerSupport
              extended by org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource<F>
All Implemented Interfaces:
org.springframework.beans.factory.Aware, 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, NamedComponent, MessageProducer, MessageSource<java.io.File>, TrackableComponent
Direct Known Subclasses:
FtpInboundFileSynchronizingMessageSource, SftpInboundFileSynchronizingMessageSource

public abstract class AbstractInboundFileSynchronizingMessageSource<F>
extends MessageProducerSupport
implements MessageSource<java.io.File>

Factors out the common logic between the FTP and SFTP adapters. Designed to be extensible to handle adapters whose task it is to synchronize a remote file system with a local file system (NB: this does *NOT* handle pushing files TO the remote file system that exist uniquely in the local file system. It only handles pulling from the remote file system - as you would expect from an 'inbound' adapter).

The base class supports configuration of whether the remote file system and local file system's directories should be created on start (what 'creating a directory' means to the specific adapter is of course implementation specific).

This class is to be used as a pair with an implementation of AbstractInboundFileSynchronizer. The synchronizer must handle the work of actually connecting to the remote file system and delivering new Files.

Author:
Josh Long, Oleg Zhurakousky, Gary Russell

Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer)
           
AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer, java.util.Comparator<java.io.File> comparator)
           
 
Method Summary
protected  void onInit()
          Subclasses may implement this for initialization logic.
 Message<java.io.File> receive()
          Polls from the file source.
 void setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory)
           
 void setLocalDirectory(java.io.File localDirectory)
           
 
Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
doStart, doStop, sendMessage, setErrorChannel, setOutputChannel, setSendTimeout, setShouldTrack
 
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.context.NamedComponent
getComponentName, getComponentType
 

Constructor Detail

AbstractInboundFileSynchronizingMessageSource

public AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer)

AbstractInboundFileSynchronizingMessageSource

public AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer,
                                                     java.util.Comparator<java.io.File> comparator)
Method Detail

setAutoCreateLocalDirectory

public void setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory)

setLocalDirectory

public void setLocalDirectory(java.io.File localDirectory)

onInit

protected void onInit()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this for initialization logic.

Overrides:
onInit in class MessageProducerSupport

receive

public final Message<java.io.File> receive()
Polls from the file source. If the result is not null, it will be returned. If the result is null, it attempts to sync up with the remote directory to populate the file source. Then, it polls the file source again and returns the result, whether or not it is null.

Specified by:
receive in interface MessageSource<java.io.File>

Spring Integration