org.apache.camel.builder
Class RouteBuilder

java.lang.Object
  extended by org.apache.camel.builder.BuilderSupport
      extended by org.apache.camel.builder.RouteBuilder
Direct Known Subclasses:
NoRouteBuilder

public abstract class RouteBuilder
extends BuilderSupport

A Java DSL which is used to build Route instances in a CamelContext for smart routing.

Version:
$Revision: 37863 $

Constructor Summary
RouteBuilder()
           
RouteBuilder(CamelContext context)
           
 
Method Summary
protected  void checkInitialized()
           
abstract  void configure()
          Called on initialization to to build the required destinationBuilders
protected  void configureRoute(RouteType route)
           
protected  CamelContext createContainer()
          Factory method
 RouteBuilder errorHandler(ErrorHandlerBuilder errorHandlerBuilder)
          Installs the given error handler builder
 ExceptionType exception(Class exceptionType)
          Adds an exception handler route for the given exception type
 RouteType from(Endpoint endpoint)
          Creates a new route from the given endpoint
 RouteType from(String uri)
          Creates a new route from the given URI input
 CamelContext getContext()
           
 RoutesType getRouteCollection()
           
 List<Route> getRouteList()
          Returns the routing map from inbound endpoints to processors
 RouteBuilder inheritErrorHandler(boolean value)
          Configures whether or not the error handler is inherited by every processing node (or just the top most one)
 InterceptType intercept()
          Adds a route for an interceptor; use the ProcessorType.proceed() method to continue processing the underlying route being intercepted.
 RouteBuilder intercept(DelegateProcessor interceptor)
          Adds the given interceptor to this route
 ChoiceType intercept(Predicate predicate)
          Applies a route for an interceptor if the given predicate is true otherwise the interceptor route is not applied
 void noStreamCaching()
          Completely disable stream caching for all routes being defined in the same RouteBuilder after this.
protected  void populateRoutes(List<Route> routes)
           
 void setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder)
          Sets the error handler to use with processors created by this builder
 void setInheritErrorHandler(boolean inheritErrorHandler)
           
 void setRouteCollection(RoutesType routeCollection)
           
 void streamCaching()
          Enable stream caching for all routes being defined in the same RouteBuilder after this call.
 String toString()
           
 
Methods inherited from class org.apache.camel.builder.BuilderSupport
body, body, constant, createErrorHandlerBuilder, deadLetterChannel, deadLetterChannel, deadLetterChannel, endpoint, endpoint, endpoints, endpoints, faultBody, faultBodyAs, getErrorHandlerBuilder, header, isInheritErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, noErrorHandler, outBody, outBody, setContext, systemProperty, systemProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RouteBuilder

public RouteBuilder()

RouteBuilder

public RouteBuilder(CamelContext context)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

configure

public abstract void configure()
                        throws Exception
Called on initialization to to build the required destinationBuilders

Throws:
Exception

from

public RouteType from(String uri)
Creates a new route from the given URI input


from

public RouteType from(Endpoint endpoint)
Creates a new route from the given endpoint


errorHandler

public RouteBuilder 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

inheritErrorHandler

public RouteBuilder inheritErrorHandler(boolean value)
Configures whether or not the error handler is inherited by every processing node (or just the top most one)

Parameters:
value - the flag as to whether error handlers should be inherited or not
Returns:
the current builder

intercept

public RouteBuilder intercept(DelegateProcessor interceptor)
Adds the given interceptor to this route


intercept

public InterceptType intercept()
Adds a route for an interceptor; use the ProcessorType.proceed() method to continue processing the underlying route being intercepted.


intercept

public ChoiceType intercept(Predicate predicate)
Applies a route for an interceptor if the given predicate is true otherwise the interceptor route is not applied


exception

public ExceptionType exception(Class exceptionType)
Adds an exception handler route for the given exception type


getContext

public CamelContext getContext()
Overrides:
getContext in class BuilderSupport

getRouteList

public List<Route> getRouteList()
                         throws Exception
Returns the routing map from inbound endpoints to processors

Throws:
Exception

setInheritErrorHandler

public void setInheritErrorHandler(boolean inheritErrorHandler)
Overrides:
setInheritErrorHandler in class BuilderSupport

setErrorHandlerBuilder

public void setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder)
Description copied from class: BuilderSupport
Sets the error handler to use with processors created by this builder

Overrides:
setErrorHandlerBuilder in class BuilderSupport

checkInitialized

protected void checkInitialized()
                         throws Exception
Throws:
Exception

populateRoutes

protected void populateRoutes(List<Route> routes)
                       throws Exception
Throws:
Exception

setRouteCollection

public void setRouteCollection(RoutesType routeCollection)

getRouteCollection

public RoutesType getRouteCollection()

noStreamCaching

public void noStreamCaching()
Completely disable stream caching for all routes being defined in the same RouteBuilder after this.


streamCaching

public void streamCaching()
Enable stream caching for all routes being defined in the same RouteBuilder after this call.


createContainer

protected CamelContext createContainer()
Factory method


configureRoute

protected void configureRoute(RouteType route)


Copyright © 2008 IONA Open Source Community. All Rights Reserved.