INT-1614 refactoring FTP and SFTP so that base class receive() calls synchronizer on demand for both (was for SFTP but not FTP).

This commit is contained in:
Mark Fisher
2010-11-19 07:47:54 -05:00
parent 1dc64b2914
commit 45798c5345
5 changed files with 16 additions and 22 deletions

View File

@@ -132,7 +132,7 @@ public abstract class AbstractInboundRemoteFileSystemSychronizer<F> extends Abst
/**
* This is the callback where we need the implementation to do some specific work
*/
protected abstract void syncRemoteToLocalFileSystem() throws Exception;
protected abstract void syncRemoteToLocalFileSystem();
/**

View File

@@ -148,8 +148,18 @@ public abstract class AbstractInboundRemoteFileSystemSynchronizingMessageSource<
}
}
public Message<File> receive() {
return this.fileSource.receive();
/**
* Polls from the file source. If the result is not null, it will be returned.
* If the result is null, it attempts to sync up with the remote directory to populate the file source.
* Then, it polls the file source again and returns the result, whether or not it is null.
*/
public final Message<File> receive() {
Message<File> message = this.fileSource.receive();
if (message == null) {
this.synchronizer.syncRemoteToLocalFileSystem();
message = this.fileSource.receive();
}
return message;
}
@SuppressWarnings("unchecked")