public class FtpOutboundGateway extends AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
AbstractRemoteFileOutboundGateway.Command, AbstractRemoteFileOutboundGateway.Option
AbstractReplyProducingMessageHandler.RequestHandler
IntegrationManagement.ManagementOverrides
messagingTemplate
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
FtpOutboundGateway(RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate,
MessageSessionCallback<org.apache.commons.net.ftp.FTPFile,?> messageSessionCallback)
Construct an instance with the supplied remote file template and callback
for performing operations on the session.
|
FtpOutboundGateway(RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate,
String command)
Construct an instance with the supplied remote file template
and command ('ls', 'nlst', 'put' or 'mput').
|
FtpOutboundGateway(RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> 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.
|
FtpOutboundGateway(SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory,
MessageSessionCallback<org.apache.commons.net.ftp.FTPFile,?> messageSessionCallback)
Construct an instance using the provided session factory and callback for
performing operations on the session.
|
FtpOutboundGateway(SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory,
String command)
Construct an instance with the supplied session factory
and command ('ls', 'nlst', 'put' or 'mput').
|
FtpOutboundGateway(SessionFactory<org.apache.commons.net.ftp.FTPFile> 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 List<AbstractFileInfo<org.apache.commons.net.ftp.FTPFile>> |
asFileInfoList(Collection<org.apache.commons.net.ftp.FTPFile> files) |
protected void |
doChmod(RemoteFileOperations<org.apache.commons.net.ftp.FTPFile> remoteFileOperations,
String path,
int chmod)
Set the mode on the remote file after transfer; the default implementation does
nothing.
|
protected void |
doInit() |
protected org.apache.commons.net.ftp.FTPFile |
enhanceNameWithSubDirectory(org.apache.commons.net.ftp.FTPFile file,
String directory) |
protected File |
get(Message<?> message,
Session<org.apache.commons.net.ftp.FTPFile> session,
String remoteDir,
String remoteFilePath,
String remoteFilename,
org.apache.commons.net.ftp.FTPFile fileInfoParam)
Copy a remote file to the configured local directory.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected String |
getFilename(AbstractFileInfo<org.apache.commons.net.ftp.FTPFile> file) |
protected String |
getFilename(org.apache.commons.net.ftp.FTPFile file) |
protected long |
getModified(org.apache.commons.net.ftp.FTPFile file) |
boolean |
isChmodCapable() |
protected boolean |
isDirectory(org.apache.commons.net.ftp.FTPFile file) |
protected boolean |
isLink(org.apache.commons.net.ftp.FTPFile file) |
protected List<?> |
ls(Message<?> message,
Session<org.apache.commons.net.ftp.FTPFile> session,
String dir)
List remote files to local representation.
|
protected List<File> |
mGet(Message<?> message,
Session<org.apache.commons.net.ftp.FTPFile> session,
String remoteDirectory,
String remoteFilename) |
protected List<String> |
mPut(Message<?> message,
Session<org.apache.commons.net.ftp.FTPFile> session,
File localDir)
Put files from the provided directory to the remote server recursively.
|
protected boolean |
mv(Message<?> message,
Session<org.apache.commons.net.ftp.FTPFile> session,
String remoteFilePath,
String remoteFileNewPath)
Move one remote path to another.
|
protected List<String> |
nlst(Message<?> message,
Session<org.apache.commons.net.ftp.FTPFile> session,
String dir)
List remote files names for the provided directory.
|
protected String |
put(Message<?> message,
Session<org.apache.commons.net.ftp.FTPFile> session,
String subDirectory)
Put the file based on the message to the remote server.
|
protected boolean |
rm(Message<?> message,
Session<org.apache.commons.net.ftp.FTPFile> session,
String remoteFilePath)
Perform remote delete for the provided path.
|
void |
setWorkingDirExpression(Expression workingDirExpression)
Specify an
Expression to evaluate FTP client working directory
against request message. |
void |
setWorkingDirExpressionString(String workingDirExpression)
Specify a SpEL
Expression to evaluate FTP client working directory
against request message. |
assertRemoteFileTemplateMutability, filterFile, filterFiles, filterMputFiles, getRemoteFilename, getRemoteFileTemplate, handleRequestMessage, purgeDots, purgeLinks, remoteFileTemplateExplicitlySet, setAutoCreateDirectory, setAutoCreateLocalDirectory, setCharset, setChmod, setChmodOctal, setFileExistsMode, setFileNameExpression, setFileNameGenerator, setFilter, setLocalDirectory, setLocalDirectoryExpression, setLocalDirectoryExpressionString, setLocalFilenameGeneratorExpression, setLocalFilenameGeneratorExpressionString, setMputFilter, setOption, setOptions, setRemoteDirectoryExpression, setRemoteFileSeparator, setRenameExpression, setRenameExpressionString, setTemporaryFileSuffix, setTemporaryRemoteDirectoryExpression, setUseTemporaryFileName
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public FtpOutboundGateway(SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, MessageSessionCallback<org.apache.commons.net.ftp.FTPFile,?> messageSessionCallback)
sessionFactory
- the session factory.messageSessionCallback
- the callback.public FtpOutboundGateway(RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, MessageSessionCallback<org.apache.commons.net.ftp.FTPFile,?> messageSessionCallback)
remoteFileTemplate
- the remote file template.messageSessionCallback
- the callback.public FtpOutboundGateway(SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, String command, String expression)
sessionFactory
- the session factory.command
- the command.expression
- the filename expression.public FtpOutboundGateway(RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, String command, String expression)
remoteFileTemplate
- the remote file template.command
- the command.expression
- the filename expression.public FtpOutboundGateway(SessionFactory<org.apache.commons.net.ftp.FTPFile> sessionFactory, String command)
The remoteDirectory
expression is null
assuming to use
the workingDirectory
from the FTP Client.
sessionFactory
- the session factory.command
- the command.public FtpOutboundGateway(RemoteFileTemplate<org.apache.commons.net.ftp.FTPFile> remoteFileTemplate, String command)
The remoteDirectory
expression is null
assuming to use
the workingDirectory
from the FTP Client.
remoteFileTemplate
- the remote file template.command
- the command.public void setWorkingDirExpression(Expression workingDirExpression)
Expression
to evaluate FTP client working directory
against request message.workingDirExpression
- the expression to evaluate working directorypublic void setWorkingDirExpressionString(String workingDirExpression)
Expression
to evaluate FTP client working directory
against request message.workingDirExpression
- the SpEL expression to evaluate working directorypublic String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessageHandlerSupport
protected boolean isDirectory(org.apache.commons.net.ftp.FTPFile file)
isDirectory
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected boolean isLink(org.apache.commons.net.ftp.FTPFile file)
isLink
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected String getFilename(org.apache.commons.net.ftp.FTPFile file)
getFilename
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected String getFilename(AbstractFileInfo<org.apache.commons.net.ftp.FTPFile> file)
getFilename
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected long getModified(org.apache.commons.net.ftp.FTPFile file)
getModified
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected List<AbstractFileInfo<org.apache.commons.net.ftp.FTPFile>> asFileInfoList(Collection<org.apache.commons.net.ftp.FTPFile> files)
asFileInfoList
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected void doInit()
doInit
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected org.apache.commons.net.ftp.FTPFile enhanceNameWithSubDirectory(org.apache.commons.net.ftp.FTPFile file, String directory)
enhanceNameWithSubDirectory
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected List<?> ls(Message<?> message, Session<org.apache.commons.net.ftp.FTPFile> session, String dir) throws IOException
AbstractRemoteFileOutboundGateway
ls
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
message
- the message related to the list requestsession
- the session to perform list commanddir
- the remote directory to list contentIOException
- the IO exception during performing remote commandprotected List<String> nlst(Message<?> message, Session<org.apache.commons.net.ftp.FTPFile> session, String dir) throws IOException
AbstractRemoteFileOutboundGateway
nlst
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
message
- the message related to the current requestsession
- the session to perform list file names commanddir
- the remote directory to list file namesIOException
- the IO exception during performing remote commandprotected File get(Message<?> message, Session<org.apache.commons.net.ftp.FTPFile> session, String remoteDir, String remoteFilePath, String remoteFilename, org.apache.commons.net.ftp.FTPFile fileInfoParam) throws IOException
AbstractRemoteFileOutboundGateway
get
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
message
- the message.session
- the session.remoteDir
- the remote directory.remoteFilePath
- the remote file path.remoteFilename
- the remote file name.fileInfoParam
- the remote file info; if null we will execute an 'ls' command
first.IOException
- Any IOException.protected List<File> mGet(Message<?> message, Session<org.apache.commons.net.ftp.FTPFile> session, String remoteDirectory, String remoteFilename) throws IOException
mGet
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
IOException
protected boolean rm(Message<?> message, Session<org.apache.commons.net.ftp.FTPFile> session, String remoteFilePath) throws IOException
AbstractRemoteFileOutboundGateway
rm
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
message
- the request message related to the path to removesession
- the remote protocol session to perform remove commandremoteFilePath
- the remote path to removeIOException
- the IO exception during performing remote commandprotected boolean mv(Message<?> message, Session<org.apache.commons.net.ftp.FTPFile> session, String remoteFilePath, String remoteFileNewPath) throws IOException
AbstractRemoteFileOutboundGateway
mv
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
message
- the request message related to this move commandsession
- the remote protocol session to perform move commandremoteFilePath
- the source remote pathremoteFileNewPath
- the target remote pathIOException
- the IO exception during performing remote commandprotected String put(Message<?> message, Session<org.apache.commons.net.ftp.FTPFile> session, String subDirectory)
AbstractRemoteFileOutboundGateway
put
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
message
- the request message related to this put commandsession
- the remote protocol session related to this invocation contextsubDirectory
- the target sub directory to putprotected List<String> mPut(Message<?> message, Session<org.apache.commons.net.ftp.FTPFile> session, File localDir)
AbstractRemoteFileOutboundGateway
mPut
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
message
- the request message related to this mPut commandsession
- the remote protocol session for this invocation contextlocalDir
- the local directory to mput to the serverpublic boolean isChmodCapable()
isChmodCapable
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
protected void doChmod(RemoteFileOperations<org.apache.commons.net.ftp.FTPFile> remoteFileOperations, String path, int chmod)
AbstractRemoteFileOutboundGateway
doChmod
in class AbstractRemoteFileOutboundGateway<org.apache.commons.net.ftp.FTPFile>
remoteFileOperations
- the remote file template.path
- the path.chmod
- the chmod to set.