org.apache.camel.impl
Class CamelPostProcessorHelper

java.lang.Object
  extended by org.apache.camel.impl.CamelPostProcessorHelper
All Implemented Interfaces:
CamelContextAware

public class CamelPostProcessorHelper
extends Object
implements CamelContextAware

A helper class for Camel based injector or post processing hooks which can be reused by both the Spring, Guice and Blueprint support.

Version:

Constructor Summary
CamelPostProcessorHelper()
           
CamelPostProcessorHelper(CamelContext camelContext)
           
 
Method Summary
 void consumerInjection(Method method, Object bean, String beanName)
           
protected  Processor createConsumerProcessor(Object pojo, Method method, Endpoint endpoint)
          Create a processor which invokes the given method when an incoming message exchange is received
protected  ConsumerTemplate createInjectionConsumerTemplate(String endpointUri, String endpointRef, String injectionPointName)
          Factory method to create a ConsumerTemplate to be injected into a POJO
protected  PollingConsumer createInjectionPollingConsumer(Endpoint endpoint, Object bean, String beanName)
          Factory method to create a started PollingConsumer to be injected into a POJO
protected  Producer createInjectionProducer(Endpoint endpoint, Object bean, String beanName)
          A Factory method to create a started Producer to be injected into a POJO
protected  ProducerTemplate createInjectionProducerTemplate(String endpointUri, String endpointRef, String injectionPointName)
          Factory method to create a ProducerTemplate to be injected into a POJO
protected  RuntimeException createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, Exception e)
           
 CamelContext getCamelContext()
          Get the CamelContext
protected  Endpoint getEndpointInjection(String uri, String name, String injectionPointName, boolean mandatory)
           
 Object getInjectionValue(Class<?> type, String endpointUri, String endpointRef, String injectionPointName, Object bean, String beanName)
          Creates the object to be injected for an EndpointInject or Produce injection point
protected  boolean isSingleton(Object bean, String beanName)
          Implementations can override this method to determine if the bean is singleton.
 boolean matchContext(String context)
          Does the given context match this camel context
 void setCamelContext(CamelContext camelContext)
          Injects the CamelContext
protected  void startService(Service service, Object bean, String beanName)
          Stats the given service
 void subscribeMethod(Method method, Object bean, String beanName, String endpointUri, String endpointName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamelPostProcessorHelper

public CamelPostProcessorHelper()

CamelPostProcessorHelper

public CamelPostProcessorHelper(CamelContext camelContext)
Method Detail

getCamelContext

public CamelContext getCamelContext()
Description copied from interface: CamelContextAware
Get the CamelContext

Specified by:
getCamelContext in interface CamelContextAware
Returns:
camelContext the Camel context

setCamelContext

public void setCamelContext(CamelContext camelContext)
Description copied from interface: CamelContextAware
Injects the CamelContext

Specified by:
setCamelContext in interface CamelContextAware
Parameters:
camelContext - the Camel context

matchContext

public boolean matchContext(String context)
Does the given context match this camel context


consumerInjection

public void consumerInjection(Method method,
                              Object bean,
                              String beanName)

subscribeMethod

public void subscribeMethod(Method method,
                            Object bean,
                            String beanName,
                            String endpointUri,
                            String endpointName)

startService

protected void startService(Service service,
                            Object bean,
                            String beanName)
                     throws Exception
Stats the given service

Throws:
Exception

createConsumerProcessor

protected Processor createConsumerProcessor(Object pojo,
                                            Method method,
                                            Endpoint endpoint)
Create a processor which invokes the given method when an incoming message exchange is received


getEndpointInjection

protected Endpoint getEndpointInjection(String uri,
                                        String name,
                                        String injectionPointName,
                                        boolean mandatory)

getInjectionValue

public Object getInjectionValue(Class<?> type,
                                String endpointUri,
                                String endpointRef,
                                String injectionPointName,
                                Object bean,
                                String beanName)
Creates the object to be injected for an EndpointInject or Produce injection point


createInjectionProducerTemplate

protected ProducerTemplate createInjectionProducerTemplate(String endpointUri,
                                                           String endpointRef,
                                                           String injectionPointName)
Factory method to create a ProducerTemplate to be injected into a POJO


createInjectionConsumerTemplate

protected ConsumerTemplate createInjectionConsumerTemplate(String endpointUri,
                                                           String endpointRef,
                                                           String injectionPointName)
Factory method to create a ConsumerTemplate to be injected into a POJO


createInjectionPollingConsumer

protected PollingConsumer createInjectionPollingConsumer(Endpoint endpoint,
                                                         Object bean,
                                                         String beanName)
Factory method to create a started PollingConsumer to be injected into a POJO


createInjectionProducer

protected Producer createInjectionProducer(Endpoint endpoint,
                                           Object bean,
                                           String beanName)
A Factory method to create a started Producer to be injected into a POJO


createProxyInstantiationRuntimeException

protected RuntimeException createProxyInstantiationRuntimeException(Class<?> type,
                                                                    Endpoint endpoint,
                                                                    Exception e)

isSingleton

protected boolean isSingleton(Object bean,
                              String beanName)
Implementations can override this method to determine if the bean is singleton.

Parameters:
bean - the bean
Returns:
true if its singleton scoped, for prototype scoped false is returned.


Apache CAMEL