Skip to content

Commit 5bfd697

Browse files
MichaelF25artembilan
authored andcommitted
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**
1 parent 27353ed commit 5bfd697

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

spring-integration-file/src/main/java/org/springframework/integration/file/remote/aop/RotatingServerAdvice.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
* A smart poller advice that rotates across multiple remote servers/directories.
3636
*
3737
* @author Gary Russell
38+
* @author Michael Forstner
3839
*
3940
* @since 5.0.7
4041
*
@@ -196,9 +197,9 @@ public void afterReceive(boolean messageReceived, MessageSource<?> source) {
196197

197198
protected void configureSource(MessageSource<?> source) {
198199
Assert.isTrue(source instanceof AbstractInboundFileSynchronizingMessageSource
199-
|| source instanceof AbstractRemoteFileStreamingMessageSource,
200-
"source must be an AbstractInboundFileSynchronizingMessageSource or a "
201-
+ "AbstractRemoteFileStreamingMessageSource");
200+
|| source instanceof AbstractRemoteFileStreamingMessageSource,
201+
"source must be an AbstractInboundFileSynchronizingMessageSource or a "
202+
+ "AbstractRemoteFileStreamingMessageSource");
202203
if (!this.iterator.hasNext()) {
203204
this.iterator = this.keyDirectories.iterator();
204205
}
@@ -208,7 +209,7 @@ protected void configureSource(MessageSource<?> source) {
208209
}
209210
else {
210211
((AbstractInboundFileSynchronizingMessageSource<?>) source).getSynchronizer()
211-
.setRemoteDirectory(this.current.getDirectory());
212+
.setRemoteDirectory(this.current.getDirectory());
212213
}
213214
}
214215

@@ -219,18 +220,18 @@ protected void configureSource(MessageSource<?> source) {
219220
*/
220221
public static class KeyDirectory {
221222

222-
private final String key;
223+
private final Object key;
223224

224225
private final String directory;
225226

226-
public KeyDirectory(String key, String directory) {
227+
public KeyDirectory(Object key, String directory) {
227228
Assert.notNull(key, "key cannot be null");
228229
Assert.notNull(directory, "directory cannot be null");
229230
this.key = key;
230231
this.directory = directory;
231232
}
232233

233-
public String getKey() {
234+
public Object getKey() {
234235
return this.key;
235236
}
236237

@@ -240,7 +241,7 @@ public String getDirectory() {
240241

241242
@Override
242243
public String toString() {
243-
return "KeyDirectory [key=" + this.key + ", directory=" + this.directory + "]";
244+
return "KeyDirectory [key=" + this.key.toString() + ", directory=" + this.directory + "]";
244245
}
245246

246247
}

src/reference/asciidoc/ftp.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ The following example shows how to declare a delegating session factory:
247247
IMPORTANT: When you use session caching (see <<ftp-session-caching>>), each of the delegates should be cached.
248248
You cannot cache the `DelegatingSessionFactory` itself.
249249

250-
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>>.
250+
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>>.
251251

252252
[[ftp-inbound]]
253253
=== FTP Inbound Channel Adapter

src/reference/asciidoc/sftp.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ We added convenience methods so that you can more easily do so from a message fl
210210
IMPORTANT: When using session caching (see <<sftp-session-caching>>), each of the delegates should be cached.
211211
You cannot cache the `DelegatingSessionFactory` itself.
212212

213-
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>>.
213+
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>>.
214214

215215
[[sftp-session-caching]]
216216
=== SFTP Session Caching

0 commit comments

Comments
 (0)