org.apache.camel.component.file
Class GenericFileEndpoint<T>

java.lang.Object
  extended by org.apache.camel.impl.DefaultEndpoint
      extended by org.apache.camel.impl.ScheduledPollEndpoint
          extended by org.apache.camel.component.file.GenericFileEndpoint<T>
All Implemented Interfaces:
CamelContextAware, Endpoint, IsSingleton
Direct Known Subclasses:
FileEndpoint

public abstract class GenericFileEndpoint<T>
extends ScheduledPollEndpoint

Generic FileEndpoint


Field Summary
protected  boolean append
           
protected  boolean autoCreate
           
protected  int bufferSize
           
protected  GenericFileConfiguration configuration
           
protected static int DEFAULT_IDEMPOTENT_CACHE_SIZE
           
protected static String DEFAULT_STRATEGYFACTORY_CLASS
           
protected  boolean delete
           
protected  String exclude
           
protected  GenericFileExclusiveReadLockStrategy exclusiveReadLockStrategy
           
protected  Expression fileName
           
protected  GenericFileFilter<T> filter
           
protected  boolean flattern
           
protected  boolean idempotent
           
protected  IdempotentRepository idempotentRepository
           
protected  String include
           
protected  String localWorkDirectory
           
protected  org.apache.commons.logging.Log log
           
protected  Expression move
           
protected  boolean noop
           
protected  GenericFileOperations<T> operations
           
protected  Expression preMove
           
protected  GenericFileProcessStrategy<T> processStrategy
           
protected  String readLock
           
protected  long readLockTimeout
           
protected  boolean recursive
           
protected  Comparator<GenericFileExchange> sortBy
           
protected  Comparator<GenericFile<T>> sorter
           
protected  String tempPrefix
           
 
Constructor Summary
GenericFileEndpoint()
           
GenericFileEndpoint(String endpointUri, Component component)
           
 
Method Summary
 void configureMessage(GenericFile<T> file, Message message)
          Configures the given message with the file which sets the body to the file object.
protected  String configureMoveOrPreMoveExpression(String expression)
          Strategy to configure the move or premove option based on a String input.
abstract  GenericFileConsumer<T> createConsumer(Processor processor)
          Creates a new Event Driven Consumer which consumes messages from the endpoint using the given processor
abstract  GenericFileExchange<T> createExchange(GenericFile<T> file)
           
protected  GenericFileProcessStrategy<T> createGenericFileStrategy()
          A strategy method to lazily create the file strategy
abstract  GenericFileProducer<T> createProducer()
          Creates a new producer which is used send messages into the endpoint
 int getBufferSize()
           
 GenericFileConfiguration getConfiguration()
           
 String getExclude()
           
 GenericFileExclusiveReadLockStrategy getExclusiveReadLockStrategy()
           
 Expression getFileName()
           
abstract  char getFileSeparator()
           
 GenericFileFilter<T> getFilter()
           
 String getGeneratedFileName(Message message)
          Return the file name that will be auto-generated for the given message if none is provided
 GenericFileProcessStrategy<T> getGenericFileProcessStrategy()
           
 IdempotentRepository getIdempotentRepository()
           
 String getInclude()
           
 String getLocalWorkDirectory()
           
 Expression getMove()
           
 GenericFileOperations<T> getOperations()
           
protected  Map<String,Object> getParamsAsMap()
           
 Expression getPreMove()
           
 GenericFileProcessStrategy<T> getProcessStrategy()
           
 String getReadLock()
           
 long getReadLockTimeout()
           
abstract  String getScheme()
           
 Comparator<GenericFileExchange> getSortBy()
           
 Comparator<GenericFile<T>> getSorter()
           
 String getTempPrefix()
           
abstract  boolean isAbsolute(String name)
           
 boolean isAppend()
           
 boolean isAutoCreate()
           
 boolean isDelete()
           
 boolean isFlattern()
           
 boolean isIdempotent()
           
 boolean isNoop()
           
 boolean isRecursive()
           
 boolean isSingleton()
          Wheter this class supports being singleton or not.
 void setAppend(boolean append)
           
 void setAutoCreate(boolean autoCreate)
           
 void setBufferSize(int bufferSize)
           
 void setConfiguration(GenericFileConfiguration configuration)
           
 void setDelete(boolean delete)
           
 void setExclude(String exclude)
           
 void setExclusiveReadLockStrategy(GenericFileExclusiveReadLockStrategy exclusiveReadLockStrategy)
           
 void setFileName(Expression fileName)
           
 void setFileName(String fileLanguageExpression)
          Sets the file expression based on FileLanguage
 void setFilter(GenericFileFilter<T> filter)
           
 void setFlattern(boolean flattern)
           
 void setGenericFileProcessStrategy(GenericFileProcessStrategy<T> genericFileProcessStrategy)
           
 void setIdempotent(boolean idempotent)
           
 void setIdempotentRepository(IdempotentRepository idempotentRepository)
           
 void setInclude(String include)
           
 void setLocalWorkDirectory(String localWorkDirectory)
           
 void setMove(Expression move)
           
 void setMove(String fileLanguageExpression)
          Sets the move expression based on FileLanguage
 void setNoop(boolean noop)
           
 void setOperations(GenericFileOperations<T> operations)
           
 void setPreMove(Expression preMove)
           
 void setPreMove(String fileLanguageExpression)
          Sets the pre move expression based on FileLanguage
 void setProcessStrategy(GenericFileProcessStrategy<T> processStrategy)
           
 void setReadLock(String readLock)
           
 void setReadLockTimeout(long readLockTimeout)
           
 void setRecursive(boolean recursive)
           
 void setSortBy(Comparator<GenericFileExchange> sortBy)
           
 void setSortBy(String expression)
           
 void setSortBy(String expression, boolean reverse)
           
 void setSorter(Comparator<GenericFile<T>> sorter)
           
 void setTempPrefix(String tempPrefix)
          Enables and uses temporary prefix when writing files, after write it will be renamed to the correct name.
 
Methods inherited from class org.apache.camel.impl.ScheduledPollEndpoint
configureConsumer, configureProperties, getConsumerProperties, setConsumerProperties
 
Methods inherited from class org.apache.camel.impl.DefaultEndpoint
convertTo, createEndpointUri, createExchange, createExchange, createExchange, createExecutorService, createPollingConsumer, equals, getCamelContext, getComponent, getEndpointUri, getExchangePattern, getExchangeType, getExecutorService, hashCode, isLenientProperties, setCamelContext, setEndpointUri, setEndpointUriIfNotSpecified, setExchangePattern, setExecutorService, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_STRATEGYFACTORY_CLASS

protected static final transient String DEFAULT_STRATEGYFACTORY_CLASS
See Also:
Constant Field Values

DEFAULT_IDEMPOTENT_CACHE_SIZE

protected static final transient int DEFAULT_IDEMPOTENT_CACHE_SIZE
See Also:
Constant Field Values

log

protected final transient org.apache.commons.logging.Log log

processStrategy

protected GenericFileProcessStrategy<T> processStrategy

operations

protected GenericFileOperations<T> operations

configuration

protected GenericFileConfiguration configuration

localWorkDirectory

protected String localWorkDirectory

autoCreate

protected boolean autoCreate

bufferSize

protected int bufferSize

append

protected boolean append

noop

protected boolean noop

recursive

protected boolean recursive

delete

protected boolean delete

flattern

protected boolean flattern

tempPrefix

protected String tempPrefix

include

protected String include

exclude

protected String exclude

fileName

protected Expression fileName

move

protected Expression move

preMove

protected Expression preMove

idempotent

protected boolean idempotent

idempotentRepository

protected IdempotentRepository idempotentRepository

filter

protected GenericFileFilter<T> filter

sorter

protected Comparator<GenericFile<T>> sorter

sortBy

protected Comparator<GenericFileExchange> sortBy

readLock

protected String readLock

readLockTimeout

protected long readLockTimeout

exclusiveReadLockStrategy

protected GenericFileExclusiveReadLockStrategy exclusiveReadLockStrategy
Constructor Detail

GenericFileEndpoint

public GenericFileEndpoint()

GenericFileEndpoint

public GenericFileEndpoint(String endpointUri,
                           Component component)
Method Detail

isSingleton

public boolean isSingleton()
Description copied from interface: IsSingleton
Wheter this class supports being singleton or not.

Returns:
true to be a single shared instance, false to create new instances.

createConsumer

public abstract GenericFileConsumer<T> createConsumer(Processor processor)
                                               throws Exception
Description copied from interface: Endpoint
Creates a new Event Driven Consumer which consumes messages from the endpoint using the given processor

Parameters:
processor - the given processor
Returns:
a newly created consumer
Throws:
Exception - can be thrown

createProducer

public abstract GenericFileProducer<T> createProducer()
                                               throws Exception
Description copied from interface: Endpoint
Creates a new producer which is used send messages into the endpoint

Returns:
a newly created producer
Throws:
Exception - can be thrown

createExchange

public abstract GenericFileExchange<T> createExchange(GenericFile<T> file)

getScheme

public abstract String getScheme()

getFileSeparator

public abstract char getFileSeparator()

isAbsolute

public abstract boolean isAbsolute(String name)

getGeneratedFileName

public String getGeneratedFileName(Message message)
Return the file name that will be auto-generated for the given message if none is provided


getGenericFileProcessStrategy

public GenericFileProcessStrategy<T> getGenericFileProcessStrategy()

createGenericFileStrategy

protected GenericFileProcessStrategy<T> createGenericFileStrategy()
A strategy method to lazily create the file strategy


setGenericFileProcessStrategy

public void setGenericFileProcessStrategy(GenericFileProcessStrategy<T> genericFileProcessStrategy)

isNoop

public boolean isNoop()

setNoop

public void setNoop(boolean noop)

isRecursive

public boolean isRecursive()

setRecursive

public void setRecursive(boolean recursive)

getInclude

public String getInclude()

setInclude

public void setInclude(String include)

getExclude

public String getExclude()

setExclude

public void setExclude(String exclude)

isDelete

public boolean isDelete()

setDelete

public void setDelete(boolean delete)

isFlattern

public boolean isFlattern()

setFlattern

public void setFlattern(boolean flattern)

getMove

public Expression getMove()

setMove

public void setMove(Expression move)

setMove

public void setMove(String fileLanguageExpression)
Sets the move expression based on FileLanguage


getPreMove

public Expression getPreMove()

setPreMove

public void setPreMove(Expression preMove)

setPreMove

public void setPreMove(String fileLanguageExpression)
Sets the pre move expression based on FileLanguage


getFileName

public Expression getFileName()

setFileName

public void setFileName(Expression fileName)

setFileName

public void setFileName(String fileLanguageExpression)
Sets the file expression based on FileLanguage


isIdempotent

public boolean isIdempotent()

setIdempotent

public void setIdempotent(boolean idempotent)

getIdempotentRepository

public IdempotentRepository getIdempotentRepository()

setIdempotentRepository

public void setIdempotentRepository(IdempotentRepository idempotentRepository)

getFilter

public GenericFileFilter<T> getFilter()

setFilter

public void setFilter(GenericFileFilter<T> filter)

getSorter

public Comparator<GenericFile<T>> getSorter()

setSorter

public void setSorter(Comparator<GenericFile<T>> sorter)

getSortBy

public Comparator<GenericFileExchange> getSortBy()

setSortBy

public void setSortBy(Comparator<GenericFileExchange> sortBy)

setSortBy

public void setSortBy(String expression)

setSortBy

public void setSortBy(String expression,
                      boolean reverse)

getTempPrefix

public String getTempPrefix()

setTempPrefix

public void setTempPrefix(String tempPrefix)
Enables and uses temporary prefix when writing files, after write it will be renamed to the correct name.


getConfiguration

public GenericFileConfiguration getConfiguration()

setConfiguration

public void setConfiguration(GenericFileConfiguration configuration)

getExclusiveReadLockStrategy

public GenericFileExclusiveReadLockStrategy getExclusiveReadLockStrategy()

setExclusiveReadLockStrategy

public void setExclusiveReadLockStrategy(GenericFileExclusiveReadLockStrategy exclusiveReadLockStrategy)

getReadLock

public String getReadLock()

setReadLock

public void setReadLock(String readLock)

getReadLockTimeout

public long getReadLockTimeout()

setReadLockTimeout

public void setReadLockTimeout(long readLockTimeout)

getBufferSize

public int getBufferSize()

setBufferSize

public void setBufferSize(int bufferSize)

isAppend

public boolean isAppend()

setAppend

public void setAppend(boolean append)

isAutoCreate

public boolean isAutoCreate()

setAutoCreate

public void setAutoCreate(boolean autoCreate)

getOperations

public GenericFileOperations<T> getOperations()

setOperations

public void setOperations(GenericFileOperations<T> operations)

getProcessStrategy

public GenericFileProcessStrategy<T> getProcessStrategy()

setProcessStrategy

public void setProcessStrategy(GenericFileProcessStrategy<T> processStrategy)

getLocalWorkDirectory

public String getLocalWorkDirectory()

setLocalWorkDirectory

public void setLocalWorkDirectory(String localWorkDirectory)

configureMessage

public void configureMessage(GenericFile<T> file,
                             Message message)
Configures the given message with the file which sets the body to the file object.


configureMoveOrPreMoveExpression

protected String configureMoveOrPreMoveExpression(String expression)
Strategy to configure the move or premove option based on a String input.

Parameters:
expression - the original string input
Returns:
configured string or the original if no modifications is needed

getParamsAsMap

protected Map<String,Object> getParamsAsMap()


Copyright © 2009 Apache Software Foundation. All Rights Reserved.