Class AbstractRemoteFileStreamingMessageSource<F>
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<T>
org.springframework.integration.endpoint.AbstractFetchLimitingMessageSource<InputStream>
org.springframework.integration.file.remote.AbstractRemoteFileStreamingMessageSource<F>
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,Lifecycle
,MessageSource<InputStream>
,IntegrationPattern
,NamedComponent
,IntegrationInboundManagement
,IntegrationManagement
,ManageableLifecycle
,MessageSourceManagement
- Direct Known Subclasses:
FtpStreamingMessageSource
,SftpStreamingMessageSource
public abstract class AbstractRemoteFileStreamingMessageSource<F> extends AbstractFetchLimitingMessageSource<InputStream> implements ManageableLifecycle
A message source that produces a message with an
InputStream
payload
referencing a remote file.- Since:
- 4.3
- Author:
- Gary Russell, Artem Bilan, Lukas Gemela
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractRemoteFileStreamingMessageSource(RemoteFileTemplate<F> template, Comparator<F> comparator)
-
Method Summary
Modifier and Type Method Description protected abstract List<AbstractFileInfo<F>>
asFileInfoList(Collection<F> files)
protected void
doInit()
Subclasses can override to perform initialization - called fromInitializingBean.afterPropertiesSet()
.protected Object
doReceive(int maxFetchSize)
Subclasses must implement this method.protected void
doSetFilter(FileListFilter<F> filterToSet)
protected RemoteFileTemplate<F>
getRemoteFileTemplate()
protected abstract boolean
isDirectory(F file)
boolean
isRunning()
void
onInit()
protected AbstractFileInfo<F>
poll()
protected String
remotePath(AbstractFileInfo<F> file)
protected void
rollbackFromFileToListEnd(List<F> filteredFiles, F file)
void
setFileInfoJson(boolean fileInfoJson)
Set to false to add theFileHeaders.REMOTE_FILE_INFO
header to the rawFileInfo
.void
setFilter(FileListFilter<F> filter)
Set the filter to be applied to the remote files before transferring.void
setRemoteDirectory(String remoteDirectory)
Specify the full path to the remote directory.void
setRemoteDirectoryExpression(Expression remoteDirectoryExpression)
Specify an expression that evaluates to the full path to the remote directory.void
setRemoteFileSeparator(String remoteFileSeparator)
Set the remote file separator; default '/'void
start()
void
stop()
Methods inherited from class org.springframework.integration.endpoint.AbstractFetchLimitingMessageSource
doReceive, getMaxFetchSize, setMaxFetchSize
Methods inherited from class org.springframework.integration.endpoint.AbstractMessageSource
buildMessage, destroy, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedType
Methods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, setBeanFactory, setConversionService
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods inherited from interface org.springframework.integration.core.MessageSource
getIntegrationPatternType
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getComponentType
-
Constructor Details
-
AbstractRemoteFileStreamingMessageSource
protected AbstractRemoteFileStreamingMessageSource(RemoteFileTemplate<F> template, @Nullable Comparator<F> comparator)
-
-
Method Details
-
setRemoteDirectory
Specify the full path to the remote directory.- Parameters:
remoteDirectory
- The remote directory.
-
setRemoteDirectoryExpression
Specify an expression that evaluates to the full path to the remote directory.- Parameters:
remoteDirectoryExpression
- The remote directory expression.
-
setRemoteFileSeparator
Set the remote file separator; default '/'- Parameters:
remoteFileSeparator
- the remote file separator.
-
setFilter
Set the filter to be applied to the remote files before transferring.- Parameters:
filter
- the file list filter.
-
doSetFilter
-
setFileInfoJson
public void setFileInfoJson(boolean fileInfoJson)Set to false to add theFileHeaders.REMOTE_FILE_INFO
header to the rawFileInfo
. Default is true meaning that common file information properties are provided in that header as JSON.- Parameters:
fileInfoJson
- false to set the raw object.- Since:
- 5.0
-
getRemoteFileTemplate
-
onInit
public final void onInit()- Overrides:
onInit
in classAbstractExpressionEvaluator
-
doInit
protected void doInit()Subclasses can override to perform initialization - called fromInitializingBean.afterPropertiesSet()
. -
start
public void start()- Specified by:
start
in interfaceLifecycle
- Specified by:
start
in interfaceManageableLifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceLifecycle
- Specified by:
stop
in interfaceManageableLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceLifecycle
- Specified by:
isRunning
in interfaceManageableLifecycle
-
doReceive
Description copied from class:AbstractFetchLimitingMessageSource
Subclasses must implement this method. Typically the returned value will be the payload of type T, but the returned value may also be a Message instance whose payload is of type T.- Specified by:
doReceive
in classAbstractFetchLimitingMessageSource<InputStream>
- Parameters:
maxFetchSize
- the maximum number of messages to fetch if a fetch is necessary.- Returns:
- The value returned.
-
poll
-
remotePath
-
rollbackFromFileToListEnd
-
asFileInfoList
-
isDirectory
-