Class SftpOutboundGateway
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
org.springframework.integration.sftp.gateway.SftpOutboundGateway
- All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>
,Aware
,BeanClassLoaderAware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,Ordered
,ExpressionCapable
,Orderable
,MessageProducer
,HeaderPropagationAware
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,TrackableComponent
,MessageHandler
,reactor.core.CoreSubscriber<Message<?>>
public class SftpOutboundGateway extends AbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
Outbound Gateway for performing remote file operations via SFTP.
- Since:
- 2.1
- Author:
- Gary Russell, Artem Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway
AbstractRemoteFileOutboundGateway.Command, AbstractRemoteFileOutboundGateway.Option
Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
AbstractReplyProducingMessageHandler.RequestHandler
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplate
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
Constructors Constructor Description SftpOutboundGateway(RemoteFileTemplate<com.jcraft.jsch.ChannelSftp.LsEntry> 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.SftpOutboundGateway(RemoteFileTemplate<com.jcraft.jsch.ChannelSftp.LsEntry> remoteFileTemplate, MessageSessionCallback<com.jcraft.jsch.ChannelSftp.LsEntry,?> messageSessionCallback)
Construct an instance with the supplied remote file template and callback for performing operations on the session.SftpOutboundGateway(SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry> 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.SftpOutboundGateway(SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry> sessionFactory, MessageSessionCallback<com.jcraft.jsch.ChannelSftp.LsEntry,?> messageSessionCallback)
Construct an instance using the provided session factory and callback for performing operations on the session. -
Method Summary
Modifier and Type Method Description protected List<AbstractFileInfo<com.jcraft.jsch.ChannelSftp.LsEntry>>
asFileInfoList(Collection<com.jcraft.jsch.ChannelSftp.LsEntry> files)
protected void
doChmod(RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry> remoteFileOperations, String path, int chmod)
Set the mode on the remote file after transfer; the default implementation does nothing.protected com.jcraft.jsch.ChannelSftp.LsEntry
enhanceNameWithSubDirectory(com.jcraft.jsch.ChannelSftp.LsEntry file, String directory)
String
getComponentType()
Subclasses may implement this method to provide component type information.protected String
getFilename(com.jcraft.jsch.ChannelSftp.LsEntry file)
protected String
getFilename(AbstractFileInfo<com.jcraft.jsch.ChannelSftp.LsEntry> file)
protected long
getModified(com.jcraft.jsch.ChannelSftp.LsEntry file)
boolean
isChmodCapable()
protected boolean
isDirectory(com.jcraft.jsch.ChannelSftp.LsEntry file)
protected boolean
isLink(com.jcraft.jsch.ChannelSftp.LsEntry file)
Methods inherited from class org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway
assertRemoteFileTemplateMutability, doInit, filterFile, filterFiles, filterMputFiles, get, getRemoteFilename, getRemoteFileTemplate, handleRequestMessage, ls, mGet, mPut, mv, nlst, purgeDots, purgeLinks, put, remoteFileTemplateExplicitlySet, rm, setAutoCreateDirectory, setAutoCreateLocalDirectory, setCharset, setChmod, setChmodOctal, setFileExistsMode, setFileNameExpression, setFileNameGenerator, setFilter, setLocalDirectory, setLocalDirectoryExpression, setLocalDirectoryExpressionString, setLocalFilenameGeneratorExpression, setLocalFilenameGeneratorExpressionString, setMputFilter, setOption, setOptions, setRemoteDirectoryExpression, setRemoteFileSeparator, setRenameExpression, setRenameExpressionString, setTemporaryFileSuffix, setTemporaryRemoteDirectoryExpression, setUseTemporaryFileName
Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
Methods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe
Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
SftpOutboundGateway
public SftpOutboundGateway(SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry> sessionFactory, MessageSessionCallback<com.jcraft.jsch.ChannelSftp.LsEntry,?> messageSessionCallback)Construct an instance using the provided session factory and callback for performing operations on the session.- Parameters:
sessionFactory
- the session factory.messageSessionCallback
- the callback.
-
SftpOutboundGateway
public SftpOutboundGateway(RemoteFileTemplate<com.jcraft.jsch.ChannelSftp.LsEntry> remoteFileTemplate, MessageSessionCallback<com.jcraft.jsch.ChannelSftp.LsEntry,?> messageSessionCallback)Construct an instance with the supplied remote file template and callback for performing operations on the session.- Parameters:
remoteFileTemplate
- the remote file template.messageSessionCallback
- the callback.
-
SftpOutboundGateway
public SftpOutboundGateway(SessionFactory<com.jcraft.jsch.ChannelSftp.LsEntry> 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.- Parameters:
sessionFactory
- the session factory.command
- the command.expression
- the filename expression.
-
SftpOutboundGateway
public SftpOutboundGateway(RemoteFileTemplate<com.jcraft.jsch.ChannelSftp.LsEntry> 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.- Parameters:
remoteFileTemplate
- the remote file template.command
- the command.expression
- the filename expression.
-
-
Method Details
-
isDirectory
protected boolean isDirectory(com.jcraft.jsch.ChannelSftp.LsEntry file)- Specified by:
isDirectory
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
-
isLink
protected boolean isLink(com.jcraft.jsch.ChannelSftp.LsEntry file)- Specified by:
isLink
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
-
getFilename
- Specified by:
getFilename
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
-
getFilename
- Specified by:
getFilename
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
-
asFileInfoList
protected List<AbstractFileInfo<com.jcraft.jsch.ChannelSftp.LsEntry>> asFileInfoList(Collection<com.jcraft.jsch.ChannelSftp.LsEntry> files)- Specified by:
asFileInfoList
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
-
getModified
protected long getModified(com.jcraft.jsch.ChannelSftp.LsEntry file)- Specified by:
getModified
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
-
enhanceNameWithSubDirectory
protected com.jcraft.jsch.ChannelSftp.LsEntry enhanceNameWithSubDirectory(com.jcraft.jsch.ChannelSftp.LsEntry file, String directory)- Specified by:
enhanceNameWithSubDirectory
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
-
getComponentType
Description copied from class:IntegrationObjectSupport
Subclasses may implement this method to provide component type information.- Specified by:
getComponentType
in interfaceNamedComponent
- Overrides:
getComponentType
in classMessageHandlerSupport
-
isChmodCapable
public boolean isChmodCapable()- Overrides:
isChmodCapable
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
-
doChmod
protected void doChmod(RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry> remoteFileOperations, String path, int chmod)Description copied from class:AbstractRemoteFileOutboundGateway
Set the mode on the remote file after transfer; the default implementation does nothing.- Overrides:
doChmod
in classAbstractRemoteFileOutboundGateway<com.jcraft.jsch.ChannelSftp.LsEntry>
- Parameters:
remoteFileOperations
- the remote file template.path
- the path.chmod
- the chmod to set.
-