org.apache.camel.spring
Class CamelBeanPostProcessor

java.lang.Object
  extended by org.apache.camel.spring.CamelBeanPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.context.ApplicationContextAware

public class CamelBeanPostProcessor
extends Object
implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.context.ApplicationContextAware

A bean post processor which implements the Bean Integration features in Camel. Features such as the Bean Injection of objects like Endpoint and ProducerTemplate together with support for POJO Consuming via the Consume annotation along with POJO Producing via the Produce annotation along with other annotations such as DynamicRouter for creating a Dynamic router via annotations. RecipientList for creating a Recipient List router via annotations. RoutingSlip for creating a Routing Slip router via annotations.

If you use the <camelContext> element in your Spring XML then one of these bean post processors is implicitly installed and configured for you. So you should never have to explicitly create or configure one of these instances.

Version:

Constructor Summary
CamelBeanPostProcessor()
           
 
Method Summary
protected  boolean canPostProcessBean(Object bean, String beanName)
          Can we post process the given bean?
protected  boolean canSetCamelContext(Object bean, String beanName)
           
 org.apache.camel.CamelContext getCamelContext()
           
 String getCamelId()
           
protected  org.apache.camel.CamelContext getOrLookupCamelContext()
           
 org.apache.camel.impl.CamelPostProcessorHelper getPostProcessor()
           
protected  void injectField(Field field, String endpointUri, String endpointRef, Object bean, String beanName)
           
protected  void injectFields(Object bean, String beanName)
          A strategy method to allow implementations to perform some custom JBI based injection of the POJO
protected  void injectMethods(Object bean, String beanName)
           
 Object postProcessAfterInitialization(Object bean, String beanName)
           
 Object postProcessBeforeInitialization(Object bean, String beanName)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setCamelContext(org.apache.camel.CamelContext camelContext)
           
 void setCamelId(String camelId)
           
protected  void setterInjection(Method method, Object bean, String beanName)
           
protected  void setterInjection(Method method, Object bean, String beanName, String endpointUri, String endpointRef)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamelBeanPostProcessor

public CamelBeanPostProcessor()
Method Detail

postProcessBeforeInitialization

public Object postProcessBeforeInitialization(Object bean,
                                              String beanName)
                                       throws org.springframework.beans.BeansException
Specified by:
postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
Throws:
org.springframework.beans.BeansException

postProcessAfterInitialization

public Object postProcessAfterInitialization(Object bean,
                                             String beanName)
                                      throws org.springframework.beans.BeansException
Specified by:
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
Throws:
org.springframework.beans.BeansException

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getCamelContext

public org.apache.camel.CamelContext getCamelContext()

setCamelContext

public void setCamelContext(org.apache.camel.CamelContext camelContext)

getCamelId

public String getCamelId()

setCamelId

public void setCamelId(String camelId)

canPostProcessBean

protected boolean canPostProcessBean(Object bean,
                                     String beanName)
Can we post process the given bean?

Parameters:
bean - the bean
beanName - the bean name
Returns:
true to process it

canSetCamelContext

protected boolean canSetCamelContext(Object bean,
                                     String beanName)

injectFields

protected void injectFields(Object bean,
                            String beanName)
A strategy method to allow implementations to perform some custom JBI based injection of the POJO

Parameters:
bean - the bean to be injected

injectField

protected void injectField(Field field,
                           String endpointUri,
                           String endpointRef,
                           Object bean,
                           String beanName)

injectMethods

protected void injectMethods(Object bean,
                             String beanName)

setterInjection

protected void setterInjection(Method method,
                               Object bean,
                               String beanName)

setterInjection

protected void setterInjection(Method method,
                               Object bean,
                               String beanName,
                               String endpointUri,
                               String endpointRef)

getOrLookupCamelContext

protected org.apache.camel.CamelContext getOrLookupCamelContext()

getPostProcessor

public org.apache.camel.impl.CamelPostProcessorHelper getPostProcessor()


Apache CAMEL