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

java.lang.Object
  extended by org.apache.camel.component.file.GenericFileOnCompletion<T>
All Implemented Interfaces:
Synchronization

public class GenericFileOnCompletion<T>
extends Object
implements Synchronization

On completion strategy that performs the required work after the Exchange has been processed.

The work is for example to move the processed file into a backup folder, delete the file or in case of processing failure do a rollback.

Version:

Constructor Summary
GenericFileOnCompletion(GenericFileEndpoint<T> endpoint, GenericFileOperations<T> operations, GenericFile<T> file, String absoluteFileName)
           
 
Method Summary
 ExceptionHandler getExceptionHandler()
           
protected  void handleException(Throwable t)
           
 void onComplete(Exchange exchange)
          Called when the processing of the message exchange is complete
protected  void onCompletion(Exchange exchange)
           
 void onFailure(Exchange exchange)
          Called when the processing of the message exchange has failed for some reason.
protected  void processStrategyCommit(GenericFileProcessStrategy<T> processStrategy, Exchange exchange, GenericFile<T> file)
          Strategy when the file was processed and a commit should be executed.
protected  void processStrategyRollback(GenericFileProcessStrategy<T> processStrategy, Exchange exchange, GenericFile<T> file)
          Strategy when the file was not processed and a rollback should be executed.
 void setExceptionHandler(ExceptionHandler exceptionHandler)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericFileOnCompletion

public GenericFileOnCompletion(GenericFileEndpoint<T> endpoint,
                               GenericFileOperations<T> operations,
                               GenericFile<T> file,
                               String absoluteFileName)
Method Detail

onComplete

public void onComplete(Exchange exchange)
Description copied from interface: Synchronization
Called when the processing of the message exchange is complete

Specified by:
onComplete in interface Synchronization
Parameters:
exchange - the exchange being processed

onFailure

public void onFailure(Exchange exchange)
Description copied from interface: Synchronization
Called when the processing of the message exchange has failed for some reason. The exception which caused the problem is in Exchange.getException() and there could be a fault message via Message.isFault()

Specified by:
onFailure in interface Synchronization
Parameters:
exchange - the exchange being processed

getExceptionHandler

public ExceptionHandler getExceptionHandler()

setExceptionHandler

public void setExceptionHandler(ExceptionHandler exceptionHandler)

onCompletion

protected void onCompletion(Exchange exchange)

processStrategyCommit

protected void processStrategyCommit(GenericFileProcessStrategy<T> processStrategy,
                                     Exchange exchange,
                                     GenericFile<T> file)
Strategy when the file was processed and a commit should be executed.

Parameters:
processStrategy - the strategy to perform the commit
exchange - the exchange
file - the file processed

processStrategyRollback

protected void processStrategyRollback(GenericFileProcessStrategy<T> processStrategy,
                                       Exchange exchange,
                                       GenericFile<T> file)
Strategy when the file was not processed and a rollback should be executed.

Parameters:
processStrategy - the strategy to perform the commit
exchange - the exchange
file - the file processed

handleException

protected void handleException(Throwable t)

toString

public String toString()
Overrides:
toString in class Object


Apache CAMEL