|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.impl.ServiceSupport org.apache.camel.impl.DefaultConsumer org.apache.camel.impl.ScheduledPollConsumer org.apache.camel.component.file.GenericFileConsumer<T>
public abstract class GenericFileConsumer<T>
Base class for remote file consumers.
Field Summary | |
---|---|
protected GenericFileEndpoint<T> |
endpoint
|
protected String |
fileExpressionResult
|
protected org.apache.commons.logging.Log |
log
|
protected boolean |
loggedIn
|
protected int |
maxMessagesPerPoll
|
protected GenericFileOperations<T> |
operations
|
Constructor Summary | |
---|---|
GenericFileConsumer(GenericFileEndpoint<T> endpoint,
Processor processor,
GenericFileOperations<T> operations)
|
Method Summary | |
---|---|
protected boolean |
isInProgress(GenericFile<T> file)
Is the given file already in progress. |
protected boolean |
isMatched(GenericFile<T> file,
boolean isDirectory)
Strategy to perform file matching based on endpoint configuration. |
protected boolean |
isValidFile(GenericFile<T> file,
boolean isDirectory)
Strategy for validating if the given remote file should be included or not |
protected void |
poll()
Poll for files |
protected abstract void |
pollDirectory(String fileName,
List<GenericFile<T>> fileList)
Polls the given directory for files to process |
protected boolean |
prePollCheck()
Override if required. |
void |
processBatch(Queue exchanges)
Processes the list of Exchange in a batch. |
protected void |
processExchange(Exchange exchange)
Processes the exchange |
void |
setMaxMessagesPerPoll(int maxMessagesPerPoll)
Sets a maximum number of messages as a limit to poll at each polling. |
Methods inherited from class org.apache.camel.impl.ScheduledPollConsumer |
---|
doStart, doStop, getDelay, getInitialDelay, getPollStrategy, getTimeUnit, isUseFixedDelay, run, setDelay, setInitialDelay, setPollStrategy, setTimeUnit, setUseFixedDelay |
Methods inherited from class org.apache.camel.impl.DefaultConsumer |
---|
getEndpoint, getExceptionHandler, getProcessor, handleException, setExceptionHandler, toString |
Methods inherited from class org.apache.camel.impl.ServiceSupport |
---|
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.camel.Service |
---|
start, stop |
Field Detail |
---|
protected final transient org.apache.commons.logging.Log log
protected GenericFileEndpoint<T> endpoint
protected GenericFileOperations<T> operations
protected boolean loggedIn
protected String fileExpressionResult
protected int maxMessagesPerPoll
Constructor Detail |
---|
public GenericFileConsumer(GenericFileEndpoint<T> endpoint, Processor processor, GenericFileOperations<T> operations)
Method Detail |
---|
protected void poll() throws Exception
poll
in class ScheduledPollConsumer
Exception
- can be thrown if an exception occurred during pollingpublic void setMaxMessagesPerPoll(int maxMessagesPerPoll)
BatchConsumer
setMaxMessagesPerPoll
in interface BatchConsumer
maxMessagesPerPoll
- maximum messages to poll.public void processBatch(Queue exchanges)
BatchConsumer
Exchange
in a batch.
Each message exchange will be processed individually but the batch
consumer will add properties with the current index and total in the batch.
processBatch
in interface BatchConsumer
exchanges
- list of exchanges in this batchprotected boolean prePollCheck() throws Exception
Exception
protected abstract void pollDirectory(String fileName, List<GenericFile<T>> fileList)
fileName
- current directory or filefileList
- current list of files gatheredprotected void processExchange(Exchange exchange)
exchange
- the exchangeprotected boolean isValidFile(GenericFile<T> file, boolean isDirectory)
file
- the remote fileisDirectory
- wether the file is a directory or a file
protected boolean isMatched(GenericFile<T> file, boolean isDirectory)
file
- the fileisDirectory
- wether the file is a directory or a file
protected boolean isInProgress(GenericFile<T> file)
file
- the file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |