org.springframework.integration.adapter.file
Class AbstractFileMessageCreator<T>
java.lang.Object
org.springframework.integration.adapter.file.AbstractFileMessageCreator<T>
- All Implemented Interfaces:
- MessageCreator<java.io.File,T>
- Direct Known Subclasses:
- ByteArrayFileMessageCreator, FileMessageCreator, TextFileMessageCreator
public abstract class AbstractFileMessageCreator<T>
- extends java.lang.Object
- implements MessageCreator<java.io.File,T>
Base class providing common behavior for file-based message creators. The
subclasses will redefine the readMessagePayload()
method. This class
allows to choose between keeping the file after message creation and removing
it, by setting the appropriate value in the constructor. The desired
behaviour depends on the nature of the created message (i.e. messages with a
String
payload can safely remove the file after creation, but
messages with a File
payload cannot do that) or of the collaborator
that uses the class instance (e.g. if the file is a locally created copy, it
can be always discarded).
- Author:
- Mark Fisher, Marius Bogoevici
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected org.apache.commons.logging.Log logger
deleteFileAfterCreation
private final boolean deleteFileAfterCreation
AbstractFileMessageCreator
public AbstractFileMessageCreator(boolean deleteFileAfterCreation)
- Parameters:
deleteFileAfterCreation
- Indicates whether the file should be
deleted after the message has been created.
createMessage
public final Message<T> createMessage(java.io.File file)
- Specified by:
createMessage
in interface MessageCreator<java.io.File,T>
readMessagePayload
protected abstract T readMessagePayload(java.io.File file)
throws java.lang.Exception
- Throws:
java.lang.Exception