public class RemoteFileTemplate<F> extends java.lang.Object implements RemoteFileOperations<F>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.BeanFactoryAware
Modifier and Type | Field and Description |
---|---|
protected SessionFactory<F> |
sessionFactory
the
SessionFactory for acquiring remote file Sessions. |
Constructor and Description |
---|
RemoteFileTemplate(SessionFactory<F> sessionFactory) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
java.lang.String |
append(org.springframework.messaging.Message<?> message)
Send a file to a remote server, based on information in a message, appending.
|
java.lang.String |
append(org.springframework.messaging.Message<?> message,
java.lang.String subDirectory)
Send a file to a remote server, based on information in a message, appending.
|
<T> T |
execute(SessionCallback<F,T> callback)
Execute the callback's doInSession method after obtaining a session.
|
<T,C> T |
executeWithClient(ClientCallback<C,T> callback)
Execute the callback's doWithClient method after obtaining a session's
client, providing access to low level methods.
|
boolean |
exists(java.lang.String path)
Check if a file exists on the remote server.
|
boolean |
get(org.springframework.messaging.Message<?> message,
InputStreamCallback callback)
Retrieve a remote file as an InputStream, based on information in a message.
|
boolean |
get(java.lang.String remotePath,
InputStreamCallback callback)
Retrieve a remote file as an InputStream.
|
java.lang.String |
getRemoteFileSeparator() |
java.lang.String |
getTemporaryFileSuffix() |
boolean |
isUseTemporaryFileName() |
boolean |
remove(java.lang.String path)
Remove a remote file.
|
void |
rename(java.lang.String fromPath,
java.lang.String toPath)
Rename a remote file, creating directories if needed.
|
java.lang.String |
send(org.springframework.messaging.Message<?> message,
FileExistsMode... mode)
Send a file to a remote server, based on information in a message.
|
java.lang.String |
send(org.springframework.messaging.Message<?> message,
java.lang.String subDirectory,
FileExistsMode... mode)
Send a file to a remote server, based on information in a message.
|
void |
setAutoCreateDirectory(boolean autoCreateDirectory) |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setCharset(java.lang.String charset) |
void |
setFileNameExpression(org.springframework.expression.Expression fileNameExpression) |
void |
setFileNameGenerator(FileNameGenerator fileNameGenerator) |
void |
setRemoteDirectoryExpression(org.springframework.expression.Expression remoteDirectoryExpression) |
void |
setRemoteFileSeparator(java.lang.String remoteFileSeparator) |
void |
setTemporaryFileSuffix(java.lang.String temporaryFileSuffix) |
void |
setTemporaryRemoteDirectoryExpression(org.springframework.expression.Expression temporaryRemoteDirectoryExpression) |
void |
setUseTemporaryFileName(boolean useTemporaryFileName) |
protected final SessionFactory<F> sessionFactory
SessionFactory
for acquiring remote file Sessions.public RemoteFileTemplate(SessionFactory<F> sessionFactory)
public void setAutoCreateDirectory(boolean autoCreateDirectory)
public void setRemoteFileSeparator(java.lang.String remoteFileSeparator)
public final java.lang.String getRemoteFileSeparator()
public void setRemoteDirectoryExpression(org.springframework.expression.Expression remoteDirectoryExpression)
public void setTemporaryRemoteDirectoryExpression(org.springframework.expression.Expression temporaryRemoteDirectoryExpression)
public void setFileNameExpression(org.springframework.expression.Expression fileNameExpression)
public java.lang.String getTemporaryFileSuffix()
public boolean isUseTemporaryFileName()
public void setUseTemporaryFileName(boolean useTemporaryFileName)
public void setFileNameGenerator(FileNameGenerator fileNameGenerator)
public void setCharset(java.lang.String charset)
public void setTemporaryFileSuffix(java.lang.String temporaryFileSuffix)
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
org.springframework.beans.BeansException
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public java.lang.String append(org.springframework.messaging.Message<?> message)
RemoteFileOperations
append
in interface RemoteFileOperations<F>
message
- The message.public java.lang.String append(org.springframework.messaging.Message<?> message, java.lang.String subDirectory)
RemoteFileOperations
append
in interface RemoteFileOperations<F>
message
- The message.subDirectory
- The sub directory.public java.lang.String send(org.springframework.messaging.Message<?> message, FileExistsMode... mode)
RemoteFileOperations
send
in interface RemoteFileOperations<F>
message
- The message.mode
- See FileExistsMode
(optional; default REPLACE). A
vararg is used to make the argument optional; only the first will be
used if more than one is provided.public java.lang.String send(org.springframework.messaging.Message<?> message, java.lang.String subDirectory, FileExistsMode... mode)
RemoteFileOperations
send
in interface RemoteFileOperations<F>
message
- The message.subDirectory
- The sub directory.mode
- See FileExistsMode
(optional; default REPLACE). A
vararg is used to make the argument optional; only the first will be
used if more than one is provided.public boolean exists(java.lang.String path)
RemoteFileOperations
exists
in interface RemoteFileOperations<F>
path
- The full path to the file.public boolean remove(java.lang.String path)
RemoteFileOperations
remove
in interface RemoteFileOperations<F>
path
- The full path to the file.public void rename(java.lang.String fromPath, java.lang.String toPath)
RemoteFileOperations
rename
in interface RemoteFileOperations<F>
fromPath
- The current path.toPath
- The new path.public boolean get(org.springframework.messaging.Message<?> message, InputStreamCallback callback)
RemoteFileOperations
get
in interface RemoteFileOperations<F>
message
- The message which will be evaluated to generate the remote path.callback
- the callback.public boolean get(java.lang.String remotePath, InputStreamCallback callback)
RemoteFileOperations
get
in interface RemoteFileOperations<F>
remotePath
- The remote path to the file.callback
- the callback.public <T> T execute(SessionCallback<F,T> callback)
RemoteFileOperations
execute
in interface RemoteFileOperations<F>
T
- The type returned by
SessionCallback.doInSession(org.springframework.integration.file.remote.session.Session)
.callback
- the SessionCallback.public <T,C> T executeWithClient(ClientCallback<C,T> callback)
RemoteFileOperations
executeWithClient
in interface RemoteFileOperations<F>
T
- The type returned by ClientCallback.doWithClient(Object)
.C
- The type of the underlying client object.callback
- the ClientCallback.