org.apache.camel.spring
Class CamelBeanPostProcessor

java.lang.Object
  extended by org.apache.camel.spring.CamelBeanPostProcessor
All Implemented Interfaces:
BeanPostProcessor, ApplicationContextAware

public class CamelBeanPostProcessor
extends Object
implements BeanPostProcessor, ApplicationContextAware

A bean post processor which implements the Bean Integration features in Camel such as the Bean Injection of objects like Endpoint and ProducerTemplate together with support for POJO Consuming via the Consume and MessageDriven annotations along with POJO Producing via the Produce annotation along with other annotations such as RecipientList for creating a Recipient List 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:
$Revision: 800394 $

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)
           
protected  void consumerInjection(Object bean)
           
 SpringCamelContext getCamelContext()
           
 String getCamelId()
           
 CamelPostProcessorHelper getPostProcessor()
           
protected  void injectField(Field field, String endpointUri, String endpointRef, Object bean)
           
protected  void injectFields(Object bean)
          A strategy method to allow implementations to perform some custom JBI based injection of the POJO
protected  void injectMethods(Object bean)
           
 Object postProcessAfterInitialization(Object bean, String beanName)
           
 Object postProcessBeforeInitialization(Object bean, String beanName)
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setCamelContext(SpringCamelContext camelContext)
           
 void setCamelId(String camelId)
           
protected  void setterInjection(Method method, Object bean)
           
protected  void setterInjection(Method method, Object bean, 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 BeansException
Specified by:
postProcessBeforeInitialization in interface BeanPostProcessor
Throws:
BeansException

postProcessAfterInitialization

public Object postProcessAfterInitialization(Object bean,
                                             String beanName)
                                      throws BeansException
Specified by:
postProcessAfterInitialization in interface BeanPostProcessor
Throws:
BeansException

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

getCamelContext

public SpringCamelContext getCamelContext()

setCamelContext

public void setCamelContext(SpringCamelContext 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)
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)

injectMethods

protected void injectMethods(Object bean)

setterInjection

protected void setterInjection(Method method,
                               Object bean)

setterInjection

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

consumerInjection

protected void consumerInjection(Object bean)

getPostProcessor

public CamelPostProcessorHelper getPostProcessor()


Apache CAMEL