public abstract class AbstractInboundFileSynchronizingMessageSource<F> extends AbstractFetchLimitingMessageSource<File> implements ManageableLifecycle
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.
IntegrationManagement.ManagementOverrides
EXPRESSION_PARSER, logger
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer) |
AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer,
Comparator<File> comparator) |
Modifier and Type | Method and Description |
---|---|
AbstractIntegrationMessageBuilder<File> |
doReceive(int maxFetchSize)
Polls from the file source.
|
AbstractInboundFileSynchronizer<F> |
getSynchronizer()
Return the underlying synchronizer.
|
boolean |
isRunning() |
protected void |
onInit() |
void |
setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory) |
void |
setLocalDirectory(File localDirectory) |
void |
setLocalFilter(FileListFilter<File> localFileListFilter)
A
FileListFilter used to determine which files will generate messages
after they have been synchronized. |
void |
setScanner(DirectoryScanner scanner)
Switch the local
FileReadingMessageSource to use a custom
DirectoryScanner . |
void |
setUseWatchService(boolean useWatchService)
Switch the local
FileReadingMessageSource to use its internal
FileReadingMessageSource.WatchServiceDirectoryScanner . |
void |
start() |
void |
stop() |
doReceive, getMaxFetchSize, setMaxFetchSize
buildMessage, destroy, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedType
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, setBeanFactory, setConversionService
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIntegrationPatternType
getThisAs
getComponentType
public AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer)
public AbstractInboundFileSynchronizingMessageSource(AbstractInboundFileSynchronizer<F> synchronizer, Comparator<File> comparator)
public void setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory)
public void setLocalDirectory(File localDirectory)
public void setLocalFilter(FileListFilter<File> localFileListFilter)
FileListFilter
used to determine which files will generate messages
after they have been synchronized. It will be combined with a filter that
will prevent accessing files that are in the process of being synchronized
(files having the AbstractInboundFileSynchronizer.getTemporaryFileSuffix()
).
The default is an FileSystemPersistentAcceptOnceFileListFilter
which filters duplicate file names (processed during the current execution).
localFileListFilter
- The local file list filter.public void setUseWatchService(boolean useWatchService)
FileReadingMessageSource
to use its internal
FileReadingMessageSource.WatchServiceDirectoryScanner
.useWatchService
- the boolean
flag to switch to
FileReadingMessageSource.WatchServiceDirectoryScanner
on true
.public void setScanner(DirectoryScanner scanner)
FileReadingMessageSource
to use a custom
DirectoryScanner
.scanner
- the DirectoryScanner
to use.public AbstractInboundFileSynchronizer<F> getSynchronizer()
protected void onInit()
onInit
in class AbstractExpressionEvaluator
public void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
public void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
public boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle
public final AbstractIntegrationMessageBuilder<File> doReceive(int maxFetchSize)
doReceive
in class AbstractFetchLimitingMessageSource<File>
maxFetchSize
- the maximum files to fetch.