org.apache.camel.processor.interceptor
Class TraceInterceptor

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

public class TraceInterceptor
extends DelegateProcessor
implements ExchangeFormatter

An interceptor for debugging and tracing routes

Version:
$Revision: 795369 $

Field Summary
 
Fields inherited from class org.apache.camel.processor.DelegateProcessor
processor
 
Constructor Summary
TraceInterceptor(ProcessorDefinition node, Processor target, TraceFormatter formatter, Tracer tracer)
           
TraceInterceptor(ProcessorDefinition node, Processor target, Tracer tracer)
           
 
Method Summary
protected  boolean afterIntercept(InterceptDefinition interceptr, TraceableUnitOfWork tuow, Exchange exchange)
           
protected  boolean beforeOnCompletion(OnCompletionDefinition onCompletion, TraceableUnitOfWork tuow, Exchange exchange)
           
protected  boolean beforeOnException(OnExceptionDefinition onException, TraceableUnitOfWork tuow, Exchange exchange)
           
protected  void doStart()
           
protected  void doStop()
           
 Object format(Exchange exchange)
          Generates a string representation of the exchange
 TraceFormatter getFormatter()
           
 Logger getLogger()
           
 ProcessorDefinition getNode()
           
protected  void logException(Exchange exchange, Throwable throwable)
           
protected  void logExchange(Exchange exchange)
           
 void process(Exchange exchange)
          Processes the message exchange
protected  boolean shouldLogException(Exchange exchange)
          Returns true if the given exchange should be logged when an exception was thrown
protected  boolean shouldLogExchange(Exchange exchange)
          Returns true if the given exchange should be logged in the trace list
protected  boolean shouldLogNode(ProcessorDefinition node)
          Returns true if the given node should be logged in the trace list
 boolean shouldTraceOutExchanges()
          Returns whether exchanges coming out of processors should be traced
 String toString()
           
protected  void traceExchange(Exchange exchange)
           
 
Methods inherited from class org.apache.camel.processor.DelegateProcessor
getProcessor, hasNext, next, proceed, 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

TraceInterceptor

public TraceInterceptor(ProcessorDefinition node,
                        Processor target,
                        TraceFormatter formatter,
                        Tracer tracer)

TraceInterceptor

public TraceInterceptor(ProcessorDefinition node,
                        Processor target,
                        Tracer tracer)
Method Detail

toString

public String toString()
Overrides:
toString in class DelegateProcessor

process

public void process(Exchange exchange)
             throws Exception
Description copied from interface: Processor
Processes the message exchange

Specified by:
process in interface Processor
Overrides:
process in class DelegateProcessor
Parameters:
exchange - the message exchange
Throws:
Exception - if an internal processing error has occurred.

format

public Object format(Exchange exchange)
Description copied from interface: ExchangeFormatter
Generates a string representation of the exchange

Specified by:
format in interface ExchangeFormatter
Parameters:
exchange - the exchange
Returns:
a string representation of the exchange

getNode

public ProcessorDefinition getNode()

getLogger

public Logger getLogger()

getFormatter

public TraceFormatter getFormatter()

beforeOnException

protected boolean beforeOnException(OnExceptionDefinition onException,
                                    TraceableUnitOfWork tuow,
                                    Exchange exchange)
                             throws Exception
Throws:
Exception

beforeOnCompletion

protected boolean beforeOnCompletion(OnCompletionDefinition onCompletion,
                                     TraceableUnitOfWork tuow,
                                     Exchange exchange)
                              throws Exception
Throws:
Exception

afterIntercept

protected boolean afterIntercept(InterceptDefinition interceptr,
                                 TraceableUnitOfWork tuow,
                                 Exchange exchange)
                          throws Exception
Throws:
Exception

logExchange

protected void logExchange(Exchange exchange)

traceExchange

protected void traceExchange(Exchange exchange)
                      throws Exception
Throws:
Exception

logException

protected void logException(Exchange exchange,
                            Throwable throwable)

shouldLogExchange

protected boolean shouldLogExchange(Exchange exchange)
Returns true if the given exchange should be logged in the trace list


shouldLogException

protected boolean shouldLogException(Exchange exchange)
Returns true if the given exchange should be logged when an exception was thrown


shouldTraceOutExchanges

public boolean shouldTraceOutExchanges()
Returns whether exchanges coming out of processors should be traced


shouldLogNode

protected boolean shouldLogNode(ProcessorDefinition node)
Returns true if the given node should be logged in the trace list


doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class DelegateProcessor
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class DelegateProcessor
Throws:
Exception


Apache CAMEL