INT-1614 naming changes for synchronizers and the interface's strategy method itself

This commit is contained in:
Mark Fisher
2010-11-19 12:01:39 -05:00
parent abffa7378a
commit d9ebf2657e
10 changed files with 85 additions and 42 deletions

View File

@@ -23,7 +23,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.integration.file.filters.FileListFilter;
/**
@@ -36,7 +35,7 @@ import org.springframework.integration.file.filters.FileListFilter;
*
* @author Josh Long
*/
public abstract class AbstractInboundRemoteFileSystemSychronizer<F> implements InitializingBean {
public abstract class AbstractInboundFileSynchronizer<F> implements InboundFileSynchronizer, InitializingBean {
protected final Log logger = LogFactory.getLog(this.getClass());
@@ -94,11 +93,6 @@ public abstract class AbstractInboundRemoteFileSystemSychronizer<F> implements I
return (this.filter != null) ? this.filter.filterFiles(files) : Arrays.asList(files);
}
/**
* This is the callback where the subclasses must synchronize.
*/
protected abstract void syncRemoteToLocalFileSystem(Resource localDirectory);
/**
* Strategy interface to expose a hook for dispatching, moving, or deleting

View File

@@ -47,14 +47,13 @@ import org.springframework.util.Assert;
* specific).
* <p/>
* This class is to be used as a pair with an implementation of
* {@link AbstractInboundRemoteFileSystemSychronizer}. The synchronizer must
* {@link AbstractInboundFileSynchronizer}. The synchronizer must
* handle the work of actually connecting to the remote file system and
* delivering new {@link File}s.
*
* @author Josh Long
*/
public abstract class AbstractInboundRemoteFileSystemSynchronizingMessageSource<F, S extends AbstractInboundRemoteFileSystemSychronizer<F>>
extends MessageProducerSupport implements MessageSource<File> {
public abstract class AbstractInboundFileSynchronizingMessageSource<F> extends MessageProducerSupport implements MessageSource<File> {
/**
* Extension used when downloading files. We change it right after we know it's downloaded.
@@ -71,7 +70,7 @@ public abstract class AbstractInboundRemoteFileSystemSynchronizingMessageSource<
* An implementation that will handle the chores of actually connecting to and synching up
* the remote file system with the local one, in an inbound direction.
*/
protected volatile S synchronizer;
protected volatile AbstractInboundFileSynchronizer<F> synchronizer;
/**
* Directory to which things should be synched locally.
@@ -93,7 +92,7 @@ public abstract class AbstractInboundRemoteFileSystemSynchronizingMessageSource<
this.autoCreateDirectories = autoCreateDirectories;
}
public void setSynchronizer(S synchronizer) {
public void setSynchronizer(AbstractInboundFileSynchronizer<F> synchronizer) {
this.synchronizer = synchronizer;
}
@@ -151,7 +150,7 @@ public abstract class AbstractInboundRemoteFileSystemSynchronizingMessageSource<
Assert.state(this.synchronizer != null, "synchronizer must not be null");
Message<File> message = this.fileSource.receive();
if (message == null) {
this.synchronizer.syncRemoteToLocalFileSystem(this.localDirectory);
this.synchronizer.synchronizeToLocalDirectory(this.localDirectory);
message = this.fileSource.receive();
}
return message;

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.file.synchronizer;
import org.springframework.core.io.Resource;
/**
* Strategy for synchronizing from a remote File system to a local directory.
*
* @author Mark Fisher
* @since 2.0
*/
public interface InboundFileSynchronizer {
void synchronizeToLocalDirectory(Resource localDirectory);
}