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:
org.apache.camel.RoutesBuilder, org.springframework.context.ApplicationContextAware

public abstract class SpringRouteBuilder
extends org.apache.camel.builder.RouteBuilder
implements org.springframework.context.ApplicationContextAware

An extension of the RouteBuilder to provide some additional helper methods

Version:

Field Summary
 
Fields inherited from class org.apache.camel.builder.RouteBuilder
log
 
Constructor Summary
SpringRouteBuilder()
           
 
Method Summary
 org.springframework.context.ApplicationContext getApplicationContext()
          Returns the application context which has been configured via the setApplicationContext(ApplicationContext) method or from the underlying SpringCamelContext
<T> T
lookup(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
lookup(String beanName, Class<T> type)
          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
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
          Sets the application context to use to lookup beans
 TransactionErrorHandlerBuilder transactionErrorHandler()
          Creates a transaction error handler that will lookup in application context for an exiting transaction manager.
 TransactionErrorHandlerBuilder transactionErrorHandler(org.springframework.transaction.PlatformTransactionManager transactionManager)
          Creates a transaction error handler.
 TransactionErrorHandlerBuilder transactionErrorHandler(SpringTransactionPolicy policy)
          Creates a transaction error handler.
 TransactionErrorHandlerBuilder transactionErrorHandler(org.springframework.transaction.support.TransactionTemplate template)
          Creates a transaction error handler.
 
Methods inherited from class org.apache.camel.builder.RouteBuilder
addRoutes, addRoutesToCamelContext, checkInitialized, configure, configureRoute, configureRoutes, createContainer, errorHandler, from, from, from, from, fromF, getContext, getRouteCollection, includeRoutes, intercept, interceptFrom, interceptFrom, interceptSendToEndpoint, onCompletion, onException, onException, populateRoutes, setErrorHandlerBuilder, setRouteCollection, toString
 
Methods inherited from class org.apache.camel.builder.BuilderSupport
bean, bean, bean, bean, body, body, constant, createErrorHandlerBuilder, deadLetterChannel, deadLetterChannel, defaultErrorHandler, endpoint, endpoint, endpoints, endpoints, exceptionMessage, faultBody, faultBodyAs, getErrorHandlerBuilder, header, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, method, method, method, method, noErrorHandler, outBody, outBody, property, regexReplaceAll, regexReplaceAll, sendTo, setContext, setContext, simple, simple, systemProperty, systemProperty, xpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpringRouteBuilder

public SpringRouteBuilder()
Method Detail

lookup

public <T> T lookup(String beanName,
                    Class<T> type)
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:
beanName - the name of the bean in the application context
type - the type of the bean
Returns:
the bean

lookup

public <T> T lookup(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 org.springframework.context.ApplicationContext getApplicationContext()
Returns the application context which has been configured via the setApplicationContext(ApplicationContext) method or from the underlying SpringCamelContext


setApplicationContext

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

Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware

transactionErrorHandler

public TransactionErrorHandlerBuilder transactionErrorHandler()
Creates a transaction error handler that will lookup in application context for an exiting transaction manager.

Returns:
the created error handler

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

transactionErrorHandler

public TransactionErrorHandlerBuilder transactionErrorHandler(org.springframework.transaction.support.TransactionTemplate template)
Creates a transaction error handler.

Parameters:
template - the spring transaction template
Returns:
the created error handler

transactionErrorHandler

public TransactionErrorHandlerBuilder transactionErrorHandler(org.springframework.transaction.PlatformTransactionManager transactionManager)
Creates a transaction error handler.

Parameters:
transactionManager - the spring transaction manager
Returns:
the created error handler


Apache CAMEL