INT-3129: FTP local-filename-generator-expression

* Add `local-filename-generator-expression` attribute to FTP and SFTP Outbound Gateway
* Refactoring for `(S)FtpOutboundGatewayParser`
* Add `local-filename-generator-expression` tests
* Add 'What's New' and attribute description

JIRA: https://jira.springsource.org/browse/INT-3129

Polishing

Doc Polishing

Assert attribute is only set for get/mget

Move tests to the get gateways
This commit is contained in:
Artem Bilan
2013-09-18 18:07:01 +03:00
committed by Gary Russell
parent bbf93e1385
commit 417c848c0b
13 changed files with 198 additions and 49 deletions

View File

@@ -341,7 +341,7 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
<listitem>mv (move/rename file)</listitem>
</itemizedlist>
</para>
<para><emphasis>ls</emphasis></para>
<para><emphasis role="bold">ls</emphasis></para>
<para>
ls lists remote file(s) and supports the following options:
<itemizedlist>
@@ -366,7 +366,7 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
The remote directory that the <emphasis>ls</emphasis> command acted on is provided
in the <classname>file_remoteDirectory</classname> header.
</para>
<para><emphasis>get</emphasis></para>
<para><emphasis role="bold">get</emphasis></para>
<para>
<emphasis>get</emphasis> retrieves a remote file and supports the following option:
<itemizedlist>
@@ -381,7 +381,7 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
The remote directory is provided in the <classname>file_remoteDirectory</classname> header, and the filename is
provided in the <classname>file_remoteFile</classname> header.
</para>
<para><emphasis>mget</emphasis></para>
<para><emphasis role="bold">mget</emphasis></para>
<para>
<emphasis>mget</emphasis> retrieves multiple remote files based on a pattern and supports the following option:
<itemizedlist>
@@ -399,7 +399,7 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
for the filenames is
provided in the <classname>file_remoteFile</classname> header.
</para>
<para><emphasis>rm</emphasis></para>
<para><emphasis role="bold">rm</emphasis></para>
<para>
The <emphasis>rm</emphasis> command has no options.
</para>
@@ -409,7 +409,7 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
The remote directory is provided in the <classname>file_remoteDirectory</classname> header, and the filename is
provided in the <classname>file_remoteFile</classname> header.
</para>
<para><emphasis>mv</emphasis></para>
<para><emphasis role="bold">mv</emphasis></para>
<para>
The <emphasis>mv</emphasis> command has no options.
</para>
@@ -425,9 +425,20 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
the <code>file_renameTo</code> header.
</para>
<para>
For all commands, the PATH that the command acts on is provided by the 'expression'
property of the gateway. For the mget command, the expression might evaluate to '*', meaning
retrieve all files, or 'somedirectory/*' etc.
<emphasis role="bold">Additional Information</emphasis>
</para>
<para>
The <emphasis>get</emphasis> and <emphasis>mget</emphasis> commands support
the <emphasis>local-filename-generator-expression</emphasis> attribute. It
defines a SpEL expression to generate the name of local file(s) during the transfer.
The root object of the evaluation context is the request Message but, in addition, the <code>remoteFileName</code>
variable is also available, which is particularly useful for <emphasis>mget</emphasis>, for
example: <code>local-filename-generator-expression="#remoteFileName.toUpperCase() + headers.foo"</code>
</para>
<para>
For all commands, the PATH that the command acts on is provided by the 'expression'
property of the gateway. For the mget command, the expression might evaluate to '*', meaning
retrieve all files, or 'somedirectory/*' etc.
</para>
</para>
<para>

View File

@@ -377,7 +377,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
<listitem>mv (move/rename file)</listitem>
</itemizedlist>
</para>
<para><emphasis>ls</emphasis></para>
<para><emphasis role="bold">ls</emphasis></para>
<para>
ls lists remote file(s) and supports the following options:
<itemizedlist>
@@ -402,7 +402,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
The remote directory that the <emphasis>ls</emphasis> command acted on is provided
in the <classname>file_remoteDirectory</classname> header.
</para>
<para><emphasis>get</emphasis></para>
<para><emphasis role="bold">get</emphasis></para>
<para>
<emphasis>get</emphasis> retrieves a remote file and supports the following option:
<itemizedlist>
@@ -417,7 +417,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
The remote directory is provided in the <classname>file_remoteDirectory</classname> header, and the filename is
provided in the <classname>file_remoteFile</classname> header.
</para>
<para><emphasis>mget</emphasis></para>
<para><emphasis role="bold">mget</emphasis></para>
<para>
<emphasis>mget</emphasis> retrieves multiple remote files based on a pattern and supports the following option:
<itemizedlist>
@@ -435,7 +435,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
for the filenames is
provided in the <classname>file_remoteFile</classname> header.
</para>
<para><emphasis>rm</emphasis></para>
<para><emphasis role="bold">rm</emphasis></para>
<para>
The <emphasis>rm</emphasis> command has no options.
</para>
@@ -445,7 +445,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
The remote directory is provided in the <classname>file_remoteDirectory</classname> header, and the filename is
provided in the <classname>file_remoteFile</classname> header.
</para>
<para><emphasis>mv</emphasis></para>
<para><emphasis role="bold">mv</emphasis></para>
<para>
The <emphasis>mv</emphasis> command has no options.
</para>
@@ -461,9 +461,20 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
the <code>file_renameTo</code> header.
</para>
<para>
For all commands, the PATH that the command acts on is provided by the 'expression'
property of the gateway. For the mget command, the expression might evaluate to '*', meaning
retrieve all files, or 'somedirectory/*' etc.
<emphasis role="bold">Additional Information</emphasis>
</para>
<para>
The <emphasis>get</emphasis> and <emphasis>mget</emphasis> commands support
the <emphasis>local-filename-generator-expression</emphasis> attribute. It
defines a SpEL expression to generate the name of local file(s) during the transfer.
The root object of the evaluation context is the request Message but, in addition, the <code>remoteFileName</code>
variable is also available, which is particularly useful for <emphasis>mget</emphasis>, for
example: <code>local-filename-generator-expression="#remoteFileName.toUpperCase() + headers.foo"</code>
</para>
<para>
For all commands, the PATH that the command acts on is provided by the 'expression'
property of the gateway. For the mget command, the expression might evaluate to '*', meaning
retrieve all files, or 'somedirectory/*' etc.
</para>
</para>
<para>

View File

@@ -175,6 +175,10 @@
to be maintained across JVM executions, a custom filter that retains state, perhaps on
the file system, can now be configured.
</para>
<para>
For more information, see
<xref linkend="ftp-inbound"/> and <xref linkend="sftp-inbound"/>.
</para>
</section>
<section id="3.0-xFTP-gw">
<title>FTP, SFTP and FTPS Gateways</title>
@@ -182,6 +186,12 @@
The gateways now support the <code>mv</code> command, enabling the renaming of remote
files.
</para>
<para>
The <code>local-filename-generator-expression</code> attribute is now supported,
enabling the naming of local files during transfer. By default, the same
name as the remote file is used. For more information, see
<xref linkend="ftp-outbound-gateway"/> and <xref linkend="sftp-outbound-gateway"/>.
</para>
</section>
<section id="3.0-jdbc-mysql-v5_6_4">
<title>JDBC Message Store Improvements</title>