GH-3026 Support chmod with FTP
Resolves https://github.com/spring-projects/spring-integration/issues/3026 * Fix exception messages; remove test TODOs; test works on Windows
This commit is contained in:
committed by
Artem Bilan
parent
f256974dd8
commit
a4f7412cf5
@@ -837,6 +837,7 @@ The following example shows how to configure an `outbound-channel-adapter`:
|
||||
temporary-remote-directory-expression="headers['temp_remote_dir']"
|
||||
filename-generator="fileNameGenerator"
|
||||
use-temporary-filename="true"
|
||||
chmod="600"
|
||||
mode="REPLACE"/>
|
||||
----
|
||||
====
|
||||
@@ -864,6 +865,11 @@ The modes are defined by the `FileExistsMode` enumeration, which includes the fo
|
||||
`IGNORE` and `FAIL` do not transfer the file.
|
||||
`FAIL` causes an exception to be thrown, while `IGNORE` silently ignores the transfer (although a `DEBUG` log entry is produced).
|
||||
|
||||
Version 5.2 introduced the `chmod` attribute, which you can use to change the remote file permissions after upload.
|
||||
You can use the conventional Unix octal format (for example, `600` allows read-write for the file owner only).
|
||||
When configuring the adapter using java, you can use `setChmodOctal("600")` or `setChmod(0600)`.
|
||||
Only applies if your FTP server supports the `SITE CHMOD` subcommand.
|
||||
|
||||
==== Avoiding Partially Written Files
|
||||
|
||||
One of the common problems that arises when dealing with file transfers is the possibility of processing a partial file.
|
||||
@@ -1189,6 +1195,11 @@ See the https://github.com/spring-projects/spring-integration/tree/master/spring
|
||||
|
||||
The message payload resulting from a `put` operation is a `String` that represents the full path of the file on the server after transfer.
|
||||
|
||||
Version 5.2 introduced the `chmod` attribute, which changes the remote file permissions after upload.
|
||||
You can use the conventional Unix octal format (for example, `600` allows read-write for the file owner only).
|
||||
When configuring the adapter using java, you can use `setChmod(0600)`.
|
||||
Only applies if your FTP server supports the `SITE CHMOD` subcommand.
|
||||
|
||||
Using the `mput` Command
|
||||
|
||||
The `mput` sends multiple files to the server and supports only one option:
|
||||
@@ -1208,6 +1219,11 @@ The message payload resulting from an `mget` operation is a `List<String>` objec
|
||||
|
||||
See also <<ftp-partial>>.
|
||||
|
||||
Version 5.2 introduced the `chmod` attribute, which lets you change the remote file permissions after upload.
|
||||
You can use the conventional Unix octal format (for example, `600` allows read-write for the file owner only).
|
||||
When configuring the adapter with Java, you can use `setChmodOctal("600")` or `setChmod(0600)`.
|
||||
Only applies if your FTP server supports the `SITE CHMOD` subcommand.
|
||||
|
||||
==== Using the `rm` Command
|
||||
|
||||
The `rm` command removes files.
|
||||
|
||||
@@ -855,6 +855,10 @@ The modes are defined by the `FileExistsMode` enumeration, which has the followi
|
||||
With `IGNORE` and `FAIL`, the file is not transferred.
|
||||
`FAIL` causes an exception to be thrown, while `IGNORE` silently ignores the transfer (although a `DEBUG` log entry is produced).
|
||||
|
||||
Version 4.3 introduced the `chmod` attribute, which you can use to change the remote file permissions after upload.
|
||||
You can use the conventional Unix octal format (for example, `600` allows read-write for the file owner only).
|
||||
When configuring the adapter using java, you can use `setChmodOctal("600")` or `setChmod(0600)`.
|
||||
|
||||
==== Avoiding Partially Written Files
|
||||
|
||||
One of the common problems when dealing with file transfers is the possibility of processing a partial file.
|
||||
@@ -869,10 +873,6 @@ However, there may be situations where you do not want to use this technique (fo
|
||||
For situations like this, you can disable this feature by setting `use-temporary-file-name` to `false` (the default is `true`).
|
||||
When this attribute is `false`, the file is written with its final name, and the consuming application needs some other mechanism to detect that the file is completely uploaded before accessing it.
|
||||
|
||||
Version 4.3 introduced the `chmod` attribute, which you can use to change the remote file permissions after upload.
|
||||
You can use the conventional Unix octal format (for example, `600` allows read-write for the file owner only).
|
||||
When configuring the adapter using java, you can use `setChmodOctal("600")` or `setChmodDecimal(384)`.
|
||||
|
||||
==== Configuring with Java Configuration
|
||||
|
||||
The following Spring Boot application shows an example of how to configure the outbound adapter with Java:
|
||||
@@ -1174,7 +1174,7 @@ See also <<sftp-partial>>.
|
||||
|
||||
Version 4.3 introduced the `chmod` attribute, which lets you change the remote file permissions after upload.
|
||||
You can use the conventional Unix octal format (for example, `600` allows read-write for the file owner only).
|
||||
When configuring the adapter with Java, you can use `setChmodOctal("600")` or `setChmodDecimal(384)`.
|
||||
When configuring the adapter with Java, you can use `setChmodOctal("600")` or `setChmod(0600)`.
|
||||
|
||||
Using the `rm` Command
|
||||
|
||||
|
||||
@@ -61,6 +61,12 @@ See <<./ftp.adoc#ftp-server-events, Apache Mina FTP Server Events>> and <<./sftp
|
||||
Simple Apache Avro transformers are now provided.
|
||||
See <<./transformers.adoc#avro-transformers, Avro Transformers>> for more information.
|
||||
|
||||
[[x5.2-ftp-chmod]]
|
||||
==== FTP File Permissions
|
||||
|
||||
The FTP outbound endpoints now support `chmod` to change permissions on the uploaded file.
|
||||
(SFTP already supported it since version 4.3).
|
||||
See <<./ftp.adoc#ftp-outbound,FTP Outbound Channel Adapter>> and <<./ftp.adoc#ftp-outbound-gateway,FTP Outbound Gateway>> for more information.
|
||||
|
||||
[[x5.2-general]]
|
||||
=== General Changes
|
||||
|
||||
Reference in New Issue
Block a user