public abstract class AbstractInboundFileSynchronizer<F> extends Object implements InboundFileSynchronizer, BeanFactoryAware, InitializingBean, Closeable
The implementation should run through any configured
FileListFilter
s to
ensure the file entry is acceptable.
Modifier and Type | Field and Description |
---|---|
protected static ExpressionParser |
EXPRESSION_PARSER |
protected Log |
logger |
Constructor and Description |
---|
AbstractInboundFileSynchronizer(SessionFactory<F> sessionFactory)
Create a synchronizer with the
SessionFactory used to acquire Session instances. |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
close() |
protected boolean |
copyFileToLocalDirectory(String remoteDirectoryPath,
F remoteFile,
File localDirectory,
Session<F> session) |
protected void |
doInit()
Subclasses can override to perform initialization - called from
InitializingBean.afterPropertiesSet() . |
protected void |
doSetRemoteDirectoryExpression(Expression remoteDirectoryExpression) |
protected List<F> |
filterFiles(F[] files) |
protected abstract String |
getFilename(F file) |
protected abstract long |
getModified(F file) |
protected String |
getTemporaryFileSuffix() |
protected abstract boolean |
isFile(F file) |
protected void |
rollbackFromFileToListEnd(List<F> filteredFiles,
F file) |
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setDeleteRemoteFiles(boolean deleteRemoteFiles)
Set to true to enable deletion of remote files after successful transfer.
|
void |
setFilter(FileListFilter<F> filter)
Set the filter to be applied to the remote files before transferring.
|
void |
setIntegrationEvaluationContext(EvaluationContext evaluationContext) |
void |
setLocalFilenameGeneratorExpression(Expression localFilenameGeneratorExpression)
Set an expression used to determine the local file name.
|
void |
setLocalFilenameGeneratorExpressionString(String localFilenameGeneratorExpression)
Set an expression used to determine the local file name.
|
void |
setPreserveTimestamp(boolean preserveTimestamp)
Set to true to enable the preservation of the remote file timestamp when
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 |
setRemoteDirectoryExpressionString(String remoteDirectoryExpression)
Specify an expression that evaluates to the full path to the remote directory.
|
void |
setRemoteFileSeparator(String remoteFileSeparator) |
void |
setTemporaryFileSuffix(String temporaryFileSuffix)
Set a temporary file suffix to be used while transferring files.
|
void |
synchronizeToLocalDirectory(File localDirectory) |
protected static final ExpressionParser EXPRESSION_PARSER
protected final Log logger
public AbstractInboundFileSynchronizer(SessionFactory<F> sessionFactory)
SessionFactory
used to acquire Session
instances.sessionFactory
- The session factory.public void setRemoteFileSeparator(String remoteFileSeparator)
remoteFileSeparator
- the remote file separator.RemoteFileTemplate.setRemoteFileSeparator(String)
public void setLocalFilenameGeneratorExpression(Expression localFilenameGeneratorExpression)
localFilenameGeneratorExpression
- the expression.public void setLocalFilenameGeneratorExpressionString(String localFilenameGeneratorExpression)
localFilenameGeneratorExpression
- the expression.setRemoteDirectoryExpression(Expression)
public void setTemporaryFileSuffix(String temporaryFileSuffix)
temporaryFileSuffix
- the file suffix.public void setRemoteDirectory(String remoteDirectory)
remoteDirectory
- The remote directory.public void setRemoteDirectoryExpression(Expression remoteDirectoryExpression)
remoteDirectoryExpression
- The remote directory expression.public void setRemoteDirectoryExpressionString(String remoteDirectoryExpression)
remoteDirectoryExpression
- The remote directory expression.setRemoteDirectoryExpression(Expression)
protected final void doSetRemoteDirectoryExpression(Expression remoteDirectoryExpression)
public void setFilter(FileListFilter<F> filter)
filter
- the file list filter.public void setDeleteRemoteFiles(boolean deleteRemoteFiles)
deleteRemoteFiles
- true to delete.public void setPreserveTimestamp(boolean preserveTimestamp)
preserveTimestamp
- true to preserve.public void setIntegrationEvaluationContext(EvaluationContext evaluationContext)
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
public final void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
protected void doInit()
InitializingBean.afterPropertiesSet()
.protected String getTemporaryFileSuffix()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void synchronizeToLocalDirectory(File localDirectory)
synchronizeToLocalDirectory
in interface InboundFileSynchronizer
protected boolean copyFileToLocalDirectory(String remoteDirectoryPath, F remoteFile, File localDirectory, Session<F> session) throws IOException
IOException
protected abstract boolean isFile(F file)
protected abstract long getModified(F file)