Class FileTransferringMessageHandler<F>
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.file.remote.handler.FileTransferringMessageHandler<F>
- All Implemented Interfaces:
org.reactivestreams.Subscriber<org.springframework.messaging.Message<?>>,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.core.Ordered,org.springframework.integration.context.ExpressionCapable,org.springframework.integration.context.Orderable,org.springframework.integration.IntegrationPattern,org.springframework.integration.support.context.NamedComponent,org.springframework.integration.support.management.IntegrationManagement,org.springframework.integration.support.management.TrackableComponent,org.springframework.messaging.MessageHandler,reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>
public class FileTransferringMessageHandler<F>
extends org.springframework.integration.handler.AbstractMessageHandler
A
MessageHandler implementation that transfers files to a remote server.- Since:
- 2.0
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected RemoteFileTemplate<F>remoteFileTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger -
Constructor Summary
Constructors Constructor Description FileTransferringMessageHandler(RemoteFileTemplate<F> remoteFileTemplate)FileTransferringMessageHandler(RemoteFileTemplate<F> remoteFileTemplate, FileExistsMode mode)FileTransferringMessageHandler(SessionFactory<F> sessionFactory) -
Method Summary
Modifier and Type Method Description protected voiddoChmod(RemoteFileTemplate<F> remoteFileTemplate, java.lang.String path, int chmod)Set the mode on the remote file after transfer; the default implementation does nothing.protected java.lang.StringgetTemporaryFileSuffix()protected voidhandleMessageInternal(org.springframework.messaging.Message<?> message)booleanisChmodCapable()protected booleanisUseTemporaryFileName()protected voidonInit()voidsetAutoCreateDirectory(boolean autoCreateDirectory)Abooleanflag to indicate automatically create the directory or not.voidsetCharset(java.lang.String charset)Set the charset to use when converting String payloads to bytes as the content of the remote file.voidsetChmod(int chmod)Set the file permissions after uploading, e.g.voidsetChmodOctal(java.lang.String chmod)String setter for Spring XML convenience.voidsetFileNameGenerator(FileNameGenerator fileNameGenerator)Set the file name generator used to generate the remote filename to be used when transferring files to the remote system.voidsetRemoteDirectoryExpression(org.springframework.expression.Expression remoteDirectoryExpression)Specify a remote directory path SpEL expression.voidsetRemoteDirectoryExpressionString(java.lang.String remoteDirectoryExpression)Specify a remote directory path SpEL expression.voidsetRemoteFileSeparator(java.lang.String remoteFileSeparator)Specify a remote file separator symbol.voidsetTemporaryFileSuffix(java.lang.String temporaryFileSuffix)Set the temporary suffix to use when transferring files to the remote system.voidsetTemporaryRemoteDirectoryExpression(org.springframework.expression.Expression temporaryRemoteDirectoryExpression)Specify a remote directory path SpEL expression.voidsetTemporaryRemoteDirectoryExpressionString(java.lang.String temporaryRemoteDirectoryExpression)Specify a remote directory path SpEL expression.voidsetUseTemporaryFileName(boolean useTemporaryFileName)Abooleanflag to use temporary files names or not.Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribeMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getComponentType, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
Constructor Details
-
FileTransferringMessageHandler
-
FileTransferringMessageHandler
-
FileTransferringMessageHandler
public FileTransferringMessageHandler(RemoteFileTemplate<F> remoteFileTemplate, FileExistsMode mode)
-
-
Method Details
-
setAutoCreateDirectory
public void setAutoCreateDirectory(boolean autoCreateDirectory)Abooleanflag to indicate automatically create the directory or not.- Parameters:
autoCreateDirectory- true to automatically create the directory.- See Also:
RemoteFileTemplate.setAutoCreateDirectory(boolean)
-
setRemoteFileSeparator
public void setRemoteFileSeparator(java.lang.String remoteFileSeparator)Specify a remote file separator symbol.- Parameters:
remoteFileSeparator- the remote file separator.- See Also:
RemoteFileTemplate.setRemoteFileSeparator(String)
-
setRemoteDirectoryExpression
public void setRemoteDirectoryExpression(org.springframework.expression.Expression remoteDirectoryExpression)Specify a remote directory path SpEL expression.- Parameters:
remoteDirectoryExpression- the remote directory expression- See Also:
RemoteFileTemplate.setRemoteDirectoryExpression(Expression)
-
setRemoteDirectoryExpressionString
public void setRemoteDirectoryExpressionString(java.lang.String remoteDirectoryExpression)Specify a remote directory path SpEL expression.- Parameters:
remoteDirectoryExpression- the remote directory expression- Since:
- 4.3.13
- See Also:
setRemoteDirectoryExpression(Expression)
-
setTemporaryRemoteDirectoryExpression
public void setTemporaryRemoteDirectoryExpression(org.springframework.expression.Expression temporaryRemoteDirectoryExpression)Specify a remote directory path SpEL expression.- Parameters:
temporaryRemoteDirectoryExpression- the temporary remote directory expression- See Also:
RemoteFileTemplate.setTemporaryRemoteDirectoryExpression(Expression)
-
setTemporaryRemoteDirectoryExpressionString
public void setTemporaryRemoteDirectoryExpressionString(java.lang.String temporaryRemoteDirectoryExpression)Specify a remote directory path SpEL expression.- Parameters:
temporaryRemoteDirectoryExpression- the temporary remote directory expression- Since:
- 4.3.13
- See Also:
setTemporaryRemoteDirectoryExpression(Expression)
-
getTemporaryFileSuffix
protected java.lang.String getTemporaryFileSuffix() -
isUseTemporaryFileName
protected boolean isUseTemporaryFileName() -
setUseTemporaryFileName
public void setUseTemporaryFileName(boolean useTemporaryFileName)Abooleanflag to use temporary files names or not. Defaults totrue.- Parameters:
useTemporaryFileName- true to use a temporary file name.- See Also:
RemoteFileTemplate.setUseTemporaryFileName(boolean)
-
setFileNameGenerator
Set the file name generator used to generate the remote filename to be used when transferring files to the remote system. DefaultDefaultFileNameGenerator.- Parameters:
fileNameGenerator- the file name generator.- See Also:
RemoteFileTemplate.setFileNameGenerator(FileNameGenerator)
-
setCharset
public void setCharset(java.lang.String charset)Set the charset to use when converting String payloads to bytes as the content of the remote file. DefaultUTF-8.- Parameters:
charset- the charset.- See Also:
RemoteFileTemplate.setCharset(String)
-
setTemporaryFileSuffix
public void setTemporaryFileSuffix(java.lang.String temporaryFileSuffix)Set the temporary suffix to use when transferring files to the remote system. Default ".writing".- Parameters:
temporaryFileSuffix- the temporary file suffix.- See Also:
RemoteFileTemplate.setTemporaryFileSuffix(String)
-
setChmodOctal
public void setChmodOctal(java.lang.String chmod)String setter for Spring XML convenience.- Parameters:
chmod- permissions as an octal string e.g "600";- Since:
- 4.3
- See Also:
setChmod(int)
-
setChmod
public void setChmod(int chmod)Set the file permissions after uploading, e.g. 0600 for owner read/write.- Parameters:
chmod- the permissions.- Since:
- 4.3
-
isChmodCapable
public boolean isChmodCapable() -
onInit
protected void onInit()- Overrides:
onInitin classorg.springframework.integration.context.IntegrationObjectSupport
-
handleMessageInternal
protected void handleMessageInternal(org.springframework.messaging.Message<?> message)- Specified by:
handleMessageInternalin classorg.springframework.integration.handler.AbstractMessageHandler
-
doChmod
Set the mode on the remote file after transfer; the default implementation does nothing.- Parameters:
remoteFileTemplate- the remote file template.path- the path.chmod- the chmod to set.- Since:
- 4.3
-