Minor comment updates.
This commit is contained in:
@@ -20,6 +20,7 @@ import java.io.File;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.MessageCreator;
|
||||
@@ -35,6 +36,7 @@ public abstract class AbstractFileMessageCreator<T> implements MessageCreator<Fi
|
||||
|
||||
protected Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
|
||||
public Message<T> createMessage(File file) {
|
||||
try {
|
||||
T payload = this.readMessagePayload(file);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2008 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2008 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2008 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2008 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.
|
||||
|
||||
@@ -42,32 +42,32 @@ import org.springframework.util.StringUtils;
|
||||
* @author Marius Bogoevici
|
||||
*/
|
||||
public class FileSource implements Source<Object>, InitializingBean, MessageDeliveryAware {
|
||||
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
private final File directory;
|
||||
|
||||
private volatile MessageCreator<File, ?> messageCreator;
|
||||
|
||||
|
||||
private volatile FileFilter fileFilter;
|
||||
|
||||
private volatile FilenameFilter filenameFilter;
|
||||
|
||||
private final DirectoryContentManager directoryContentManager = new DirectoryContentManager();
|
||||
|
||||
|
||||
|
||||
|
||||
public FileSource(File directory) {
|
||||
this(directory, new FileMessageCreator());
|
||||
}
|
||||
|
||||
public FileSource(File directory, MessageCreator<File, ?> messageCreator) {
|
||||
Assert.notNull(directory, "directory must not be null");
|
||||
this.directory = directory;
|
||||
Assert.notNull(messageCreator, "MessageCreator must not be null");
|
||||
this.directory = directory;
|
||||
this.messageCreator = messageCreator;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setMessageCreator(MessageCreator<File, ?> messageCreator) {
|
||||
this.messageCreator = messageCreator;
|
||||
}
|
||||
@@ -127,8 +127,8 @@ public class FileSource implements Source<Object>, InitializingBean, MessageDeli
|
||||
|
||||
public void onFailure(MessagingException exception) {
|
||||
if (this.logger.isWarnEnabled()) {
|
||||
logger.warn("FtpSource received failure notifcation", exception);
|
||||
logger.warn("FileSource received failure notifcation", exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.integration.message.Target;
|
||||
|
||||
/**
|
||||
* A message target for writing files. The actual file writing occurs in the
|
||||
* message mapper ({@link TextFileMessageCreator} or {@link ByteArrayFileMessageCreator}).
|
||||
* message creator ({@link TextFileMessageCreator} or {@link ByteArrayFileMessageCreator}).
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
@@ -33,12 +33,12 @@ public class FileTarget implements Target {
|
||||
|
||||
private MessageMapper<?, File> messageMapper;
|
||||
|
||||
|
||||
|
||||
public FileTarget(MessageMapper<?, File> messageMapper) {
|
||||
this.messageMapper = messageMapper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean send(Message message) {
|
||||
File file = this.messageMapper.mapMessage(message);
|
||||
return file.exists();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.adapter.file;
|
||||
|
||||
import java.io.File;
|
||||
@@ -27,7 +28,7 @@ import org.springframework.util.FileCopyUtils;
|
||||
/**
|
||||
* A default {@link MessageMapper} for {@link FileTarget}, converting payloads of the
|
||||
* {@link File}, {@code byte[]} and {@link String} types to files. The name of the newly
|
||||
* created is defined by the {@link FileNameGenerator} instance configured with it.
|
||||
* created file is defined by the {@link FileNameGenerator} instance configured with it.
|
||||
* By default, it uses a {@link DefaultFileNameGenerator}.
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
@@ -38,12 +39,11 @@ public class SimpleFileMessageMapper implements MessageMapper<Object, File> {
|
||||
|
||||
private final File parentDirectory;
|
||||
|
||||
|
||||
|
||||
public SimpleFileMessageMapper(String parentDirectoryPath) {
|
||||
this(new File(parentDirectoryPath));
|
||||
}
|
||||
|
||||
|
||||
public SimpleFileMessageMapper(File parentDirectory) {
|
||||
this.parentDirectory = parentDirectory;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.io.FileReader;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
/**
|
||||
* A {@link org.springframework.integration.message.MessageMapper}
|
||||
* implementation for messages with a String payload.
|
||||
* A {@link org.springframework.integration.message.MessageCreator}
|
||||
* implementation for creating messages with a String payload from a File.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Marius Bogoevici
|
||||
|
||||
Reference in New Issue
Block a user