|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultConsumer<E>
org.apache.camel.impl.ScheduledPollConsumer<FileExchange>
org.apache.camel.component.file.FileConsumer
public class FileConsumer
For consuming files.
Constructor Summary | |
---|---|
FileConsumer(FileEndpoint endpoint,
Processor processor)
|
Method Summary | |
---|---|
protected void |
acquireExclusiveReadLock(File file)
Acquires exclusive read lock to the given file. |
String |
getRegexPattern()
|
int |
getUnchangedDelay()
|
boolean |
isAlwaysConsume()
|
protected boolean |
isChanged(File file)
|
boolean |
isExclusiveReadLock()
|
boolean |
isGenerateEmptyExchangeWhenIdle()
|
protected boolean |
isMatched(File file)
|
boolean |
isRecursive()
|
boolean |
isUnchangedSize()
|
protected boolean |
isValidFile(File file)
|
protected void |
poll()
The polling method which is invoked periodically to poll this consumer |
protected int |
pollFile(File file)
Polls the given file |
protected int |
pollFileOrDirectory(File fileOrDirectory,
boolean processDir)
Pools the given file or directory for files to process. |
protected void |
processStrategyCommit(FileProcessStrategy processStrategy,
FileExchange exchange,
File file,
boolean failureHandled)
Strategy when the file was processed and a commit should be executed. |
protected void |
processStrategyRollback(FileProcessStrategy processStrategy,
FileExchange exchange,
File file)
Strategy when the file was not processed and a rollback should be executed. |
void |
setAlwaysConsume(boolean alwaysConsume)
|
void |
setExclusiveReadLock(boolean exclusiveReadLock)
|
void |
setGenerateEmptyExchangeWhenIdle(boolean generateEmptyExchangeWhenIdle)
|
void |
setRecursive(boolean recursive)
|
void |
setRegexPattern(String regexPattern)
|
void |
setUnchangedDelay(int unchangedDelay)
Deprecated. will be removed in Camel 2.0 |
void |
setUnchangedSize(boolean unchangedSize)
Deprecated. will be removed in Camel 2.0 |
Methods inherited from class org.apache.camel.impl.ScheduledPollConsumer |
---|
doStart, doStop, getDelay, getInitialDelay, getTimeUnit, isUseFixedDelay, run, setDelay, setInitialDelay, setTimeUnit, setUseFixedDelay |
Methods inherited from class org.apache.camel.impl.DefaultConsumer |
---|
getAsyncProcessor, getEndpoint, getExceptionHandler, getProcessor, handleException, setExceptionHandler, toString |
Methods inherited from class org.apache.camel.impl.ServiceSupport |
---|
addChildService, getThreadName, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, 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 |
Constructor Detail |
---|
public FileConsumer(FileEndpoint endpoint, Processor processor)
Method Detail |
---|
protected void poll() throws Exception
ScheduledPollConsumer
poll
in class ScheduledPollConsumer<FileExchange>
Exception
- can be thrown if an exception occured during pollingprotected int pollFileOrDirectory(File fileOrDirectory, boolean processDir)
fileOrDirectory
- file or directoryprocessDir
- recursive
protected int pollFile(File file)
file
- the file
protected void acquireExclusiveReadLock(File file) throws IOException
IOException
protected void processStrategyCommit(FileProcessStrategy processStrategy, FileExchange exchange, File file, boolean failureHandled)
processStrategy
- the strategy to perform the commitexchange
- the exchangefile
- the file processedfailureHandled
- is false if the exchange was processed succesfully, true if
an exception occured during processing but it was handled by the failure processor (usually the
DeadLetterChannel).protected void processStrategyRollback(FileProcessStrategy processStrategy, FileExchange exchange, File file)
processStrategy
- the strategy to perform the commitexchange
- the exchangefile
- the file processedprotected boolean isValidFile(File file)
protected boolean isChanged(File file)
protected boolean isMatched(File file)
public boolean isRecursive()
public void setRecursive(boolean recursive)
public String getRegexPattern()
public void setRegexPattern(String regexPattern)
public boolean isGenerateEmptyExchangeWhenIdle()
public void setGenerateEmptyExchangeWhenIdle(boolean generateEmptyExchangeWhenIdle)
public int getUnchangedDelay()
public void setUnchangedDelay(int unchangedDelay)
public boolean isUnchangedSize()
public void setUnchangedSize(boolean unchangedSize)
public boolean isExclusiveReadLock()
public void setExclusiveReadLock(boolean exclusiveReadLock)
public boolean isAlwaysConsume()
public void setAlwaysConsume(boolean alwaysConsume)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |