org.apache.camel.spring
Class SpringRouteBuilder

java.lang.Object
  extended by org.apache.camel.builder.BuilderSupport
      extended by org.apache.camel.builder.RouteBuilder
          extended by org.apache.camel.spring.SpringRouteBuilder
All Implemented Interfaces:
Routes, ApplicationContextAware

public abstract class SpringRouteBuilder
extends RouteBuilder
implements ApplicationContextAware

An extension of the RouteBuilder to provide some additional helper methods

Version:
$Revision: 750767 $

Constructor Summary
SpringRouteBuilder()
           
 
Method Summary
<T> T
bean(Class<T> type)
          Looks up the bean with the given type in the application context and returns it, or throws an exception if the bean is not present or there are multiple possible beans to choose from for the given type
<T> T
bean(Class<T> type, String beanName)
          Looks up the bean with the given name in the application context and returns it, or throws an exception if the bean is not present or is not of the given type
 ApplicationContext getApplicationContext()
          Returns the application context which has been configured via the setApplicationContext(ApplicationContext) method or from the underlying SpringCamelContext
 void setApplicationContext(ApplicationContext applicationContext)
          Sets the application context to use to lookup beans
 TransactionErrorHandlerBuilder transactionErrorHandler(SpringTransactionPolicy policy)
          Creates a transaction error handler.
 TransactionInterceptor transactionInterceptor()
           
 
Methods inherited from class org.apache.camel.builder.RouteBuilder
addRoutes, checkInitialized, configure, configureRoute, createContainer, errorHandler, exception, from, from, getContext, getRouteCollection, getRouteList, inheritErrorHandler, intercept, intercept, intercept, noStreamCaching, onException, onException, populateRoutes, setErrorHandlerBuilder, setInheritErrorHandler, setRouteCollection, streamCaching, 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, regexReplaceAll, regexReplaceAll, setContext, systemProperty, systemProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Routes
setContext
 

Constructor Detail

SpringRouteBuilder

public SpringRouteBuilder()
Method Detail

transactionInterceptor

public TransactionInterceptor transactionInterceptor()

bean

public <T> T bean(Class<T> type,
                  String beanName)
Looks up the bean with the given name in the application context and returns it, or throws an exception if the bean is not present or is not of the given type

Parameters:
type - the type of the bean
beanName - the name of the bean in the application context
Returns:
the bean

bean

public <T> T bean(Class<T> type)
Looks up the bean with the given type in the application context and returns it, or throws an exception if the bean is not present or there are multiple possible beans to choose from for the given type

Parameters:
type - the type of the bean
Returns:
the bean

getApplicationContext

public ApplicationContext getApplicationContext()
Returns the application context which has been configured via the setApplicationContext(ApplicationContext) method or from the underlying SpringCamelContext


setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
Sets the application context to use to lookup beans

Specified by:
setApplicationContext in interface ApplicationContextAware

transactionErrorHandler

public TransactionErrorHandlerBuilder transactionErrorHandler(SpringTransactionPolicy policy)
Creates a transaction error handler.

Parameters:
policy - using this transaction policy (eg: required, supports, ...)
Returns:
the created error handler


Copyright © 2009 Apache Software Foundation. All Rights Reserved.