org.apache.camel.component.file
Class FileConsumer
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultConsumer<E>
org.apache.camel.impl.ScheduledPollConsumer<FileExchange>
org.apache.camel.component.file.FileConsumer
- All Implemented Interfaces:
- Runnable, Consumer<FileExchange>, Service
public class FileConsumer
- extends ScheduledPollConsumer<FileExchange>
For consuming files.
- Version:
- $Revision: 662314 $
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.ServiceSupport |
addChildService, getThreadName, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop |
FileConsumer
public FileConsumer(FileEndpoint endpoint,
Processor processor)
poll
protected void poll()
throws Exception
- Description copied from class:
ScheduledPollConsumer
- The polling method which is invoked periodically to poll this consumer
- Specified by:
poll
in class ScheduledPollConsumer<FileExchange>
- Throws:
Exception
- can be thrown if an exception occured during polling
pollFileOrDirectory
protected int pollFileOrDirectory(File fileOrDirectory,
boolean processDir)
- Pools the given file or directory for files to process.
- Parameters:
fileOrDirectory
- file or directoryprocessDir
- recursive
- Returns:
- the number of files processed or being processed async.
pollFile
protected int pollFile(File file)
- Polls the given file
- Parameters:
file
- the file
- Returns:
- returns 1 if the file was processed, 0 otherwise.
processStrategyCommit
protected void processStrategyCommit(FileProcessStrategy processStrategy,
FileExchange exchange,
File file,
boolean failureHandled)
- Strategy when the file was processed and a commit should be executed.
- Parameters:
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).
isValidFile
protected boolean isValidFile(File file)
isChanged
protected boolean isChanged(File file)
isMatched
protected boolean isMatched(File file)
isRecursive
public boolean isRecursive()
setRecursive
public void setRecursive(boolean recursive)
getRegexPattern
public String getRegexPattern()
setRegexPattern
public void setRegexPattern(String regexPattern)
isGenerateEmptyExchangeWhenIdle
public boolean isGenerateEmptyExchangeWhenIdle()
setGenerateEmptyExchangeWhenIdle
public void setGenerateEmptyExchangeWhenIdle(boolean generateEmptyExchangeWhenIdle)
getUnchangedDelay
public int getUnchangedDelay()
setUnchangedDelay
public void setUnchangedDelay(int unchangedDelay)
isUnchangedSize
public boolean isUnchangedSize()
setUnchangedSize
public void setUnchangedSize(boolean unchangedSize)
Copyright © 2008 Apache Software Foundation. All Rights Reserved.