INT-1614 renamed EntryAcknowledgmentStrategy to AcknowledgmentStrategy for now, but will most likely remove the strategy altogether since there's a conflict if one is set and the delete flag is true at the same time

This commit is contained in:
Mark Fisher
2010-11-21 13:32:25 -05:00
parent bad0612dc7
commit 9c0e122958
4 changed files with 13 additions and 13 deletions

View File

@@ -53,17 +53,17 @@ public abstract class AbstractInboundFileSynchronizer<F> implements InboundFileS
private volatile FileListFilter<F> filter;
/**
* The {@link EntryAcknowledgmentStrategy} implementation.
* The {@link AcknowledgmentStrategy} implementation.
*/
private EntryAcknowledgmentStrategy<F> entryAcknowledgmentStrategy;
private AcknowledgmentStrategy<F> acknowledgmentStrategy;
public void setFilter(FileListFilter<F> filter) {
this.filter = filter;
}
public void setEntryAcknowledgmentStrategy(EntryAcknowledgmentStrategy<F> entryAcknowledgmentStrategy) {
this.entryAcknowledgmentStrategy = entryAcknowledgmentStrategy;
public void setAcknowledgmentStrategy(AcknowledgmentStrategy<F> acknowledgmentStrategy) {
this.acknowledgmentStrategy = acknowledgmentStrategy;
}
public void setShouldDeleteSourceFile(boolean shouldDeleteSourceFile) {
@@ -85,8 +85,8 @@ public abstract class AbstractInboundFileSynchronizer<F> implements InboundFileS
* escape hatch exception, let the adapter deal with it.
*/
protected final void acknowledge(Session session, F file) throws Exception {
if (this.entryAcknowledgmentStrategy != null) {
this.entryAcknowledgmentStrategy.acknowledge(session, file);
if (this.acknowledgmentStrategy != null) {
this.acknowledgmentStrategy.acknowledge(session, file);
}
}
@@ -104,7 +104,7 @@ public abstract class AbstractInboundFileSynchronizer<F> implements InboundFileS
*
* @param <F> the file entry type (file, sftp, ftp, ...)
*/
public static interface EntryAcknowledgmentStrategy<F> {
public static interface AcknowledgmentStrategy<F> {
/**
* Semantics are simple. You get a pointer to the file just processed

View File

@@ -65,7 +65,7 @@ public class FtpInboundFileSynchronizer extends AbstractInboundFileSynchronizer<
public void afterPropertiesSet() {
Assert.notNull(this.sessionFactory, "sessionFactory must not be null");
if (this.shouldDeleteSourceFile) {
this.setEntryAcknowledgmentStrategy(new DeletionEntryAcknowledgmentStrategy());
this.setAcknowledgmentStrategy(new DeletionAcknowledgmentStrategy());
}
}
@@ -137,7 +137,7 @@ public class FtpInboundFileSynchronizer extends AbstractInboundFileSynchronizer<
/**
* An acknowledgment strategy that deletes the file.
*/
private static class DeletionEntryAcknowledgmentStrategy implements EntryAcknowledgmentStrategy<FTPFile> {
private static class DeletionAcknowledgmentStrategy implements AcknowledgmentStrategy<FTPFile> {
private final Log logger = LogFactory.getLog(this.getClass());

View File

@@ -64,7 +64,7 @@ public class SftpInboundFileSynchronizer extends AbstractInboundFileSynchronizer
public void afterPropertiesSet() throws Exception {
Assert.notNull(this.remotePath, "'remotePath' must not be null");
if (this.shouldDeleteSourceFile) {
this.setEntryAcknowledgmentStrategy(new DeletionEntryAcknowledgmentStrategy());
this.setAcknowledgmentStrategy(new DeletionAcknowledgmentStrategy());
}
}
@@ -141,7 +141,7 @@ public class SftpInboundFileSynchronizer extends AbstractInboundFileSynchronizer
}
private class DeletionEntryAcknowledgmentStrategy implements AbstractInboundFileSynchronizer.EntryAcknowledgmentStrategy<ChannelSftp.LsEntry> {
private class DeletionAcknowledgmentStrategy implements AcknowledgmentStrategy<ChannelSftp.LsEntry> {
public void acknowledge(Session session, ChannelSftp.LsEntry msg) throws Exception {
String remoteFqPath = remotePath + "/" + msg.getFilename();

View File

@@ -29,7 +29,7 @@ import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.integration.file.remote.session.Session;
import org.springframework.integration.file.remote.session.SessionFactory;
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.EntryAcknowledgmentStrategy;
import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.AcknowledgmentStrategy;
import org.springframework.integration.sftp.inbound.SftpInboundFileSynchronizer;
import org.springframework.util.ReflectionUtils;
@@ -88,7 +88,7 @@ public class SftpInboundRemoteFileSystemSynchronizerTests {
@Test
public void testCopyAndRenameWhenLocalFileDoesntExist() throws Exception {
SftpInboundFileSynchronizer synchronizer = new SftpInboundFileSynchronizer(mock(SessionFactory.class));
synchronizer.setEntryAcknowledgmentStrategy(mock(EntryAcknowledgmentStrategy.class));
synchronizer.setAcknowledgmentStrategy(mock(AcknowledgmentStrategy.class));
Method method =
ReflectionUtils.findMethod(synchronizer.getClass(), "copyFromRemoteToLocalDirectory", Session.class, LsEntry.class, Resource.class);
method.setAccessible(true);