public abstract class GenericFileProcessStrategySupport<T> extends ServiceSupport implements GenericFileProcessStrategy<T>, CamelContextAware
GenericFileProcessStrategy
.Modifier and Type | Field and Description |
---|---|
protected CamelContext |
camelContext |
protected GenericFileExclusiveReadLockStrategy<T> |
exclusiveReadLockStrategy |
protected org.slf4j.Logger |
log |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
GenericFileProcessStrategySupport() |
Modifier and Type | Method and Description |
---|---|
void |
abort(GenericFileOperations<T> operations,
GenericFileEndpoint<T> endpoint,
Exchange exchange,
GenericFile<T> file)
Called when a begin is aborted, for example to release any resources which may have
been acquired during the
GenericFileProcessStrategy.begin(GenericFileOperations, GenericFileEndpoint, org.apache.camel.Exchange, GenericFile)
operation. |
boolean |
begin(GenericFileOperations<T> operations,
GenericFileEndpoint<T> endpoint,
Exchange exchange,
GenericFile<T> file)
Called when work is about to begin on this file.
|
void |
commit(GenericFileOperations<T> operations,
GenericFileEndpoint<T> endpoint,
Exchange exchange,
GenericFile<T> file)
Releases any file locks and possibly deletes or moves the file after
successful processing
|
protected void |
deleteLocalWorkFile(Exchange exchange) |
protected void |
doShutdown()
Implementations override this method to perform customized shutdown.
|
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
CamelContext |
getCamelContext()
Get the
CamelContext |
GenericFileExclusiveReadLockStrategy<T> |
getExclusiveReadLockStrategy() |
void |
prepareOnStartup(GenericFileOperations<T> operations,
GenericFileEndpoint<T> endpoint)
Allows custom logic to be run on first poll preparing the strategy,
such as removing old lock files etc.
|
protected GenericFile<T> |
renameFile(GenericFileOperations<T> operations,
GenericFile<T> from,
GenericFile<T> to) |
void |
rollback(GenericFileOperations<T> operations,
GenericFileEndpoint<T> endpoint,
Exchange exchange,
GenericFile<T> file)
Releases any file locks and possibly deletes or moves the file after
unsuccessful processing
|
void |
setCamelContext(CamelContext camelContext)
Injects the
CamelContext |
void |
setExclusiveReadLockStrategy(GenericFileExclusiveReadLockStrategy<T> exclusiveReadLockStrategy) |
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
protected final org.slf4j.Logger log
protected GenericFileExclusiveReadLockStrategy<T> exclusiveReadLockStrategy
protected CamelContext camelContext
public GenericFileProcessStrategySupport()
public CamelContext getCamelContext()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext camelContext)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
camelContext
- the Camel contextpublic void prepareOnStartup(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint) throws Exception
GenericFileProcessStrategy
prepareOnStartup
in interface GenericFileProcessStrategy<T>
operations
- file operationsendpoint
- the endpointException
- can be thrown in case of errors which causes poll to failpublic boolean begin(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception
GenericFileProcessStrategy
begin
in interface GenericFileProcessStrategy<T>
operations
- file operationsendpoint
- the endpointexchange
- the exchangefile
- the fileException
- can be thrown in case of errorspublic void abort(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception
GenericFileProcessStrategy
GenericFileProcessStrategy.begin(GenericFileOperations, GenericFileEndpoint, org.apache.camel.Exchange, GenericFile)
operation.abort
in interface GenericFileProcessStrategy<T>
operations
- file operationsendpoint
- the endpointexchange
- the exchangefile
- the fileException
- can be thrown in case of errorspublic void commit(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception
GenericFileProcessStrategy
commit
in interface GenericFileProcessStrategy<T>
operations
- file operationsendpoint
- the endpointexchange
- the exchangefile
- the fileException
- can be thrown in case of errorspublic void rollback(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception
GenericFileProcessStrategy
rollback
in interface GenericFileProcessStrategy<T>
operations
- file operationsendpoint
- the endpointexchange
- the exchangefile
- the fileException
- can be thrown in case of errorspublic GenericFileExclusiveReadLockStrategy<T> getExclusiveReadLockStrategy()
public void setExclusiveReadLockStrategy(GenericFileExclusiveReadLockStrategy<T> exclusiveReadLockStrategy)
protected GenericFile<T> renameFile(GenericFileOperations<T> operations, GenericFile<T> from, GenericFile<T> to) throws IOException
IOException
protected void deleteLocalWorkFile(Exchange exchange)
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.doStop
in class ServiceSupport
Exception
ServiceSupport.doStart()
protected void doShutdown() throws Exception
ServiceSupport
doShutdown
in class ServiceSupport
Exception
Apache Camel