org.apache.camel.model
Class RouteDefinitionHelper

java.lang.Object
  extended by org.apache.camel.model.RouteDefinitionHelper

public final class RouteDefinitionHelper
extends Object

Helper for RouteDefinition

Utility methods to help preparing RouteDefinition before they are added to CamelContext.


Method Summary
static void forceAssignIds(CamelContext context, List<RouteDefinition> routes)
          Force assigning ids to the routes
static void forceAssignIds(CamelContext context, ProcessorDefinition processor)
          Force assigning ids to the give node and all its children (recursively).
static Set<String> gatherAllEndpointUris(CamelContext camelContext, RouteDefinition route, boolean includeInputs, boolean includeOutputs, boolean includeDynamic)
          Gather all the endpoint uri's the route is using from the EIPs that has a static or dynamic endpoint defined.
static Set<String> gatherAllStaticEndpointUris(CamelContext camelContext, RouteDefinition route, boolean includeInputs, boolean includeOutputs)
          Gather all the endpoint uri's the route is using from the EIPs that has a static endpoint defined.
static void initParent(ProcessorDefinition parent)
           
static void prepareRoute(ModelCamelContext context, RouteDefinition route)
          Prepares the route.
static void prepareRoute(ModelCamelContext context, RouteDefinition route, List<OnExceptionDefinition> onExceptions, List<InterceptDefinition> intercepts, List<InterceptFromDefinition> interceptFromDefinitions, List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions, List<OnCompletionDefinition> onCompletions)
          Prepares the route which supports context scoped features such as onException, interceptors and onCompletions

This method does not mark the route as prepared afterwards.

static void prepareRouteForInit(RouteDefinition route, List<ProcessorDefinition<?>> abstracts, List<ProcessorDefinition<?>> lower)
           
static void sanityCheckRoute(RouteDefinition route)
          Sanity check the route, that it has input(s) and outputs.
static String validateUniqueIds(RouteDefinition target, List<RouteDefinition> routes)
          Validates that the target route has no duplicate id's from any of the existing routes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

gatherAllStaticEndpointUris

public static Set<String> gatherAllStaticEndpointUris(CamelContext camelContext,
                                                      RouteDefinition route,
                                                      boolean includeInputs,
                                                      boolean includeOutputs)
Gather all the endpoint uri's the route is using from the EIPs that has a static endpoint defined.

Parameters:
route - the route
includeInputs - whether to include inputs
includeOutputs - whether to include outputs
Returns:
the endpoints uris

gatherAllEndpointUris

public static Set<String> gatherAllEndpointUris(CamelContext camelContext,
                                                RouteDefinition route,
                                                boolean includeInputs,
                                                boolean includeOutputs,
                                                boolean includeDynamic)
Gather all the endpoint uri's the route is using from the EIPs that has a static or dynamic endpoint defined.

Parameters:
route - the route
includeInputs - whether to include inputs
includeOutputs - whether to include outputs
includeDynamic - whether to include dynamic outputs which has been in use during routing at runtime, gathered from the RuntimeEndpointRegistry.
Returns:
the endpoints uris

forceAssignIds

public static void forceAssignIds(CamelContext context,
                                  List<RouteDefinition> routes)
                           throws Exception
Force assigning ids to the routes

Parameters:
context - the camel context
routes - the routes
Throws:
Exception - is thrown if error force assign ids to the routes

validateUniqueIds

public static String validateUniqueIds(RouteDefinition target,
                                       List<RouteDefinition> routes)
Validates that the target route has no duplicate id's from any of the existing routes.

Parameters:
target - the target route
routes - the existing routes
Returns:
null if no duplicate id's detected, otherwise the first found duplicate id is returned.

initParent

public static void initParent(ProcessorDefinition parent)

prepareRouteForInit

public static void prepareRouteForInit(RouteDefinition route,
                                       List<ProcessorDefinition<?>> abstracts,
                                       List<ProcessorDefinition<?>> lower)

prepareRoute

public static void prepareRoute(ModelCamelContext context,
                                RouteDefinition route)
Prepares the route.

This method does not mark the route as prepared afterwards.

Parameters:
context - the camel context
route - the route

prepareRoute

public static void prepareRoute(ModelCamelContext context,
                                RouteDefinition route,
                                List<OnExceptionDefinition> onExceptions,
                                List<InterceptDefinition> intercepts,
                                List<InterceptFromDefinition> interceptFromDefinitions,
                                List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions,
                                List<OnCompletionDefinition> onCompletions)
Prepares the route which supports context scoped features such as onException, interceptors and onCompletions

This method does not mark the route as prepared afterwards.

Parameters:
context - the camel context
route - the route
onExceptions - optional list of onExceptions
intercepts - optional list of interceptors
interceptFromDefinitions - optional list of interceptFroms
interceptSendToEndpointDefinitions - optional list of interceptSendToEndpoints
onCompletions - optional list onCompletions

sanityCheckRoute

public static void sanityCheckRoute(RouteDefinition route)
Sanity check the route, that it has input(s) and outputs.

Parameters:
route - the route
Throws:
IllegalArgumentException - is thrown if the route is invalid

forceAssignIds

public static void forceAssignIds(CamelContext context,
                                  ProcessorDefinition processor)
Force assigning ids to the give node and all its children (recursively).

This is needed when doing tracing or the likes, where each node should have its id assigned so the tracing can pin point exactly.

Parameters:
context - the camel context
processor - the node


Apache Camel