Fixed comment typo and removed unused imports.
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.MessageCreator;
|
||||
import org.springframework.integration.message.MessageDeliveryAware;
|
||||
@@ -33,30 +34,32 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Base class for implementing a Source that creates messages from files in a directory,
|
||||
* eiter local or remote.
|
||||
* either local or remote.
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
*/
|
||||
public abstract class AbstractDirectorySource implements Source<Object>, MessageDeliveryAware {
|
||||
|
||||
public String FILE_INFO_PROPERTY = "file.info";
|
||||
|
||||
public final static String FILE_INFO_PROPERTY = "file.info";
|
||||
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
private final DirectoryContentManager directoryContentManager = new DirectoryContentManager();
|
||||
|
||||
private final MessageCreator<File, ?> messageCreator;
|
||||
|
||||
|
||||
|
||||
public AbstractDirectorySource(MessageCreator<File, ?> messageCreator) {
|
||||
Assert.notNull(messageCreator, "The MessageCreator must not be null");
|
||||
this.messageCreator = messageCreator;
|
||||
}
|
||||
|
||||
|
||||
protected DirectoryContentManager getDirectoryContentManager() {
|
||||
return this.directoryContentManager;
|
||||
}
|
||||
|
||||
|
||||
public MessageCreator<File, ?> getMessageCreator() {
|
||||
return messageCreator;
|
||||
}
|
||||
@@ -100,8 +103,8 @@ public abstract class AbstractDirectorySource implements Source<Object>, Message
|
||||
logger.warn("Failure notification received by " + this.getClass().getSimpleName(), exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Connects to the directory, if necessary.
|
||||
*/
|
||||
@@ -125,5 +128,5 @@ public abstract class AbstractDirectorySource implements Source<Object>, Message
|
||||
* Disconnects from the directory
|
||||
*/
|
||||
protected abstract void disconnect();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ public abstract class AbstractFileMessageCreator<T> implements MessageCreator<Fi
|
||||
protected Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
private final boolean deleteFileAfterCreation;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param deleteFileAfterCreation Indicates whether the file should be
|
||||
* deleted after the message has been created.
|
||||
@@ -54,7 +54,7 @@ public abstract class AbstractFileMessageCreator<T> implements MessageCreator<Fi
|
||||
public AbstractFileMessageCreator(boolean deleteFileAfterCreation) {
|
||||
this.deleteFileAfterCreation = deleteFileAfterCreation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public final Message<T> createMessage(File file) {
|
||||
try {
|
||||
@@ -63,7 +63,7 @@ public abstract class AbstractFileMessageCreator<T> implements MessageCreator<Fi
|
||||
return null;
|
||||
}
|
||||
Message<T> message = new GenericMessage<T>(payload);
|
||||
if (deleteFileAfterCreation) {
|
||||
if (this.deleteFileAfterCreation) {
|
||||
file.delete();
|
||||
}
|
||||
return message;
|
||||
|
||||
@@ -22,8 +22,6 @@ import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.integration.message.MessageCreator;
|
||||
import org.springframework.integration.message.MessageDeliveryAware;
|
||||
@@ -47,6 +45,7 @@ public class FileSource extends AbstractDirectorySource implements Source<Object
|
||||
|
||||
private volatile FilenameFilter filenameFilter;
|
||||
|
||||
|
||||
public FileSource(File directory) {
|
||||
this(directory, new FileMessageCreator());
|
||||
}
|
||||
@@ -71,8 +70,8 @@ public class FileSource extends AbstractDirectorySource implements Source<Object
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
if (null == messageCreator) {
|
||||
messageCreator = new FileMessageCreator();
|
||||
if (null == this.messageCreator) {
|
||||
this.messageCreator = new FileMessageCreator();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user