INT-3973: SFTP - Support chmod

JIRA: https://jira.spring.io/browse/INT-3973

Add `chmod` to outbound adapter and gateway (put methods).

Polishing - PR Comments

Fix Checkstyle vulnerabilities
This commit is contained in:
Gary Russell
2016-03-21 19:19:27 -04:00
committed by Artem Bilan
parent 2936e97ea3
commit ad0839da8b
22 changed files with 392 additions and 39 deletions

View File

@@ -456,6 +456,7 @@ Similar to the FTP outbound adapter, the _SFTP Outbound Channel Adapter_ support
remote-filename-generator-expression="payload.getName() + '-foo'"
filename-generator="fileNameGenerator"
use-temporary-filename="true"
chmod="600"
mode="REPLACE"/>
----
@@ -484,6 +485,10 @@ However, there may be situations where you don't want to use this technique (for
For situations like this, you can disable this feature by setting `use-temporary-file-name` to `false` (default is `true`).
When this attribute is `false`, the file is written with its final name and the consuming application will need some other mechanism to detect that the file is completely uploaded before accessing it.
_Version 4.3_ introduced the `chmod` attribute which changes the remote file permissions after upload.
Use the conventional Unix octal format, e.g. `600` allows read-write for the file owner only.
When configuring the adapter using java, you can use `setChmodOctal("600")` or `setChmodDecimal(384)`.
[[sftp-outbound-gateway]]
=== SFTP Outbound Gateway
@@ -605,6 +610,10 @@ Refer to the schema documentation for more information.
The message payload resulting from a _put_ operation is a `String` representing the full path of the file on the server after transfer.
_Version 4.3_ introduced the `chmod` attribute which changes the remote file permissions after upload.
Use the conventional Unix octal format, e.g. `600` allows read-write for the file owner only.
When configuring the adapter using java, you can use `setChmod(0600)`.
*mput*
_mput_ sends multiple files to the server and supports the following option:
@@ -622,6 +631,10 @@ The message payload resulting from an _mget_ operation is a `List<String>` objec
See also <<sftp-partial>>
_Version 4.3_ introduced the `chmod` attribute which changes the remote file permissions after upload.
Use the conventional Unix octal format, e.g. `600` allows read-write for the file owner only.
When configuring the adapter using java, you can use `setChmodOctal("600")` or `setChmodDecimal(384)`.
*rm*
The _rm_ command has no options.

View File

@@ -115,9 +115,16 @@ See <<http-inbound>> for more information.
==== SFTP Changes
===== Factory Bean
A new factory bean is provided to simplify the configuration of Jsch proxies for SFTP.
See <<sftp-proxy-factory-bean>> for more information.
===== chmod
The SFTP outbound gateway (for `put` and `mput` commands) and the SFTP outbound channel adapter now support the
`chmod` attribute to change the remote file permissions after uploading.
See <<sftp-outbound>> and <<sftp-outbound-gateway>> for more information.
==== FTP Changes
The `FtpSession` now supports `null` for the `list()` and `listNames()` method, since it is possible by the