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>, Processor, Service, ExchangeFormatter

public class TraceInterceptor
extends DelegateProcessor
implements ExchangeFormatter

An interceptor for debugging and tracing routes

Version:
$Revision: 893110 $

Field Summary
 
Fields inherited from class org.apache.camel.processor.DelegateProcessor
processor
 
Constructor Summary
TraceInterceptor(ProcessorDefinition node, Processor target, TraceFormatter formatter, Tracer tracer)
           
 
Method Summary
protected  void doStart()
           
protected  void doStop()
           
 Object format(Exchange exchange)
          Generates a string representation of the exchange
 TraceFormatter getFormatter()
           
 Logger getLogger()
           
 ProcessorDefinition<?> getNode()
           
 Tracer getTracer()
           
protected  void logException(Exchange exchange, Throwable throwable)
           
protected  void logExchange(Exchange exchange)
           
 void process(Exchange exchange)
          Processes the message exchange
 void setRouteContext(RouteContext routeContext)
           
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)
           
protected  void traceIntercept(InterceptDefinition intercept, TracedRouteNodes traced, 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)
Method Detail

toString

public String toString()
Overrides:
toString in class DelegateProcessor

setRouteContext

public void setRouteContext(RouteContext routeContext)

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.

traceIntercept

protected void traceIntercept(InterceptDefinition intercept,
                              TracedRouteNodes traced,
                              Exchange exchange)
                       throws Exception
Throws:
Exception

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()

getTracer

public Tracer getTracer()

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


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.