Spring Integration

org.springframework.integration.file
Class AbstractInboundRemoteFileSystemSynchronizingMessageSource<Y,T extends AbstractInboundRemoteFileSystemSychronizer<Y>>

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.file.AbstractInboundRemoteFileSystemSynchronizingMessageSource<Y,T>
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, NamedComponent, MessageSource<File>
Direct Known Subclasses:
FtpInboundRemoteFileSystemSynchronizingMessageSource, SftpInboundRemoteFileSystemSynchronizingMessageSource

public abstract class AbstractInboundRemoteFileSystemSynchronizingMessageSource<Y,T extends AbstractInboundRemoteFileSystemSychronizer<Y>>
extends AbstractEndpoint
implements MessageSource<File>

Ultimately, this factors out a lot of the common logic between the FTP and SFTP adapters. Designed to be extendable 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 bringing down the remote file system - as you'd expect an 'inbound' adapter would).

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 implementaton specific).

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

Author:
Josh Long

Field Summary
protected  boolean autoCreateDirectories
          Should the endpoint attempt to create the local directory and / or the remote directory?
protected  FileReadingMessageSource fileSource
          The actual FileReadingMessageSource that we continue to trust to do the job monitoring the filesystem once files are moved down
static String INCOMPLETE_EXTENSION
          Extension used when downloading files.
protected  Resource localDirectory
          What directory should things be synced to locally ?
protected  EntryListFilter<Y> remotePredicate
          The predicate to use in scanning the remote Fs for downloads
protected  T synchronizer
          An implementation that will handle the chores of actually connecting to and syncing up the remote FS with the local one, in an inbound direction
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
AbstractInboundRemoteFileSystemSynchronizingMessageSource()
           
 
Method Summary
protected  void onInit()
          Subclasses may implement this for initialization logic.
 Message<File> receive()
          Retrieve the next available message from this source.
 void setAutoCreateDirectories(boolean autoCreateDirectories)
           
 void setLocalDirectory(Resource localDirectory)
           
 void setRemotePredicate(EntryListFilter<Y> remotePredicate)
           
 void setSynchronizer(T synchronizer)
           
 
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
doStart, doStop, getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getRequiredMetadataPersister, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INCOMPLETE_EXTENSION

public static final String INCOMPLETE_EXTENSION
Extension used when downloading files. We change it right after we know it's downloaded

See Also:
Constant Field Values

autoCreateDirectories

protected volatile boolean autoCreateDirectories
Should the endpoint attempt to create the local directory and / or the remote directory?


synchronizer

protected volatile T extends AbstractInboundRemoteFileSystemSychronizer<Y> synchronizer
An implementation that will handle the chores of actually connecting to and syncing up the remote FS with the local one, in an inbound direction


localDirectory

protected volatile Resource localDirectory
What directory should things be synced to locally ?


fileSource

protected volatile FileReadingMessageSource fileSource
The actual FileReadingMessageSource that we continue to trust to do the job monitoring the filesystem once files are moved down


remotePredicate

protected EntryListFilter<Y> remotePredicate
The predicate to use in scanning the remote Fs for downloads

Constructor Detail

AbstractInboundRemoteFileSystemSynchronizingMessageSource

public AbstractInboundRemoteFileSystemSynchronizingMessageSource()
Method Detail

setAutoCreateDirectories

public void setAutoCreateDirectories(boolean autoCreateDirectories)

setSynchronizer

public void setSynchronizer(T synchronizer)

setLocalDirectory

public void setLocalDirectory(Resource localDirectory)

setRemotePredicate

public void setRemotePredicate(EntryListFilter<Y> remotePredicate)

onInit

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

Overrides:
onInit in class IntegrationObjectSupport
Throws:
Exception

receive

public Message<File> receive()
Description copied from interface: MessageSource
Retrieve the next available message from this source. Returns null if no message is available.

Specified by:
receive in interface MessageSource<File>

Spring Integration

Copyright © 2010. All Rights Reserved.