INT-2866: Add (S)FTP local-directory-expression

* Add `local-directory-expression` to (S)FTP Outbound Gateways
* Add `FtpServerRule` to Apache Mina embedded FtpServer
* Add tests for (M)GET and `local-directory-expression`:
FTP tests uses `FtpServerRule`, SFTP tests need testing on real SFTP server

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

INT-2866: Documentation

INT-2866 Polishing

- Remove leading /
- Change \ to / in invalid test
- Clean up after sftp

Tested with real SSH.

INT-2866 Polishing - Add Mock SFTP Test

Run with -Dspring-profiles-active=realSSH to run with a real SSH server.

Assumes ftptest/ftptest account on localhost with the following directory tree in the user's root...

  $ tree sftpSource/
  sftpSource/
  ├── sftpSource1.txt
  ├── sftpSource2.txt
  └── subSftpSource
      └── subSftpSource1.txt

INT-2866: Polishing

INT-2866: change `remotePath` to `remoteDirectory`

Doc Polishing.
This commit is contained in:
Artem Bilan
2013-10-15 18:03:22 +03:00
committed by Gary Russell
parent 06979d7678
commit dd479a3ce7
15 changed files with 816 additions and 60 deletions

View File

@@ -433,7 +433,16 @@ protected void postProcessClientBeforeConnect(T client) throws IOException {
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>
example: <code>local-filename-generator-expression="#remoteFileName.toUpperCase() + headers.foo"</code>.
</para>
<para>
The <emphasis>get</emphasis> and <emphasis>mget</emphasis> commands support
the <emphasis>local-directory-expression</emphasis> attribute. It
defines a SpEL expression to generate the name of local directory(ies) during the transfer.
The root object of the evaluation context is the request Message but, in addition, the <code>remoteDirectory</code>
variable is also available, which is particularly useful for <emphasis>mget</emphasis>, for
example: <code>local-directory-expression="'/tmp/local/' + #remoteDirectory.toUpperCase() + headers.foo"</code>.
This attribute is mutually exclusive with <emphasis>local-directory</emphasis> attribute.
</para>
<para>
For all commands, the PATH that the command acts on is provided by the 'expression'

View File

@@ -471,6 +471,15 @@ xsi:schemaLocation="http://www.springframework.org/schema/integration/sftp
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>
The <emphasis>get</emphasis> and <emphasis>mget</emphasis> commands support
the <emphasis>local-directory-expression</emphasis> attribute. It
defines a SpEL expression to generate the name of local directory(ies) during the transfer.
The root object of the evaluation context is the request Message but, in addition, the <code>remoteDirectory</code>
variable is also available, which is particularly useful for <emphasis>mget</emphasis>, for
example: <code>local-directory-expression="'/tmp/local/' + #remoteDirectory.toUpperCase() + headers.foo"</code>.
This attribute is mutually exclusive with <emphasis>local-directory</emphasis> attribute.
</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

View File

@@ -244,8 +244,14 @@
<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"/>.
name as the remote file is used.
</para>
<para>
The <code>local-directory-expression</code> attribute is now supported,
enabling the naming of local directories during transfer based on the remote directory.
</para>
<para>
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">