org.apache.camel.impl
Class DefaultRouteContext

java.lang.Object
  extended by org.apache.camel.impl.DefaultRouteContext
All Implemented Interfaces:
RuntimeConfiguration, RouteContext

public class DefaultRouteContext
extends Object
implements RouteContext

The context used to activate new routing rules

Version:
$Revision: 799257 $

Constructor Summary
DefaultRouteContext(CamelContext camelContext)
          Only used for lazy construction from inside ExpressionType
DefaultRouteContext(RouteDefinition route, FromDefinition from, Collection<Route> routes)
           
 
Method Summary
 void addEventDrivenProcessor(Processor processor)
          Adds an event driven processor
 void addInterceptStrategy(InterceptStrategy interceptStrategy)
          Adds a InterceptStrategy to this route context
 void commit()
          Lets complete the route creation, creating a single event driven route for the current from endpoint with any processors required
 Processor createProcessor(ProcessorDefinition node)
          Creates a processor
 CamelContext getCamelContext()
          Gets the camel context
 DataFormatDefinition getDataFormat(String ref)
          Get a DataFormatType by ref name
 Long getDelayer()
          Gets the delay value
 Endpoint getEndpoint()
          Gets the endpoint
 FromDefinition getFrom()
          Gets the from type
 List<InterceptStrategy> getInterceptStrategies()
          This method retrieves the InterceptStrategy instances this route context.
 RouteDefinition getRoute()
          Get the route type
 boolean isHandleFault()
          Returns whether tracing enabled
 boolean isRouteAdded()
          Returns the isRouteAdded flag
 boolean isStreamCaching()
          Returns whether stream cache is enabled
 boolean isTracing()
          Returns whether tracing enabled
<T> T
lookup(String name, Class<T> type)
          lookup an object by name and type
<T> Map<String,T>
lookupByType(Class<T> type)
          lookup objects by type
 Endpoint resolveEndpoint(String uri)
          Resolves an endpoint from the URI
 Endpoint resolveEndpoint(String uri, String ref)
          Resolves an endpoint from either a URI or a named reference
 void setDelayer(long delay)
          Sets a delay value in millis that a message is delayed at every step it takes in the route path, to slow things down to better helps you to see what goes

Is disabled by default

 void setHandleFault(Boolean handleFault)
          Sets whether handle fault is enabled or not (default is disabled).
 void setInterceptStrategies(List<InterceptStrategy> interceptStrategies)
          This method sets the InterceptStrategy instances on this route context.
 void setIsRouteAdded(boolean routeAdded)
          If this flag is true, ProcessorDefinition.addRoutes(RouteContext, java.util.Collection) will not add processor to addEventDrivenProcessor to the RouteContext and it will prevent from adding an EventDrivenRoute.
 void setStreamCaching(Boolean cache)
          Sets whether stream caching is enabled or not (default is disabled).
 void setTracing(Boolean tracing)
          Sets whether tracing is enabled or not (default is disabled).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRouteContext

public DefaultRouteContext(RouteDefinition route,
                           FromDefinition from,
                           Collection<Route> routes)

DefaultRouteContext

public DefaultRouteContext(CamelContext camelContext)
Only used for lazy construction from inside ExpressionType

Method Detail

getEndpoint

public Endpoint getEndpoint()
Description copied from interface: RouteContext
Gets the endpoint

Specified by:
getEndpoint in interface RouteContext
Returns:
the endpoint

getFrom

public FromDefinition getFrom()
Description copied from interface: RouteContext
Gets the from type

Specified by:
getFrom in interface RouteContext
Returns:
the from type

getRoute

public RouteDefinition getRoute()
Description copied from interface: RouteContext
Get the route type

Specified by:
getRoute in interface RouteContext
Returns:
the route type

getCamelContext

public CamelContext getCamelContext()
Description copied from interface: RouteContext
Gets the camel context

Specified by:
getCamelContext in interface RouteContext
Returns:
the camel context

createProcessor

public Processor createProcessor(ProcessorDefinition node)
                          throws Exception
Description copied from interface: RouteContext
Creates a processor

Specified by:
createProcessor in interface RouteContext
Parameters:
node - the node
Returns:
the created processor
Throws:
Exception - can be thrown

resolveEndpoint

public Endpoint resolveEndpoint(String uri)
Description copied from interface: RouteContext
Resolves an endpoint from the URI

Specified by:
resolveEndpoint in interface RouteContext
Parameters:
uri - the URI
Returns:
the resolved endpoint

resolveEndpoint

public Endpoint resolveEndpoint(String uri,
                                String ref)
Description copied from interface: RouteContext
Resolves an endpoint from either a URI or a named reference

Specified by:
resolveEndpoint in interface RouteContext
Parameters:
uri - the URI or
ref - the named reference
Returns:
the resolved endpoint

lookup

public <T> T lookup(String name,
                    Class<T> type)
Description copied from interface: RouteContext
lookup an object by name and type

Specified by:
lookup in interface RouteContext
Parameters:
name - the name to lookup
type - the expected type
Returns:
the found object

lookupByType

public <T> Map<String,T> lookupByType(Class<T> type)
Description copied from interface: RouteContext
lookup objects by type

Specified by:
lookupByType in interface RouteContext
Parameters:
type - the expected type
Returns:
the found objects with the name as the key in the map. Returns an empty map if none found.

commit

public void commit()
Description copied from interface: RouteContext
Lets complete the route creation, creating a single event driven route for the current from endpoint with any processors required

Specified by:
commit in interface RouteContext

addEventDrivenProcessor

public void addEventDrivenProcessor(Processor processor)
Description copied from interface: RouteContext
Adds an event driven processor

Specified by:
addEventDrivenProcessor in interface RouteContext
Parameters:
processor - the processor

getInterceptStrategies

public List<InterceptStrategy> getInterceptStrategies()
Description copied from interface: RouteContext
This method retrieves the InterceptStrategy instances this route context.

Specified by:
getInterceptStrategies in interface RouteContext
Returns:
the strategy

setInterceptStrategies

public void setInterceptStrategies(List<InterceptStrategy> interceptStrategies)
Description copied from interface: RouteContext
This method sets the InterceptStrategy instances on this route context.

Specified by:
setInterceptStrategies in interface RouteContext
Parameters:
interceptStrategies - the strategies

addInterceptStrategy

public void addInterceptStrategy(InterceptStrategy interceptStrategy)
Description copied from interface: RouteContext
Adds a InterceptStrategy to this route context

Specified by:
addInterceptStrategy in interface RouteContext
Parameters:
interceptStrategy - the strategy

isRouteAdded

public boolean isRouteAdded()
Description copied from interface: RouteContext
Returns the isRouteAdded flag

Specified by:
isRouteAdded in interface RouteContext
Returns:
the flag

setIsRouteAdded

public void setIsRouteAdded(boolean routeAdded)
Description copied from interface: RouteContext
If this flag is true, ProcessorDefinition.addRoutes(RouteContext, java.util.Collection) will not add processor to addEventDrivenProcessor to the RouteContext and it will prevent from adding an EventDrivenRoute.

Specified by:
setIsRouteAdded in interface RouteContext
Parameters:
routeAdded - the flag

setTracing

public void setTracing(Boolean tracing)
Description copied from interface: RuntimeConfiguration
Sets whether tracing is enabled or not (default is disabled).

Is disabled by default

Specified by:
setTracing in interface RuntimeConfiguration
Parameters:
tracing - whether tracing is enabled or not.

isTracing

public boolean isTracing()
Description copied from interface: RuntimeConfiguration
Returns whether tracing enabled

Specified by:
isTracing in interface RuntimeConfiguration
Returns:
true if tracing is enabled

setStreamCaching

public void setStreamCaching(Boolean cache)
Description copied from interface: RuntimeConfiguration
Sets whether stream caching is enabled or not (default is disabled).

Is disabled by default

Specified by:
setStreamCaching in interface RuntimeConfiguration
Parameters:
cache - whether stream caching is enabled or not

isStreamCaching

public boolean isStreamCaching()
Description copied from interface: RuntimeConfiguration
Returns whether stream cache is enabled

Specified by:
isStreamCaching in interface RuntimeConfiguration
Returns:
true if stream cache is enabled

setHandleFault

public void setHandleFault(Boolean handleFault)
Description copied from interface: RuntimeConfiguration
Sets whether handle fault is enabled or not (default is disabled).

Is disabled by default

Specified by:
setHandleFault in interface RuntimeConfiguration
Parameters:
handleFault - whether handle fault is enabled or not.

isHandleFault

public boolean isHandleFault()
Description copied from interface: RuntimeConfiguration
Returns whether tracing enabled

Specified by:
isHandleFault in interface RuntimeConfiguration
Returns:
true if tracing is enabled

setDelayer

public void setDelayer(long delay)
Description copied from interface: RuntimeConfiguration
Sets a delay value in millis that a message is delayed at every step it takes in the route path, to slow things down to better helps you to see what goes

Is disabled by default

Specified by:
setDelayer in interface RuntimeConfiguration
Parameters:
delay - delay in millis

getDelayer

public Long getDelayer()
Description copied from interface: RuntimeConfiguration
Gets the delay value

Specified by:
getDelayer in interface RuntimeConfiguration
Returns:
delay in millis, or null if disabled

getDataFormat

public DataFormatDefinition getDataFormat(String ref)
Description copied from interface: RouteContext
Get a DataFormatType by ref name

Specified by:
getDataFormat in interface RouteContext
Parameters:
ref - the ref name to lookup
Returns:
the found object


Apache CAMEL