org.apache.camel.model
Class RouteDefinition

java.lang.Object
  extended by org.apache.camel.model.OptionalIdentifiedDefinition
      extended by org.apache.camel.model.ProcessorDefinition<ProcessorDefinition>
          extended by org.apache.camel.model.RouteDefinition
All Implemented Interfaces:
CamelContextAware, Block

public class RouteDefinition
extends ProcessorDefinition<ProcessorDefinition>
implements CamelContextAware

Represents an XML <route/> element

Version:
$Revision: 893963 $

Field Summary
 
Fields inherited from class org.apache.camel.model.ProcessorDefinition
errorHandlerBuilder, errorHandlerRef, log
 
Constructor Summary
RouteDefinition()
           
RouteDefinition(Endpoint endpoint)
           
RouteDefinition(String uri)
           
 
Method Summary
 List<RouteContext> addRoutes(CamelContext context, Collection<Route> routes)
           
protected  RouteContext addRoutes(Collection<Route> routes, FromDefinition fromType)
           
 RouteDefinition adviceWith(RouteBuilder builder)
          Advices this route with the route builder.
 RouteDefinition delayer(long delay)
          Enable delayer for this route.
 RouteDefinition errorHandler(ErrorHandlerBuilder errorHandlerBuilder)
          Installs the given error handler builder.
 RouteDefinition from(Endpoint... endpoints)
          Creates inputs to the route
 RouteDefinition from(Endpoint endpoint)
          Creates an input to the route
 RouteDefinition from(String... uris)
          Creates inputs to the route
 RouteDefinition from(String uri)
          Creates an input to the route
 CamelContext getCamelContext()
          Get the CamelContext
 Long getDelayer()
           
 String getErrorHandlerRef()
           
 String getGroup()
          The group that this route belongs to; could be the name of the RouteBuilder class or be explicitly configured in the XML.
 List<FromDefinition> getInputs()
           
 List<ProcessorDefinition> getOutputs()
           
 RoutePolicy getRoutePolicy()
           
 String getRoutePolicyRef()
           
 String getShortName()
          Returns a short name for this node which can be useful for ID generation or referring to related resources like images
 ShutdownRoute getShutdownRoute()
           
 ShutdownRunningTask getShutdownRunningTask()
           
 Integer getStartupOrder()
           
 ServiceStatus getStatus()
          Returns the status of the route if it has been registered with a CamelContext
 RouteDefinition group(String name)
          Set the group name for this route
 RouteDefinition handleFault()
          Enable handle fault for this route.
 Boolean isAutoStartup()
           
 Boolean isHandleFault()
           
 boolean isStartable()
           
 boolean isStoppable()
           
 Boolean isStreamCache()
           
 Boolean isTrace()
           
 RouteDefinition noAutoStartup()
          Disables this route from being auto started when Camel starts.
 RouteDefinition noDelayer()
          Disable delayer for this route.
 RouteDefinition noHandleFault()
          Disable handle fault for this route.
 RouteDefinition noStreamCaching()
          Disable stream caching for this route.
 RouteDefinition noTracing()
          Disable tracing for this route.
 Endpoint resolveEndpoint(String uri)
           
 RouteDefinition routeId(String id)
          Set the route id for this route
 RouteDefinition routePolicy(RoutePolicy routePolicy)
          Disables this route from being auto started when Camel starts.
 RouteDefinition routePolicyRef(String routePolicyRef)
          Configures a route policy for this route
 void setAutoStartup(Boolean autoStartup)
           
 void setCamelContext(CamelContext camelContext)
          Injects the CamelContext
 void setDelayer(Long delayer)
           
protected  void setErrorHandlerBuilderIfNull(ErrorHandlerBuilder errorHandlerBuilder)
          Sets the error handler if one is not already set
 void setErrorHandlerRef(String errorHandlerRef)
          Sets the bean ref name of the error handler builder to use on this route
 void setGroup(String group)
           
 void setHandleFault(Boolean handleFault)
           
 void setInputs(List<FromDefinition> inputs)
           
 void setOutputs(List<ProcessorDefinition> outputs)
           
 void setRoutePolicy(RoutePolicy routePolicy)
           
 void setRoutePolicyRef(String routePolicyRef)
           
 void setShutdownRoute(ShutdownRoute shutdownRoute)
           
 void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask)
           
 void setStartupOrder(Integer startupOrder)
           
 void setStreamCache(Boolean streamCache)
           
 void setTrace(Boolean trace)
           
 RouteDefinition shutdownRoute(ShutdownRoute shutdownRoute)
          Configures a shutdown route option.
 RouteDefinition shutdownRunningTask(ShutdownRunningTask shutdownRunningTask)
          Configures a shutdown running task option.
 RouteDefinition startupOrder(int order)
          Configures the startup order for this route

Camel will reorder routes and star them ordered by 0..N where 0 is the lowest number and N the highest number.

 RouteDefinition streamCaching()
          Enable stream caching for this route.
 String toString()
           
 RouteDefinition tracing()
          Enable tracing for this route.
 
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategies, addInterceptStrategy, addOutput, addRoutes, aggregate, aggregate, aggregate, aggregate, aggregate, aop, bean, bean, bean, bean, beanRef, beanRef, choice, clearOutput, configureChild, convertBodyTo, convertBodyTo, createChannel, createCompositeProcessor, createErrorHandlerBuilder, createOutputsProcessor, createOutputsProcessor, createProcessor, delay, delay, delay, doTry, end, enrich, enrich, enrichRef, filter, filter, filter, filter, getErrorHandlerBuilder, getInterceptStrategies, getLabel, getNodeFactory, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isAbstract, loadBalance, loadBalance, log, log, log, loop, loop, loop, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, pipeline, pipeline, pipeline, pipeline, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, process, processRef, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeProperty, resequence, resequence, resequence, resequencer, rollback, rollback, routingSlip, routingSlip, sample, sample, setBody, setBody, setErrorHandlerBuilder, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setNodeFactory, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sortBody, sortBody, split, split, split, stop, threads, threads, throttle, throwException, to, to, to, to, to, to, to, to, to, to, toAsync, toAsync, toAsync, toAsync, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, wireTap, wireTap, wireTap, wrapChannel, wrapInErrorHandler, wrapProcessor
 
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, getDescription, getId, hasCustomIdAssigned, idOrCreate, setDescription, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RouteDefinition

public RouteDefinition()

RouteDefinition

public RouteDefinition(String uri)

RouteDefinition

public RouteDefinition(Endpoint endpoint)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getShortName

public String getShortName()
Description copied from class: OptionalIdentifiedDefinition
Returns a short name for this node which can be useful for ID generation or referring to related resources like images

Overrides:
getShortName in class OptionalIdentifiedDefinition
Returns:
defaults to "node" but derived nodes should overload this to provide a unique name

getStatus

public ServiceStatus getStatus()
Returns the status of the route if it has been registered with a CamelContext


isStartable

public boolean isStartable()

isStoppable

public boolean isStoppable()

addRoutes

public List<RouteContext> addRoutes(CamelContext context,
                                    Collection<Route> routes)
                             throws Exception
Throws:
Exception

resolveEndpoint

public Endpoint resolveEndpoint(String uri)
                         throws NoSuchEndpointException
Throws:
NoSuchEndpointException

adviceWith

public RouteDefinition adviceWith(RouteBuilder builder)
                           throws Exception
Advices this route with the route builder.

The advice process will add the interceptors, on exceptions, on completions etc. configured from the route builder to this route.

This is mostly used for testing purpose to add interceptors and the likes to an existing route.

Will stop and remove the old route from camel context and add and start this new advised route.

Parameters:
builder - the route builder
Returns:
a new route which is this route merged with the route builder
Throws:
Exception - can be thrown from the route builder

from

public RouteDefinition from(String uri)
Creates an input to the route

Parameters:
uri - the from uri
Returns:
the builder

from

public RouteDefinition from(Endpoint endpoint)
Creates an input to the route

Parameters:
endpoint - the from endpoint
Returns:
the builder

from

public RouteDefinition from(String... uris)
Creates inputs to the route

Parameters:
uris - the from uris
Returns:
the builder

from

public RouteDefinition from(Endpoint... endpoints)
Creates inputs to the route

Parameters:
endpoints - the from endpoints
Returns:
the builder

group

public RouteDefinition group(String name)
Set the group name for this route

Parameters:
name - the group name
Returns:
the builder

routeId

public RouteDefinition routeId(String id)
Set the route id for this route

Overrides:
routeId in class ProcessorDefinition<ProcessorDefinition>
Parameters:
id - the route id
Returns:
the builder

noStreamCaching

public RouteDefinition noStreamCaching()
Disable stream caching for this route.


streamCaching

public RouteDefinition streamCaching()
Enable stream caching for this route.


noTracing

public RouteDefinition noTracing()
Disable tracing for this route.


tracing

public RouteDefinition tracing()
Enable tracing for this route.


noHandleFault

public RouteDefinition noHandleFault()
Disable handle fault for this route.


handleFault

public RouteDefinition handleFault()
Enable handle fault for this route.


noDelayer

public RouteDefinition noDelayer()
Disable delayer for this route.


delayer

public RouteDefinition delayer(long delay)
Enable delayer for this route.

Parameters:
delay - delay in millis

errorHandler

public RouteDefinition errorHandler(ErrorHandlerBuilder errorHandlerBuilder)
Installs the given error handler builder.

Parameters:
errorHandlerBuilder - the error handler to be used by default for all child routes
Returns:
the current builder with the error handler configured

noAutoStartup

public RouteDefinition noAutoStartup()
Disables this route from being auto started when Camel starts.


startupOrder

public RouteDefinition startupOrder(int order)
Configures the startup order for this route

Camel will reorder routes and star them ordered by 0..N where 0 is the lowest number and N the highest number. Camel will stop routes in reverse order when its stopping.

Parameters:
order - the order represented as a number
Returns:
this builder

routePolicy

public RouteDefinition routePolicy(RoutePolicy routePolicy)
Disables this route from being auto started when Camel starts.


routePolicyRef

public RouteDefinition routePolicyRef(String routePolicyRef)
Configures a route policy for this route

Parameters:
routePolicyRef - reference to a RoutePolicy to lookup and use.

shutdownRoute

public RouteDefinition shutdownRoute(ShutdownRoute shutdownRoute)
Configures a shutdown route option.

Parameters:
shutdownRoute - the option to use when shutting down this route

shutdownRunningTask

public RouteDefinition shutdownRunningTask(ShutdownRunningTask shutdownRunningTask)
Configures a shutdown running task option.

Parameters:
shutdownRunningTask - the option to use when shutting down and how to act upon running tasks.

getInputs

public List<FromDefinition> getInputs()

setInputs

public void setInputs(List<FromDefinition> inputs)

getOutputs

public List<ProcessorDefinition> getOutputs()
Specified by:
getOutputs in class ProcessorDefinition<ProcessorDefinition>

setOutputs

public void setOutputs(List<ProcessorDefinition> outputs)

getCamelContext

public CamelContext getCamelContext()
Description copied from interface: CamelContextAware
Get the CamelContext

Specified by:
getCamelContext in interface CamelContextAware
Returns:
camelContext the Camel context

setCamelContext

public void setCamelContext(CamelContext camelContext)
Description copied from interface: CamelContextAware
Injects the CamelContext

Specified by:
setCamelContext in interface CamelContextAware
Parameters:
camelContext - the Camel context

getGroup

public String getGroup()
The group that this route belongs to; could be the name of the RouteBuilder class or be explicitly configured in the XML. May be null.


setGroup

public void setGroup(String group)

isStreamCache

public Boolean isStreamCache()

setStreamCache

public void setStreamCache(Boolean streamCache)

isTrace

public Boolean isTrace()

setTrace

public void setTrace(Boolean trace)

isHandleFault

public Boolean isHandleFault()

setHandleFault

public void setHandleFault(Boolean handleFault)

getDelayer

public Long getDelayer()

setDelayer

public void setDelayer(Long delayer)

isAutoStartup

public Boolean isAutoStartup()

setAutoStartup

public void setAutoStartup(Boolean autoStartup)

getStartupOrder

public Integer getStartupOrder()

setStartupOrder

public void setStartupOrder(Integer startupOrder)

setErrorHandlerRef

public void setErrorHandlerRef(String errorHandlerRef)
Sets the bean ref name of the error handler builder to use on this route


getErrorHandlerRef

public String getErrorHandlerRef()

setErrorHandlerBuilderIfNull

protected void setErrorHandlerBuilderIfNull(ErrorHandlerBuilder errorHandlerBuilder)
Sets the error handler if one is not already set


setRoutePolicyRef

public void setRoutePolicyRef(String routePolicyRef)

getRoutePolicyRef

public String getRoutePolicyRef()

setRoutePolicy

public void setRoutePolicy(RoutePolicy routePolicy)

getRoutePolicy

public RoutePolicy getRoutePolicy()

getShutdownRoute

public ShutdownRoute getShutdownRoute()

setShutdownRoute

public void setShutdownRoute(ShutdownRoute shutdownRoute)

getShutdownRunningTask

public ShutdownRunningTask getShutdownRunningTask()

setShutdownRunningTask

public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask)

addRoutes

protected RouteContext addRoutes(Collection<Route> routes,
                                 FromDefinition fromType)
                          throws Exception
Throws:
Exception


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