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 java.util.Set<AbstractRemoteFileOutboundGateway.Option> |
options |
protected RemoteFileTemplate<F> |
remoteFileTemplate |
messagingTemplate
EXPRESSION_PARSER, logger
Constructor and Description |
---|
AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate,
AbstractRemoteFileOutboundGateway.Command command,
java.lang.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,
java.lang.String command,
java.lang.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,
java.lang.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,
java.lang.String command,
java.lang.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 java.util.List<AbstractFileInfo<F>> |
asFileInfoList(java.util.Collection<F> files) |
protected void |
doChmod(RemoteFileTemplate<F> remoteFileTemplate,
java.lang.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,
java.lang.String directory) |
protected java.util.List<F> |
filterFiles(F[] files) |
protected java.util.List<java.io.File> |
filterMputFiles(java.io.File[] files) |
protected java.io.File |
get(org.springframework.messaging.Message<?> message,
Session<F> session,
java.lang.String remoteDir,
java.lang.String remoteFilePath,
java.lang.String remoteFilename,
boolean lsFirst)
Copy a remote file to the configured local directory.
|
protected abstract java.lang.String |
getFilename(AbstractFileInfo<F> file) |
protected abstract java.lang.String |
getFilename(F file) |
protected abstract long |
getModified(F file) |
protected java.lang.String |
getRemoteFilename(java.lang.String remoteFilePath) |
protected java.lang.Object |
handleRequestMessage(org.springframework.messaging.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 java.util.List<?> |
ls(Session<F> session,
java.lang.String dir) |
protected java.util.List<java.io.File> |
mGet(org.springframework.messaging.Message<?> message,
Session<F> session,
java.lang.String remoteDirectory,
java.lang.String remoteFilename) |
protected void |
purgeDots(java.util.List<F> lsFiles) |
protected void |
purgeLinks(java.util.List<F> lsFiles) |
void |
setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory) |
void |
setChmod(int chmod)
Set the file permissions after uploading, e.g.
|
void |
setChmodOctal(java.lang.String chmod)
String setter for Spring XML convenience.
|
void |
setExpressionRename(org.springframework.expression.Expression expression)
Deprecated.
|
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) |
void |
setLocalDirectory(java.io.File localDirectory) |
void |
setLocalDirectoryExpression(org.springframework.expression.Expression localDirectoryExpression) |
void |
setLocalFilenameGeneratorExpression(org.springframework.expression.Expression localFilenameGeneratorExpression) |
void |
setLocalFilenameGeneratorExpressionString(java.lang.String localFilenameGeneratorExpression) |
void |
setMputFilter(FileListFilter<java.io.File> filter) |
void |
setOptions(java.lang.String options) |
void |
setRemoteFileSeparator(java.lang.String remoteFileSeparator) |
void |
setRenameExpression(org.springframework.expression.Expression renameExpression) |
void |
setRenameExpressionString(java.lang.String renameExpression) |
void |
setTemporaryFileSuffix(java.lang.String temporaryFileSuffix) |
doInvokeAdvisedRequestHandler, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput
configureMetrics, getActiveCount, getActiveCountLong, getComponentType, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMinDuration, getOrder, getStandardDeviationDuration, handleMessage, isCountsEnabled, isLoggingEnabled, isStatsEnabled, reset, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabled
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
protected final RemoteFileTemplate<F> remoteFileTemplate
protected final AbstractRemoteFileOutboundGateway.Command command
protected volatile java.util.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, java.lang.String command, java.lang.String expression)
sessionFactory
- the session factory.command
- the command.expression
- the filename expression.public AbstractRemoteFileOutboundGateway(SessionFactory<F> sessionFactory, AbstractRemoteFileOutboundGateway.Command command, java.lang.String expression)
sessionFactory
- the session factory.command
- the command.expression
- the filename expression.public AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate, java.lang.String command, java.lang.String expression)
remoteFileTemplate
- the remote file template.command
- the command.expression
- the filename expression.public AbstractRemoteFileOutboundGateway(RemoteFileTemplate<F> remoteFileTemplate, AbstractRemoteFileOutboundGateway.Command command, java.lang.String expression)
remoteFileTemplate
- the remote file template.command
- the command.expression
- the filename expression.public void setOptions(java.lang.String options)
options
- the options to setpublic void setRemoteFileSeparator(java.lang.String remoteFileSeparator)
remoteFileSeparator
- the remoteFileSeparator to setRemoteFileTemplate.setRemoteFileSeparator(String)
public void setLocalDirectory(java.io.File localDirectory)
localDirectory
- the localDirectory to setpublic void setLocalDirectoryExpression(org.springframework.expression.Expression localDirectoryExpression)
public void setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory)
autoCreateLocalDirectory
- the autoCreateLocalDirectory to setpublic void setTemporaryFileSuffix(java.lang.String temporaryFileSuffix)
temporaryFileSuffix
- the temporaryFileSuffix to setRemoteFileTemplate.setTemporaryFileSuffix(String)
public void setFilter(FileListFilter<F> filter)
filter
- the filter to setpublic void setMputFilter(FileListFilter<java.io.File> filter)
filter
- the filter to setpublic void setRenameExpression(org.springframework.expression.Expression renameExpression)
renameExpression
- the expression to use.public void setRenameExpressionString(java.lang.String renameExpression)
renameExpression
- the String in SpEL syntax.@Deprecated public void setExpressionRename(org.springframework.expression.Expression expression)
setRenameExpression(org.springframework.expression.Expression)
.expression
- the expression to set.public void setLocalFilenameGeneratorExpression(org.springframework.expression.Expression localFilenameGeneratorExpression)
localFilenameGeneratorExpression
- the expression to use.public void setLocalFilenameGeneratorExpressionString(java.lang.String localFilenameGeneratorExpression)
localFilenameGeneratorExpression
- the String in SpEL syntax.public void setFileExistsMode(FileExistsMode fileExistsMode)
fileExistsMode
- the fileExistsMode to set.public void setChmodOctal(java.lang.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 AbstractReplyProducingMessageHandler
protected java.lang.Object handleRequestMessage(org.springframework.messaging.Message<?> requestMessage)
AbstractReplyProducingMessageHandler
handleRequestMessage
in class AbstractReplyProducingMessageHandler
requestMessage
- The request message.null
.protected void doChmod(RemoteFileTemplate<F> remoteFileTemplate, java.lang.String path, int chmod)
remoteFileTemplate
- the remote file template.path
- the path.chmod
- the chmod to set.protected java.util.List<?> ls(Session<F> session, java.lang.String dir) throws java.io.IOException
java.io.IOException
protected final java.util.List<java.io.File> filterMputFiles(java.io.File[] files)
protected void purgeLinks(java.util.List<F> lsFiles)
protected void purgeDots(java.util.List<F> lsFiles)
protected java.io.File get(org.springframework.messaging.Message<?> message, Session<F> session, java.lang.String remoteDir, java.lang.String remoteFilePath, java.lang.String remoteFilename, boolean lsFirst) throws java.io.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.java.io.IOException
- Any IOException.protected java.util.List<java.io.File> mGet(org.springframework.messaging.Message<?> message, Session<F> session, java.lang.String remoteDirectory, java.lang.String remoteFilename) throws java.io.IOException
java.io.IOException
protected java.lang.String getRemoteFilename(java.lang.String remoteFilePath)
remoteFilePath
- The remote file path.protected abstract boolean isDirectory(F file)
protected abstract boolean isLink(F file)
protected abstract java.lang.String getFilename(F file)
protected abstract java.lang.String getFilename(AbstractFileInfo<F> file)
protected abstract long getModified(F file)
protected abstract java.util.List<AbstractFileInfo<F>> asFileInfoList(java.util.Collection<F> files)