public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReplyProducingMessageHandler
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractRemoteFileOutboundGateway.Command
Enumeration of commands supported by the gateways.
|
static class |
AbstractRemoteFileOutboundGateway.Option
Enumeration of options supported by various commands.
|
AbstractReplyProducingMessageHandler.RequestHandler| Modifier and Type | Field and Description |
|---|---|
protected AbstractRemoteFileOutboundGateway.Command |
command |
protected Set<AbstractRemoteFileOutboundGateway.Option> |
options |
protected RemoteFileTemplate<F> |
remoteFileTemplate |
messagingTemplateEXPRESSION_PARSER, loggerHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate,
AbstractRemoteFileOutboundGateway.Command command,
String expression)
Construct an instance with the supplied remote file template, a command ('ls',
'get' etc), and an expression to determine the filename.
|
AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate,
MessageSessionCallback<F,?> messageSessionCallback)
Construct an instance with the supplied remote file template and callback
for performing operations on the session.
|
AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate,
String command,
String expression)
Construct an instance with the supplied remote file template, a command ('ls',
'get' etc), and an expression to determine the filename.
|
AbstractRemoteFileOutboundGateway(SessionFactory<F> sessionFactory,
AbstractRemoteFileOutboundGateway.Command command,
String expression)
Construct an instance with the supplied session factory, a command ('ls', 'get'
etc), and an expression to determine the filename.
|
AbstractRemoteFileOutboundGateway(SessionFactory<F> sessionFactory,
MessageSessionCallback<F,?> messageSessionCallback)
Construct an instance using the provided session factory and callback for
performing operations on the session.
|
AbstractRemoteFileOutboundGateway(SessionFactory<F> sessionFactory,
String command,
String expression)
Construct an instance with the supplied session factory, a command ('ls', 'get'
etc), and an expression to determine the filename.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract List<AbstractFileInfo<F>> |
asFileInfoList(Collection<F> files) |
protected void |
doChmod(RemoteFileTemplate<F> remoteFileTemplate,
String path,
int chmod)
Set the mode on the remote file after transfer; the default implementation does
nothing.
|
protected void |
doInit() |
protected abstract F |
enhanceNameWithSubDirectory(F file,
String directory) |
protected List<F> |
filterFiles(F[] files) |
protected List<File> |
filterMputFiles(File[] files) |
protected File |
get(Message<?> message,
Session<F> session,
String remoteDir,
String remoteFilePath,
String remoteFilename,
boolean lsFirst)
Copy a remote file to the configured local directory.
|
protected abstract String |
getFilename(AbstractFileInfo<F> file) |
protected abstract String |
getFilename(F file) |
protected abstract long |
getModified(F file) |
protected String |
getRemoteFilename(String remoteFilePath) |
protected Object |
handleRequestMessage(Message<?> requestMessage)
Subclasses must implement this method to handle the request Message.
|
boolean |
isChmodCapable() |
protected abstract boolean |
isDirectory(F file) |
protected abstract boolean |
isLink(F file) |
protected List<?> |
ls(Session<F> session,
String dir) |
protected List<File> |
mGet(Message<?> message,
Session<F> session,
String remoteDirectory,
String remoteFilename) |
protected void |
purgeDots(List<F> lsFiles) |
protected void |
purgeLinks(List<F> lsFiles) |
void |
setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory)
A
boolean flag to identify if local directory should be created automatically. |
void |
setChmod(int chmod)
Set the file permissions after uploading, e.g.
|
void |
setChmodOctal(String chmod)
String setter for Spring XML convenience.
|
void |
setFileExistsMode(FileExistsMode fileExistsMode)
Determine the action to take when using GET and MGET operations when the file
already exists locally, or PUT and MPUT when the file exists on the remote
system.
|
void |
setFilter(FileListFilter<F> filter)
Set a
FileListFilter to filter remote files. |
void |
setLocalDirectory(File localDirectory)
Specify a directory path where remote files will be transferred to.
|
void |
setLocalDirectoryExpression(Expression localDirectoryExpression)
Specify a SpEL expression to evaluate directory path where remote files will be transferred to.
|
void |
setLocalFilenameGeneratorExpression(Expression localFilenameGeneratorExpression)
Specify a SpEL expression for local files renaming after downloading.
|
void |
setLocalFilenameGeneratorExpressionString(String localFilenameGeneratorExpression)
Specify a SpEL expression for local files renaming after downloading.
|
void |
setMputFilter(FileListFilter<File> filter)
A
FileListFilter that runs against the local file system view when
using MPUT command. |
void |
setOption(AbstractRemoteFileOutboundGateway.Option... options)
Specify the array of options for various gateway commands.
|
void |
setOptions(String options)
Specify the array of options for various gateway commands.
|
void |
setRemoteFileSeparator(String remoteFileSeparator)
Set the file separator when dealing with remote files; default '/'.
|
void |
setRenameExpression(Expression renameExpression)
Specify a SpEL expression for files renaming during transfer.
|
void |
setRenameExpressionString(String renameExpression)
Specify a SpEL expression for files renaming during transfer.
|
void |
setTemporaryFileSuffix(String temporaryFileSuffix)
Set the temporary suffix to use when transferring files to the remote system.
|
doInvokeAdvisedRequestHandler, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplycreateOutputMessage, getOutputChannel, isAsync, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutputconfigureMetrics, getActiveCount, getActiveCountLong, getComponentType, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMinDuration, getOrder, getStandardDeviationDuration, handleMessage, isCountsEnabled, isLoggingEnabled, isStatsEnabled, onComplete, onError, onNext, onSubscribe, reset, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabledafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentNameprotected final RemoteFileTemplate<F> remoteFileTemplate
protected final AbstractRemoteFileOutboundGateway.Command command
protected final Set<AbstractRemoteFileOutboundGateway.Option> options
public AbstractRemoteFileOutboundGateway(SessionFactory<F> sessionFactory, MessageSessionCallback<F,?> messageSessionCallback)
sessionFactory - the session factory.messageSessionCallback - the callback.public AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate, MessageSessionCallback<F,?> messageSessionCallback)
remoteFileTemplate - the remote file template.messageSessionCallback - the callback.public AbstractRemoteFileOutboundGateway(SessionFactory<F> sessionFactory, String command, String expression)
sessionFactory - the session factory.command - the command.expression - the filename expression.public AbstractRemoteFileOutboundGateway(SessionFactory<F> sessionFactory, AbstractRemoteFileOutboundGateway.Command command, String expression)
sessionFactory - the session factory.command - the command.expression - the filename expression.public AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate, String command, String expression)
remoteFileTemplate - the remote file template.command - the command.expression - the filename expression.public AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate, AbstractRemoteFileOutboundGateway.Command command, String expression)
remoteFileTemplate - the remote file template.command - the command.expression - the filename expression.public void setOptions(String options)
options - the options to setpublic void setOption(AbstractRemoteFileOutboundGateway.Option... options)
options - the AbstractRemoteFileOutboundGateway.Option array to use.public void setRemoteFileSeparator(String remoteFileSeparator)
remoteFileSeparator - the separator.RemoteFileTemplate.setRemoteFileSeparator(String)public void setLocalDirectory(File localDirectory)
localDirectory - the localDirectory to setpublic void setLocalDirectoryExpression(Expression localDirectoryExpression)
localDirectoryExpression - the SpEL to determine the local directory.public void setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory)
boolean flag to identify if local directory should be created automatically.
Defaults to true.autoCreateLocalDirectory - the autoCreateLocalDirectory to setpublic void setTemporaryFileSuffix(String temporaryFileSuffix)
.writing.temporaryFileSuffix - the temporaryFileSuffix to setRemoteFileTemplate.setTemporaryFileSuffix(String)public void setFilter(FileListFilter<F> filter)
FileListFilter to filter remote files.filter - the filter to setpublic void setMputFilter(FileListFilter<File> filter)
FileListFilter that runs against the local file system view when
using MPUT command.filter - the filter to setpublic void setRenameExpression(Expression renameExpression)
renameExpression - the expression to use.public void setRenameExpressionString(String renameExpression)
renameExpression - the String in SpEL syntax.public void setLocalFilenameGeneratorExpression(Expression localFilenameGeneratorExpression)
localFilenameGeneratorExpression - the expression to use.public void setLocalFilenameGeneratorExpressionString(String localFilenameGeneratorExpression)
localFilenameGeneratorExpression - the String in SpEL syntax.public void setFileExistsMode(FileExistsMode fileExistsMode)
fileExistsMode - the fileExistsMode to set.public void setChmodOctal(String chmod)
chmod - permissions as an octal string e.g "600";setChmod(int)public void setChmod(int chmod)
chmod - the permissions.public boolean isChmodCapable()
protected void doInit()
doInit in class AbstractReplyProducingMessageHandlerprotected Object handleRequestMessage(Message<?> requestMessage)
AbstractReplyProducingMessageHandlerhandleRequestMessage in class AbstractReplyProducingMessageHandlerrequestMessage - The request message.null.protected void doChmod(RemoteFileTemplate<F> remoteFileTemplate, String path, int chmod)
remoteFileTemplate - the remote file template.path - the path.chmod - the chmod to set.protected List<?> ls(Session<F> session, String dir) throws IOException
IOExceptionprotected File get(Message<?> message, Session<F> session, String remoteDir, String remoteFilePath, String remoteFilename, boolean lsFirst) throws IOException
message - The message.session - The session.remoteDir - The remote directory.remoteFilePath - The remote file path.remoteFilename - The remote file name.lsFirst - true to execute an 'ls' command first.IOException - Any IOException.protected List<File> mGet(Message<?> message, Session<F> session, String remoteDirectory, String remoteFilename) throws IOException
IOExceptionprotected String getRemoteFilename(String remoteFilePath)
remoteFilePath - The remote file path.protected abstract boolean isDirectory(F file)
protected abstract boolean isLink(F file)
protected abstract String getFilename(AbstractFileInfo<F> file)
protected abstract long getModified(F file)
protected abstract List<AbstractFileInfo<F>> asFileInfoList(Collection<F> files)