|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.integration.adapter.file.AbstractDirectorySource<T>
public abstract class AbstractDirectorySource<T>
Base class for implementing a PollableSource that creates messages from files in a directory, either local or remote.
| Field Summary | |
|---|---|
private Backlog<FileInfo> |
directoryContentManager
|
static java.lang.String |
FILE_INFO_PROPERTY
|
private org.apache.commons.logging.Log |
logger
|
private MessageCreator<T,T> |
messageCreator
|
| Constructor Summary | |
|---|---|
AbstractDirectorySource(MessageCreator<T,T> messageCreator)
|
|
| Method Summary | |
|---|---|
protected Message<T> |
buildNextMessage()
Hook point for implementors to create the next message that should be received. |
protected void |
fileProcessed(java.lang.String... fileNames)
|
protected Backlog<FileInfo> |
getDirectoryContentManager()
|
MessageCreator<T,T> |
getMessageCreator()
|
void |
onFailure(Message<?> failedMessage,
java.lang.Throwable exception)
Callback method invoked after a message delivery failure. |
abstract void |
onSend(Message<?> message)
Callback method invoked after a message is sent successfully. |
protected abstract void |
populateSnapshot(java.util.Map<java.lang.String,FileInfo> snapshot)
Constructs the snapshot by iterating files. |
Message<T> |
receive()
Retrieve a message from this source or null if no message is available. |
protected void |
refreshSnapshotAndMarkProcessing(Backlog<FileInfo> directoryContentManager)
Naive implementation that ignores thread safety. |
protected abstract T |
retrieveNextPayload()
Returns the next file, based on the backlog data. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FILE_INFO_PROPERTY
private final org.apache.commons.logging.Log logger
private final Backlog<FileInfo> directoryContentManager
private final MessageCreator<T,T> messageCreator
| Constructor Detail |
|---|
public AbstractDirectorySource(MessageCreator<T,T> messageCreator)
| Method Detail |
|---|
protected Backlog<FileInfo> getDirectoryContentManager()
public MessageCreator<T,T> getMessageCreator()
public final Message<T> receive()
PollableSourcenull if no message is available.
receive in interface PollableSource<T>
protected void refreshSnapshotAndMarkProcessing(Backlog<FileInfo> directoryContentManager)
throws java.io.IOException
Backlog should override this method and call
directoryContentManager.fileProcessing(...) with the appropriate arguments.
directoryContentManager -
java.io.IOException
protected Message<T> buildNextMessage()
throws java.io.IOException
java.io.IOExceptionpublic abstract void onSend(Message<?> message)
MessageDeliveryAware
onSend in interface MessageDeliveryAware
public void onFailure(Message<?> failedMessage,
java.lang.Throwable exception)
MessageDeliveryAware
onFailure in interface MessageDeliveryAware
protected abstract void populateSnapshot(java.util.Map<java.lang.String,FileInfo> snapshot)
throws java.io.IOException
snapshot -
java.io.IOException
protected abstract T retrieveNextPayload()
throws java.io.IOException
java.io.IOExceptionprotected final void fileProcessed(java.lang.String... fileNames)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||