org.springframework.integration.file.remote.synchronizer
Class AbstractInboundFileSynchronizingMessageSource<F>
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
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 File
s.
- Author:
- Josh Long, Oleg Zhurakousky, Gary Russell
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 |
AbstractInboundFileSynchronizingMessageSource
public AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer)
AbstractInboundFileSynchronizingMessageSource
public AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer,
java.util.Comparator<java.io.File> comparator)
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>