org.apache.camel.processor
Class CatchProcessor

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.processor.DelegateProcessor
          extended by org.apache.camel.processor.CatchProcessor
All Implemented Interfaces:
Navigate, Processor, Traceable, Service

public class CatchProcessor
extends DelegateProcessor
implements Traceable

A processor which catches exceptions.

Version:
$Revision: 788621 $

Field Summary
 
Fields inherited from class org.apache.camel.processor.DelegateProcessor
processor
 
Constructor Summary
CatchProcessor(List<Class> exceptions, Processor processor, Predicate onWhen, Predicate handled)
           
 
Method Summary
 boolean catches(Exchange exchange, Throwable exception)
          Whether this catch processor catch the given thrown exception
 List<Class> getExceptions()
           
 String getTraceLabel()
          Gets the trace label used for logging when tracing is enabled.
 boolean handles(Exchange exchange)
          Whether this catch processor handles the exception it have caught
protected  boolean matchesWhen(Exchange exchange)
          Strategy method for matching the exception type with the current exchange.
 String toString()
           
 
Methods inherited from class org.apache.camel.processor.DelegateProcessor
doStart, doStop, getProcessor, hasNext, next, proceed, process, processNext, setProcessor
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CatchProcessor

public CatchProcessor(List<Class> exceptions,
                      Processor processor,
                      Predicate onWhen,
                      Predicate handled)
Method Detail

toString

public String toString()
Overrides:
toString in class DelegateProcessor

getTraceLabel

public String getTraceLabel()
Description copied from interface: Traceable
Gets the trace label used for logging when tracing is enabled.

The lable should be short and precise.

Specified by:
getTraceLabel in interface Traceable
Returns:
the label

catches

public boolean catches(Exchange exchange,
                       Throwable exception)
Whether this catch processor catch the given thrown exception

Parameters:
exchange - the current exchange
exception - the thrown exception
Returns:
true if this processor catches it, false otherwise.

handles

public boolean handles(Exchange exchange)
Whether this catch processor handles the exception it have caught

Parameters:
exchange - the current exchange
Returns:
true if this processor handles it, false otherwise.

getExceptions

public List<Class> getExceptions()

matchesWhen

protected boolean matchesWhen(Exchange exchange)
Strategy method for matching the exception type with the current exchange.

This default implementation will match as:

Parameters:
exchange - the current Exchange
Returns:
true if matched, false otherwise.


Apache CAMEL