INT-3088 (S)FTP Outbound Gateway - PUT and MPUT

- Core support in file module
- FTP Parser and Test

https://jira.springsource.org/browse/INT-3088

INT-3088 Add SFTP Support for PUT, MPUT

INT-3088 Polishing - PR Comments

INT-3088 Docbook For PUT/MPUT
This commit is contained in:
Gary Russell
2013-11-19 12:56:07 +02:00
committed by Artem Bilan
parent 88de8117aa
commit 59d6f7dfc1
29 changed files with 1163 additions and 345 deletions

View File

@@ -368,6 +368,8 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
<listitem>mget (retrieve file(s))</listitem>
<listitem>rm (remove file(s))</listitem>
<listitem>mv (move/rename file)</listitem>
<listitem>put (send file)</listitem>
<listitem>mput (send multiple files)</listitem>
</itemizedlist>
</para>
<para><emphasis role="bold">ls</emphasis></para>
@@ -422,6 +424,7 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
<para>
<emphasis>mget</emphasis> retrieves multiple remote files based on a pattern and supports the following option:
<itemizedlist>
<listitem>-P - preserve the timestamps of the remote files</listitem>
<listitem>-x - Throw an exception if no files match the pattern (otherwise an empty
list is returned)</listitem>
</itemizedlist>
@@ -457,6 +460,40 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
so that the remote directory structure is retained locally.
</para>
</note>
<para><emphasis role="bold">put</emphasis></para>
<para>
<emphasis>put</emphasis> sends a file to the remote server; the payload of the message can be a
<classname>java.io.File</classname>, a <classname>byte[]</classname> or a <classname>String</classname>.
A <code>remote-filename-generator</code> (or expression) is used to name the remote file. Other available attributes include
<code>remote-directory</code>, <code>temporary-remote-directory</code> (and their <code>*-expression</code>)
equivalents, <code>use-temporary-file-name</code>, and <code>auto-create-directory</code>. Refer to the
schema documentation for more information.
</para>
<para>
The message payload resulting from a <emphasis>put</emphasis> operation is a
<classname>String</classname> representing the full path of the file on the server after transfer.
</para>
<para><emphasis role="bold">mput</emphasis></para>
<para>
<emphasis>mput</emphasis> sends multiple files to the server and supports the following option:
<itemizedlist>
<listitem>-R - Recursive - send all files (possibly filtered) in the directory and subdirectories</listitem>
</itemizedlist>
</para>
<para>
The message payload must be a <classname>java.io.File</classname> representing a local directory.
</para>
<para>
The same attributes as the <code>put</code> command are supported. In addition, files in the local
directory can be filtered with one of <code>mput-pattern</code>, <code>mput-regex</code> or
<code>mput-filter</code>. The filter works with recursion, as long as the subdirectories themselves
pass the filter. Subdirectories that do not pass the filter are not recursed.
</para>
<para>
The message payload resulting from an <emphasis>mget</emphasis> operation is a
<classname>List&lt;String&gt;</classname> object - a List of remote file paths resulting from
the transfer.
</para>
<para><emphasis role="bold">rm</emphasis></para>
<para>
The <emphasis>rm</emphasis> command has no options.
@@ -566,4 +603,15 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
sessions are closed when they are returned to the cache. New requests for sessions will establish new sessions as necessary.
</para>
</section>
<section id="ftp-rft">
<title>RemoteFileTemplate</title>
<para>
Starting with <emphasis>Spring Integration version 3.0</emphasis> a new abstraction is provided over the
<classname>FtpSession</classname> object. The template provides methods to send, retrieve (as an
<classname>InputStream</classname>), remove, and rename files. In addition an <code>execute</code>
method is provided allowing the caller to execute multiple operations on the session. In all cases,
the template takes care of reliably closing the session.
For more information, refer to the javadocs for <classname>RemoteFileTemplate</classname>.
</para>
</section>
</chapter>

View File

@@ -252,6 +252,18 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
</para>
</section>
<section id="sftp-rft">
<title>RemoteFileTemplate</title>
<para>
Starting with <emphasis>Spring Integration version 3.0</emphasis> a new abstraction is provided over the
<classname>SftpSession</classname> object. The template provides methods to send, retrieve (as an
<classname>InputStream</classname>), remove, and rename files. In addition an <code>execute</code>
method is provided allowing the caller to execute multiple operations on the session. In all cases,
the template takes care of reliably closing the session.
For more information, refer to the javadocs for <classname>RemoteFileTemplate</classname>.
</para>
</section>
<section id="sftp-inbound">
<title>SFTP Inbound Channel Adapter</title>
<para>
@@ -437,6 +449,8 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
<listitem>mget (retrieve file(s))</listitem>
<listitem>rm (remove file(s))</listitem>
<listitem>mv (move/rename file)</listitem>
<listitem>put (send file)</listitem>
<listitem>mput (send multiple files)</listitem>
</itemizedlist>
</para>
<para><emphasis role="bold">ls</emphasis></para>
@@ -491,6 +505,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
<para>
<emphasis>mget</emphasis> retrieves multiple remote files based on a pattern and supports the following option:
<itemizedlist>
<listitem>-P - preserve the timestamps of the remote files</listitem>
<listitem>-x - Throw an exception if no files match the pattern (otherwise an empty
list is returned)</listitem>
</itemizedlist>
@@ -526,6 +541,40 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
so that the remote directory structure is retained locally.
</para>
</note>
<para><emphasis role="bold">put</emphasis></para>
<para>
<emphasis>put</emphasis> sends a file to the remote server; the payload of the message can be a
<classname>java.io.File</classname>, a <classname>byte[]</classname> or a <classname>String</classname>.
A <code>remote-filename-generator</code> (or expression) is used to name the remote file. Other available attributes include
<code>remote-directory</code>, <code>temporary-remote-directory</code> (and their <code>*-expression</code>)
equivalents, <code>use-temporary-file-name</code>, and <code>auto-create-directory</code>. Refer to the
schema documentation for more information.
</para>
<para>
The message payload resulting from a <emphasis>put</emphasis> operation is a
<classname>String</classname> representing the full path of the file on the server after transfer.
</para>
<para><emphasis role="bold">mput</emphasis></para>
<para>
<emphasis>mput</emphasis> sends multiple files to the server and supports the following option:
<itemizedlist>
<listitem>-R - Recursive - send all files (possibly filtered) in the directory and subdirectories</listitem>
</itemizedlist>
</para>
<para>
The message payload must be a <classname>java.io.File</classname> representing a local directory.
</para>
<para>
The same attributes as the <code>put</code> command are supported. In addition, files in the local
directory can be filtered with one of <code>mput-pattern</code>, <code>mput-regex</code> or
<code>mput-filter</code>. The filter works with recursion, as long as the subdirectories themselves
pass the filter. Subdirectories that do not pass the filter are not recursed.
</para>
<para>
The message payload resulting from an <emphasis>mget</emphasis> operation is a
<classname>List&lt;String&gt;</classname> object - a List of remote file paths resulting from
the transfer.
</para>
<para><emphasis role="bold">rm</emphasis></para>
<para>
The <emphasis>rm</emphasis> command has no options.

View File

@@ -299,21 +299,27 @@
<para>
<itemizedlist>
<listitem>
The gateways now support the <code>mv</code> command, enabling the renaming of remote
files.
The gateways now support the <emphasis role="bold">mv</emphasis> command, enabling
the renaming of remote files.
</listitem>
<listitem>
The gateways now support recursive <code>ls</code> and <code>mget</code> commands, enabling
The gateways now support recursive <emphasis role="bold">ls</emphasis> and
<emphasis role="bold">mget</emphasis> commands, enabling
the retrieval of a remote file tree.
</listitem>
<listitem>
The gateways now support <emphasis role="bold">put</emphasis> and
<emphasis role="bold">mput</emphasis> commands, enabling
sending file(s) to the remote server.
</listitem>
<listitem>
The <code>local-filename-generator-expression</code> attribute is now supported,
enabling the naming of local files during transfer. By default, the same
enabling the naming of local files during retrieval. By default, the same
name as the remote file is used.
</listitem>
<listitem>
The <code>local-directory-expression</code> attribute is now supported,
enabling the naming of local directories during transfer based on the remote directory.
enabling the naming of local directories during retrieval based on the remote directory.
</listitem>
</itemizedlist>
</para>
@@ -321,6 +327,20 @@
For more information, see <xref linkend="ftp-outbound-gateway"/> and <xref linkend="sftp-outbound-gateway"/>.
</para>
</section>
<section id="3.0-remote-file-template">
<title>Remote File Template</title>
<para>
A new higher-level abstraction (<classname>RemoteFileTemplate</classname>) is provided over the
<interfacename>Session</interfacename> implementations used by the FTP and SFTP modules. While it is
used internally by endpoints, this abstraction can also be used programmatically and, like all
Spring <code>*Template</code> implemenations, reliably closes the underlying session while allowing
low level access to the session when needed.
</para>
<para>
For more information, see
<xref linkend="ftp-rft"/> and <xref linkend="sftp-rft"/>.
</para>
</section>
<section id="3.0-jdbc-mysql-v5_6_4">
<title>JDBC Message Store Improvements</title>
<para>