org.apache.camel.impl
Class DefaultCamelBeanPostProcessor

java.lang.Object
  extended by org.apache.camel.impl.DefaultCamelBeanPostProcessor

public class DefaultCamelBeanPostProcessor
extends Object

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.

Components such as camel-spring, and camel-blueprint can leverage this post processor to hook in Camel bean post processing into their bean processing framework.


Field Summary
protected  CamelContext camelContext
           
protected  CamelPostProcessorHelper camelPostProcessorHelper
           
protected static org.slf4j.Logger LOG
           
 
Constructor Summary
DefaultCamelBeanPostProcessor()
           
DefaultCamelBeanPostProcessor(CamelContext camelContext)
           
 
Method Summary
protected  boolean canPostProcessBean(Object bean, String beanName)
           
protected  boolean canSetCamelContext(Object bean, String beanName)
           
 CamelContext getOrLookupCamelContext()
          Strategy to get the CamelContext to use.
protected  CamelPostProcessorHelper getPostProcessorHelper()
          Strategy to get the CamelPostProcessorHelper
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)
          Apply this post processor to the given new bean instance after any bean initialization callbacks (like afterPropertiesSet or a custom init-method).
 Object postProcessBeforeInitialization(Object bean, String beanName)
          Apply this post processor to the given new bean instance before any bean initialization callbacks (like afterPropertiesSet or a custom init-method).
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
 

Field Detail

LOG

protected static final transient org.slf4j.Logger LOG

camelPostProcessorHelper

protected CamelPostProcessorHelper camelPostProcessorHelper

camelContext

protected CamelContext camelContext
Constructor Detail

DefaultCamelBeanPostProcessor

public DefaultCamelBeanPostProcessor()

DefaultCamelBeanPostProcessor

public DefaultCamelBeanPostProcessor(CamelContext camelContext)
Method Detail

postProcessBeforeInitialization

public Object postProcessBeforeInitialization(Object bean,
                                              String beanName)
                                       throws Exception
Apply this post processor to the given new bean instance before any bean initialization callbacks (like afterPropertiesSet or a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.

Parameters:
bean - the new bean instance
beanName - the name of the bean
Returns:
the bean instance to use, either the original or a wrapped one; if null, no subsequent BeanPostProcessors will be invoked
Throws:
Exception - is thrown if error post processing bean

postProcessAfterInitialization

public Object postProcessAfterInitialization(Object bean,
                                             String beanName)
                                      throws Exception
Apply this post processor to the given new bean instance after any bean initialization callbacks (like afterPropertiesSet or a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.

Parameters:
bean - the new bean instance
beanName - the name of the bean
Returns:
the bean instance to use, either the original or a wrapped one; if null, no subsequent BeanPostProcessors will be invoked
Throws:
Exception - is thrown if error post processing bean

getOrLookupCamelContext

public CamelContext getOrLookupCamelContext()
Strategy to get the CamelContext to use.


getPostProcessorHelper

protected CamelPostProcessorHelper getPostProcessorHelper()
Strategy to get the CamelPostProcessorHelper


canPostProcessBean

protected boolean canPostProcessBean(Object bean,
                                     String beanName)

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)


Apache CAMEL