INT-4531: Use Object type KeyDirectory.key

JIRA: https://jira.spring.io/browse/INT-4531

The `DelegatingSessionFactory` uses plain `Object` as key type
whereas the default `RotatingServerAdvice` does not.

* Change the type from `String` to `Object` in the `RotatingServerAdvice.KeyDirectory`
* Fix typos in the (s)ftp.adoc

**Cherry-pick to 5.0.x**
This commit is contained in:
Michael Forstner
2018-09-14 16:49:47 +02:00
committed by Artem Bilan
parent 27353ed393
commit 5bfd6971db
3 changed files with 11 additions and 10 deletions

View File

@@ -35,6 +35,7 @@ import org.springframework.util.Assert;
* A smart poller advice that rotates across multiple remote servers/directories.
*
* @author Gary Russell
* @author Michael Forstner
*
* @since 5.0.7
*
@@ -196,9 +197,9 @@ public class RotatingServerAdvice extends AbstractMessageSourceAdvice {
protected void configureSource(MessageSource<?> source) {
Assert.isTrue(source instanceof AbstractInboundFileSynchronizingMessageSource
|| source instanceof AbstractRemoteFileStreamingMessageSource,
"source must be an AbstractInboundFileSynchronizingMessageSource or a "
+ "AbstractRemoteFileStreamingMessageSource");
|| source instanceof AbstractRemoteFileStreamingMessageSource,
"source must be an AbstractInboundFileSynchronizingMessageSource or a "
+ "AbstractRemoteFileStreamingMessageSource");
if (!this.iterator.hasNext()) {
this.iterator = this.keyDirectories.iterator();
}
@@ -208,7 +209,7 @@ public class RotatingServerAdvice extends AbstractMessageSourceAdvice {
}
else {
((AbstractInboundFileSynchronizingMessageSource<?>) source).getSynchronizer()
.setRemoteDirectory(this.current.getDirectory());
.setRemoteDirectory(this.current.getDirectory());
}
}
@@ -219,18 +220,18 @@ public class RotatingServerAdvice extends AbstractMessageSourceAdvice {
*/
public static class KeyDirectory {
private final String key;
private final Object key;
private final String directory;
public KeyDirectory(String key, String directory) {
public KeyDirectory(Object key, String directory) {
Assert.notNull(key, "key cannot be null");
Assert.notNull(directory, "directory cannot be null");
this.key = key;
this.directory = directory;
}
public String getKey() {
public Object getKey() {
return this.key;
}
@@ -240,7 +241,7 @@ public class RotatingServerAdvice extends AbstractMessageSourceAdvice {
@Override
public String toString() {
return "KeyDirectory [key=" + this.key + ", directory=" + this.directory + "]";
return "KeyDirectory [key=" + this.key.toString() + ", directory=" + this.directory + "]";
}
}

View File

@@ -247,7 +247,7 @@ The following example shows how to declare a delegating session factory:
IMPORTANT: When you use session caching (see <<ftp-session-caching>>), each of the delegates should be cached.
You cannot cache the `DelegatingSessionFactory` itself.
Starting with _version 5.0.7_, the `DelegatingSessionFactory` can be used in conjuction with a `RotatingServerAdvice` to poll multiple servers; see <<ftp-rotating-server-advice>>.
Starting with _version 5.0.7_, the `DelegatingSessionFactory` can be used in conjunction with a `RotatingServerAdvice` to poll multiple servers; see <<ftp-rotating-server-advice>>.
[[ftp-inbound]]
=== FTP Inbound Channel Adapter

View File

@@ -210,7 +210,7 @@ We added convenience methods so that you can more easily do so from a message fl
IMPORTANT: When using session caching (see <<sftp-session-caching>>), each of the delegates should be cached.
You cannot cache the `DelegatingSessionFactory` itself.
Starting with _version 5.0.7_, the `DelegatingSessionFactory` can be used in conjuction with a `RotatingServerAdvice` to poll multiple servers; see <<sftp-rotating-server-advice>>.
Starting with _version 5.0.7_, the `DelegatingSessionFactory` can be used in conjunction with a `RotatingServerAdvice` to poll multiple servers; see <<sftp-rotating-server-advice>>.
[[sftp-session-caching]]
=== SFTP Session Caching