org.springframework.integration.file.remote.gateway
Class AbstractRemoteFileOutboundGateway<F>
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway<F>
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, NamedComponent, Orderable, MessageHandler, MessageProducer, TrackableComponent
- Direct Known Subclasses:
- FtpOutboundGateway, SftpOutboundGateway
public abstract class AbstractRemoteFileOutboundGateway<F>
- extends AbstractReplyProducingMessageHandler
Base class for Outbound Gateways that perform remote file operations.
- Since:
- 2.1
- Author:
- Gary Russell
Fields inherited from interface org.springframework.core.Ordered |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
sessionFactory
protected final SessionFactory<F> sessionFactory
command
protected final java.lang.String command
COMMAND_LS
public static final java.lang.String COMMAND_LS
- See Also:
- Constant Field Values
COMMAND_GET
public static final java.lang.String COMMAND_GET
- See Also:
- Constant Field Values
COMMAND_RM
public static final java.lang.String COMMAND_RM
- See Also:
- Constant Field Values
COMMAND_MGET
public static final java.lang.String COMMAND_MGET
- See Also:
- Constant Field Values
OPTION_NAME_ONLY
public static final java.lang.String OPTION_NAME_ONLY
- See Also:
- Constant Field Values
OPTION_ALL
public static final java.lang.String OPTION_ALL
- See Also:
- Constant Field Values
OPTION_NOSORT
public static final java.lang.String OPTION_NOSORT
- See Also:
- Constant Field Values
OPTION_SUBDIRS
public static final java.lang.String OPTION_SUBDIRS
- See Also:
- Constant Field Values
OPTION_LINKS
public static final java.lang.String OPTION_LINKS
- See Also:
- Constant Field Values
OPTION_PRESERVE_TIMESTAMP
public static final java.lang.String OPTION_PRESERVE_TIMESTAMP
- See Also:
- Constant Field Values
OPTION_EXCEPTION_WHEN_EMPTY
public static final java.lang.String OPTION_EXCEPTION_WHEN_EMPTY
- See Also:
- Constant Field Values
options
protected volatile java.util.Set<java.lang.String> options
AbstractRemoteFileOutboundGateway
public AbstractRemoteFileOutboundGateway(SessionFactory<F> sessionFactory,
java.lang.String command,
java.lang.String expression)
setOptions
public void setOptions(java.lang.String options)
- Parameters:
options
- the options to set
setRemoteFileSeparator
public void setRemoteFileSeparator(java.lang.String remoteFileSeparator)
- Parameters:
remoteFileSeparator
- the remoteFileSeparator to set
setLocalDirectory
public void setLocalDirectory(java.io.File localDirectory)
- Parameters:
localDirectory
- the localDirectory to set
setAutoCreateLocalDirectory
public void setAutoCreateLocalDirectory(boolean autoCreateLocalDirectory)
- Parameters:
autoCreateLocalDirectory
- the autoCreateLocalDirectory to set
setTemporaryFileSuffix
public void setTemporaryFileSuffix(java.lang.String temporaryFileSuffix)
- Parameters:
temporaryFileSuffix
- the temporaryFileSuffix to set
setFilter
public void setFilter(FileListFilter<F> filter)
- Parameters:
filter
- the filter to set
onInit
protected void onInit()
- Description copied from class:
IntegrationObjectSupport
- Subclasses may implement this for initialization logic.
- Overrides:
onInit
in class AbstractReplyProducingMessageHandler
handleRequestMessage
protected java.lang.Object handleRequestMessage(Message<?> requestMessage)
- Description copied from class:
AbstractReplyProducingMessageHandler
- Subclasses must implement this method to handle the request Message. The return
value may be a Message, a MessageBuilder, or any plain Object. The base class
will handle the final creation of a reply Message from any of those starting
points. If the return value is null, the Message flow will end here.
- Specified by:
handleRequestMessage
in class AbstractReplyProducingMessageHandler
ls
protected java.util.List<?> ls(Session<F> session,
java.lang.String dir)
throws java.io.IOException
- Throws:
java.io.IOException
filterFiles
protected final java.util.List<F> filterFiles(F[] files)
purgeLinks
protected void purgeLinks(java.util.List<F> lsFiles)
purgeDots
protected void purgeDots(java.util.List<F> lsFiles)
get
protected java.io.File get(Session<F> session,
java.lang.String remoteFilePath,
java.lang.String remoteFilename,
boolean lsFirst)
throws java.io.IOException
- Copy a remote file to the configured local directory.
- Parameters:
session
- remoteFilePath
-
- Throws:
java.io.IOException
mGet
protected java.util.List<java.io.File> mGet(Session<F> session,
java.lang.String remoteDirectory,
java.lang.String remoteFilename)
throws java.io.IOException
- Throws:
java.io.IOException
getRemoteFilename
protected java.lang.String getRemoteFilename(java.lang.String remoteFilePath)
- Parameters:
remoteFilePath
-
rm
protected boolean rm(Session<?> session,
java.lang.String remoteFilePath)
throws java.io.IOException
- Throws:
java.io.IOException
isDirectory
protected abstract boolean isDirectory(F file)
isLink
protected abstract boolean isLink(F file)
getFilename
protected abstract java.lang.String getFilename(F file)
getModified
protected abstract long getModified(F file)
asFileInfoList
protected abstract java.util.List<AbstractFileInfo<F>> asFileInfoList(java.util.Collection<F> files)