INT-3919: FTP: Allow null for Remote Directory
JIRA: https://jira.spring.io/browse/INT-3919 Since `FtpClient` supports `null` for the `LS` command, treating it as a current `working directory`, there is no reason to forbid `null` from the FTP adapters end-user perspective. * Allow `null` for the `FtpSession` `list()` and `listNames()` methods * Allow `null` in the `remote-directory` for the `<int-ftp:inbound-channel-adapter>` * Allow `null` in the `expression` for the `FtpOutboundGateway` Polishing - send error if error on async output Cover `onFailure()` from `onSuccess()` with the `errorChannel` Address PR Comments * Get rid of `null` population for the `remoteDirectoryExpression` in the `AbstractPollingInboundChannelAdapterParser` * Populate `new LiteralExpression(null)` from the `FtpInboundFileSynchronizer` ctor * Introduce `buildRemotePath(parent, child)` function in the `AbstractRemoteFileOutboundGateway` with the `null` logic for `parent` * Rework `mGetWithoutRecursion()` to use `LS` command and allow `null` for the dir. * Fix tests according the new `mGetWithoutRecursion()` logic Polishing
This commit is contained in:
committed by
Gary Russell
parent
2fad35d9b8
commit
7595e4f142
@@ -191,6 +191,9 @@ Starting with _version 4.2_, you can specify `remote-directory-expression` inste
|
||||
you to dynamically determine the directory on each poll.
|
||||
e.g `remote-directory-expression="@myBean.determineRemoteDir()"`.
|
||||
|
||||
Starting with _version 4.3_, the `remote-directory`/`remote-directory-expression` attributes can be omitted assuming `null`.
|
||||
In this case, according to the FTP protocol, the Client working directory is used as a default remote directory.
|
||||
|
||||
Sometimes file filtering based on the simple pattern specified via `filename-pattern` attribute might not be sufficient.
|
||||
If this is the case, you can use the `filename-regex` attribute to specify a Regular Expression (e.g.
|
||||
`filename-regex=".*\.test$"`).
|
||||
@@ -255,7 +258,10 @@ Here is an example that uses a custom Filter implementation.
|
||||
|
||||
_Poller configuration notes for the inbound FTP adapter_
|
||||
|
||||
The job of the inbound FTP adapter consists of two tasks: _1) Communicate with a remote server in order to transfer files from a remote directory to a local directory.__2) For each transferred file, generate a Message with that file as a payload and send it to the channel identified by the 'channel' attribute._ That is why they are called 'channel-adapters' rather than just 'adapters'.
|
||||
The job of the inbound FTP adapter consists of two tasks:
|
||||
_1) Communicate with a remote server in order to transfer files from a remote directory to a local directory._
|
||||
_2) For each transferred file, generate a Message with that file as a payload and send it to the channel identified by the 'channel' attribute._
|
||||
That is why they are called 'channel-adapters' rather than just 'adapters'.
|
||||
The main job of such an adapter is to generate a Message to be sent to a Message Channel.
|
||||
Essentially, the second task mentioned above takes precedence in such a way that *IF* your local directory already has one or more files it will first generate Messages from those, and *ONLY* when all local files have been processed, will it initiate the remote communication to retrieve more files.
|
||||
|
||||
@@ -407,6 +413,13 @@ If the `-dirs` option is included, each recursive directory is also returned as
|
||||
In this case, it is recommended that the `-1` is not used because you would not be able to determine files Vs.
|
||||
directories, which is achievable using the `FileInfo` objects.
|
||||
|
||||
Starting with _version 4.3_, the `FtpSession` supports `null` for the `list()` and `listNames()` methods,
|
||||
therefore the `expression` attribute can be omitted.
|
||||
From Java perspective there are two new constructor without `expression` argument for convenience.
|
||||
The `null` for `LS` command is treated as an Client working directory according to the FTP protocol.
|
||||
The working directory can be set via the `FTPClient.changeWorkingDirectory()` function when you extend the
|
||||
`DefaultFtpSessionFactory` and implement `postProcessClientBeforeConnect()` callback.
|
||||
|
||||
*get*
|
||||
|
||||
_get_ retrieves a remote file and supports the following option:
|
||||
|
||||
@@ -114,6 +114,14 @@ See <<http-inbound>> for more information.
|
||||
A new factory bean is provided to simplify the configuration of Jsch proxies for SFTP.
|
||||
See <<sftp-proxy-factory-bean>> for more information.
|
||||
|
||||
==== FTP Changes
|
||||
|
||||
The `FtpSession` now supports `null` for the `list()` and `listNames()` method, since it is possible by the
|
||||
underlying FTP Client.
|
||||
With that the `FtpOutboundGateway` can now be configured without `remoteDirectory` expression.
|
||||
And the `<int-ftp:inbound-channel-adapter>` can be configured without `remote-directory`/`remote-directory-expression`.
|
||||
See <<ftp>> for more information.
|
||||
|
||||
==== Router Changes
|
||||
|
||||
The `ErrorMessageExceptionTypeRouter` supports now the `Exception` superclass mappings to avoid duplication
|
||||
|
||||
Reference in New Issue
Block a user