public class RemoteFileTemplate<F> extends Object implements RemoteFileOperations<F>, InitializingBean, 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() |
String |
append(Message<?> message)
Send a file to a remote server, based on information in a message, appending.
|
String |
append(Message<?> message,
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(String path)
Check if a file exists on the remote server.
|
boolean |
get(Message<?> message,
InputStreamCallback callback)
Retrieve a remote file as an InputStream, based on information in a message.
|
boolean |
get(String remotePath,
InputStreamCallback callback)
Retrieve a remote file as an InputStream.
|
String |
getRemoteFileSeparator() |
String |
getTemporaryFileSuffix() |
boolean |
isUseTemporaryFileName() |
boolean |
remove(String path)
Remove a remote file.
|
void |
rename(String fromPath,
String toPath)
Rename a remote file, creating directories if needed.
|
String |
send(Message<?> message,
FileExistsMode... mode)
Send a file to a remote server, based on information in a message.
|
String |
send(Message<?> message,
String subDirectory,
FileExistsMode... mode)
Send a file to a remote server, based on information in a message.
|
void |
setAutoCreateDirectory(boolean autoCreateDirectory) |
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setCharset(String charset) |
void |
setFileNameExpression(Expression fileNameExpression) |
void |
setFileNameGenerator(FileNameGenerator fileNameGenerator) |
void |
setRemoteDirectoryExpression(Expression remoteDirectoryExpression) |
void |
setRemoteFileSeparator(String remoteFileSeparator) |
void |
setTemporaryFileSuffix(String temporaryFileSuffix) |
void |
setTemporaryRemoteDirectoryExpression(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(String remoteFileSeparator)
public final String getRemoteFileSeparator()
public void setRemoteDirectoryExpression(Expression remoteDirectoryExpression)
public void setTemporaryRemoteDirectoryExpression(Expression temporaryRemoteDirectoryExpression)
public void setFileNameExpression(Expression fileNameExpression)
public String getTemporaryFileSuffix()
public boolean isUseTemporaryFileName()
public void setUseTemporaryFileName(boolean useTemporaryFileName)
public void setFileNameGenerator(FileNameGenerator fileNameGenerator)
public void setCharset(String charset)
public void setTemporaryFileSuffix(String temporaryFileSuffix)
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory
in interface BeanFactoryAware
BeansException
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public String append(Message<?> message)
RemoteFileOperations
append
in interface RemoteFileOperations<F>
message
- The message.public String append(Message<?> message, String subDirectory)
RemoteFileOperations
append
in interface RemoteFileOperations<F>
message
- The message.subDirectory
- The sub directory.public String send(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 String send(Message<?> message, 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(String path)
RemoteFileOperations
exists
in interface RemoteFileOperations<F>
path
- The full path to the file.public boolean remove(String path)
RemoteFileOperations
remove
in interface RemoteFileOperations<F>
path
- The full path to the file.public void rename(String fromPath, String toPath)
RemoteFileOperations
rename
in interface RemoteFileOperations<F>
fromPath
- The current path.toPath
- The new path.public boolean get(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(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.