org.apache.camel.spi
Interface RouteContext

All Superinterfaces:
RuntimeConfiguration
All Known Implementing Classes:
DefaultRouteContext

public interface RouteContext
extends RuntimeConfiguration

The context used to activate new routing rules

Version:

Method Summary
 void addEventDrivenProcessor(Processor processor)
          Adds an event driven processor
 void addInterceptStrategy(InterceptStrategy interceptStrategy)
          Adds a InterceptStrategy to this route context
 void commit()
          For completing 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
 int getAndIncrement(ProcessorDefinition<?> node)
          A private counter that increments, is used to as book keeping when building a route based on the model

We need this special book keeping be able to assign the correct ProcessorDefinition to the Channel

 CamelContext getCamelContext()
          Gets the camel context
 Endpoint getEndpoint()
          Gets the endpoint
 FromDefinition getFrom()
          Gets the from type
 List<InterceptStrategy> getInterceptStrategies()
          This method retrieves the InterceptStrategy instances this route context.
 InterceptStrategy getManagedInterceptStrategy()
          Gets the special managed intercept strategy if any
 RouteDefinition getRoute()
          Get the route type
 List<RoutePolicy> getRoutePolicyList()
          Gets the route policy List
 boolean isRouteAdded()
          Returns the isRouteAdded flag
<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 setInterceptStrategies(List<InterceptStrategy> interceptStrategies)
          This method sets the InterceptStrategy instances on this route context.
 void setIsRouteAdded(boolean value)
          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 setManagedInterceptStrategy(InterceptStrategy interceptStrategy)
          Sets a special intercept strategy for management.
 void setRoutePolicyList(List<RoutePolicy> routePolicyList)
          Sets a custom route policy List
 
Methods inherited from interface org.apache.camel.RuntimeConfiguration
getDelayer, getShutdownRoute, getShutdownRunningTask, isAutoStartup, isHandleFault, isStreamCaching, isTracing, setAutoStartup, setDelayer, setHandleFault, setShutdownRoute, setShutdownRunningTask, setStreamCaching, setTracing
 

Method Detail

getEndpoint

Endpoint getEndpoint()
Gets the endpoint

Returns:
the endpoint

getFrom

FromDefinition getFrom()
Gets the from type

Returns:
the from type

getRoute

RouteDefinition getRoute()
Get the route type

Returns:
the route type

getCamelContext

CamelContext getCamelContext()
Gets the camel context

Returns:
the camel context

createProcessor

Processor createProcessor(ProcessorDefinition<?> node)
                          throws Exception
Creates a processor

Parameters:
node - the node
Returns:
the created processor
Throws:
Exception - can be thrown

resolveEndpoint

Endpoint resolveEndpoint(String uri)
Resolves an endpoint from the URI

Parameters:
uri - the URI
Returns:
the resolved endpoint

resolveEndpoint

Endpoint resolveEndpoint(String uri,
                         String ref)
Resolves an endpoint from either a URI or a named reference

Parameters:
uri - the URI or
ref - the named reference
Returns:
the resolved endpoint

lookup

<T> T lookup(String name,
             Class<T> type)
lookup an object by name and type

Parameters:
name - the name to lookup
type - the expected type
Returns:
the found object

lookupByType

<T> Map<String,T> lookupByType(Class<T> type)
lookup objects by type

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

void commit()
For completing the route creation, creating a single event driven route for the current from endpoint with any processors required


addEventDrivenProcessor

void addEventDrivenProcessor(Processor processor)
Adds an event driven processor

Parameters:
processor - the processor

getInterceptStrategies

List<InterceptStrategy> getInterceptStrategies()
This method retrieves the InterceptStrategy instances this route context.

Returns:
the strategy

setInterceptStrategies

void setInterceptStrategies(List<InterceptStrategy> interceptStrategies)
This method sets the InterceptStrategy instances on this route context.

Parameters:
interceptStrategies - the strategies

addInterceptStrategy

void addInterceptStrategy(InterceptStrategy interceptStrategy)
Adds a InterceptStrategy to this route context

Parameters:
interceptStrategy - the strategy

setManagedInterceptStrategy

void setManagedInterceptStrategy(InterceptStrategy interceptStrategy)
Sets a special intercept strategy for management.

Is by default used to correlate managed performance counters with processors when the runtime route is being constructed

Parameters:
interceptStrategy - the managed intercept strategy

getManagedInterceptStrategy

InterceptStrategy getManagedInterceptStrategy()
Gets the special managed intercept strategy if any

Returns:
the managed intercept strategy, or null if not managed

setIsRouteAdded

void setIsRouteAdded(boolean value)
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.

Parameters:
value - the flag

isRouteAdded

boolean isRouteAdded()
Returns the isRouteAdded flag

Returns:
the flag

getRoutePolicyList

List<RoutePolicy> getRoutePolicyList()
Gets the route policy List

Returns:
the route policy list if any

setRoutePolicyList

void setRoutePolicyList(List<RoutePolicy> routePolicyList)
Sets a custom route policy List

Parameters:
routePolicyList - the custom route policy list

getAndIncrement

int getAndIncrement(ProcessorDefinition<?> node)
A private counter that increments, is used to as book keeping when building a route based on the model

We need this special book keeping be able to assign the correct ProcessorDefinition to the Channel

Parameters:
node - the current node
Returns:
the current count


Apache CAMEL