org.apache.camel.spring
Class CamelContextFactoryBean

java.lang.Object
  extended by org.apache.camel.model.IdentifiedType
      extended by org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>
          extended by org.apache.camel.spring.CamelContextFactoryBean
All Implemented Interfaces:
EventListener, org.apache.camel.model.RouteContainer, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<SpringCamelContext>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
Direct Known Subclasses:
CamelContextFactoryBean

public class CamelContextFactoryBean
extends org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>
implements org.springframework.beans.factory.FactoryBean<SpringCamelContext>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>

A Spring FactoryBean to create and initialize a SpringCamelContext and install routes either explicitly configured in Spring XML or found by searching the classpath for Java classes which extend RouteBuilder using the nested setPackages(String[]).

Version:

Field Summary
 
Fields inherited from class org.apache.camel.core.xml.AbstractCamelContextFactoryBean
LAZY_LOAD_TYPE_CONVERTERS
 
Constructor Summary
CamelContextFactoryBean()
           
 
Method Summary
protected  SpringCamelContext createContext()
          Create the context
protected  void findRouteBuildersByContextScan(org.apache.camel.spi.PackageScanFilter filter, List<org.apache.camel.RoutesBuilder> builders)
           
protected  void findRouteBuildersByPackageScan(String[] packages, org.apache.camel.spi.PackageScanFilter filter, List<org.apache.camel.RoutesBuilder> builders)
           
 org.springframework.context.ApplicationContext getApplicationContext()
           
 String getAutoStartup()
           
protected
<S> S
getBeanForType(Class<S> clazz)
           
 org.springframework.beans.factory.config.BeanPostProcessor getBeanPostProcessor()
           
 List<org.apache.camel.model.RouteBuilderDefinition> getBuilderRefs()
           
 org.apache.camel.core.xml.CamelJMXAgentDefinition getCamelJMXAgent()
           
 org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder()
           
 SpringCamelContext getContext(boolean create)
           
 org.apache.camel.model.ContextScanDefinition getContextScan()
           
 org.apache.camel.model.dataformat.DataFormatsDefinition getDataFormats()
           
 String getDelayer()
           
 String getDependsOn()
           
 List<CamelEndpointFactoryBean> getEndpoints()
           
 String getErrorHandlerRef()
           
 String getHandleFault()
           
 List<org.apache.camel.model.InterceptFromDefinition> getInterceptFroms()
           
 List<org.apache.camel.model.InterceptDefinition> getIntercepts()
           
 List<org.apache.camel.model.InterceptSendToEndpointDefinition> getInterceptSendToEndpoints()
           
 Boolean getLazyLoadTypeConverters()
          Deprecated. 
 String getManagementNamePattern()
           
 Class<SpringCamelContext> getObjectType()
           
 List<org.apache.camel.model.OnCompletionDefinition> getOnCompletions()
           
 List<org.apache.camel.model.OnExceptionDefinition> getOnExceptions()
           
 String[] getPackages()
           
 org.apache.camel.model.PackageScanDefinition getPackageScan()
           
 org.apache.camel.model.config.PropertiesDefinition getProperties()
           
 List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies()
           
 List<org.apache.camel.model.RouteContextRefDefinition> getRouteRefs()
           
 List<org.apache.camel.model.RouteDefinition> getRoutes()
           
 org.apache.camel.ShutdownRoute getShutdownRoute()
           
 org.apache.camel.ShutdownRunningTask getShutdownRunningTask()
           
 String getStreamCache()
           
 List<org.apache.camel.model.ThreadPoolProfileDefinition> getThreadPoolProfiles()
           
 String getTrace()
           
 Boolean getTypeConverterStatisticsEnabled()
           
 String getUseBreadcrumb()
           
 String getUseMDCLogging()
           
protected  void initBeanPostProcessor(SpringCamelContext context)
           
protected  void initCustomRegistry(SpringCamelContext context)
           
protected  void initPropertyPlaceholder()
           
 boolean isImplicitId()
           
protected  SpringCamelContext newCamelContext()
           
 void onApplicationEvent(org.springframework.context.ApplicationEvent event)
           
protected  void postProcessBeforeInit(org.apache.camel.builder.RouteBuilder builder)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setAutoStartup(String autoStartup)
           
 void setBeanPostProcessor(org.springframework.beans.factory.config.BeanPostProcessor postProcessor)
           
 void setBuilderRefs(List<org.apache.camel.model.RouteBuilderDefinition> builderRefs)
           
 void setCamelJMXAgent(org.apache.camel.core.xml.CamelJMXAgentDefinition agent)
           
 void setCamelPropertyPlaceholder(org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition camelPropertyPlaceholder)
           
 void setContext(SpringCamelContext context)
           
 void setContextScan(org.apache.camel.model.ContextScanDefinition contextScan)
          Sets the context scanning (eg Spring's ApplicationContext) information.
 void setDataFormats(org.apache.camel.model.dataformat.DataFormatsDefinition dataFormats)
           
 void setDelayer(String delayer)
           
 void setDependsOn(String dependsOn)
           
 void setErrorHandlerRef(String errorHandlerRef)
          Sets the name of the error handler object used to default the error handling strategy
 void setHandleFault(String handleFault)
           
 void setImplicitId(boolean flag)
           
 void setInterceptFroms(List<org.apache.camel.model.InterceptFromDefinition> interceptFroms)
           
 void setIntercepts(List<org.apache.camel.model.InterceptDefinition> intercepts)
           
 void setInterceptSendToEndpoints(List<org.apache.camel.model.InterceptSendToEndpointDefinition> interceptSendToEndpoints)
           
 void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters)
          Deprecated. 
 void setManagementNamePattern(String managementNamePattern)
           
 void setOnCompletions(List<org.apache.camel.model.OnCompletionDefinition> onCompletions)
           
 void setOnExceptions(List<org.apache.camel.model.OnExceptionDefinition> onExceptions)
           
 void setPackages(String[] packages)
          Sets the package names to be recursively searched for Java classes which extend RouteBuilder to be auto-wired up to the CamelContext as a route.
 void setPackageScan(org.apache.camel.model.PackageScanDefinition packageScan)
          Sets the package scanning information.
 void setProperties(org.apache.camel.model.config.PropertiesDefinition properties)
           
 void setRouteRefs(List<org.apache.camel.model.RouteContextRefDefinition> routeRefs)
           
 void setRoutes(List<org.apache.camel.model.RouteDefinition> routes)
           
 void setShutdownRoute(org.apache.camel.ShutdownRoute shutdownRoute)
           
 void setShutdownRunningTask(org.apache.camel.ShutdownRunningTask shutdownRunningTask)
           
 void setStreamCache(String streamCache)
           
 void setThreadPoolProfiles(List<org.apache.camel.model.ThreadPoolProfileDefinition> threadPoolProfiles)
           
 void setTrace(String trace)
           
 void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled)
           
 void setUseBreadcrumb(String useBreadcrumb)
           
 void setUseMDCLogging(String useMDCLogging)
           
 
Methods inherited from class org.apache.camel.core.xml.AbstractCamelContextFactoryBean
afterPropertiesSet, destroy, findRouteBuilders, getContext, getContextClassLoaderOnStart, getObject, initCamelContext, initJMXAgent, initLazyLoadTypeConverteres, initRouteRefs, initThreadPoolProfiles, installRoutes, isSingleton
 
Methods inherited from class org.apache.camel.model.IdentifiedType
getId, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.factory.FactoryBean
getObject, isSingleton
 
Methods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
 
Methods inherited from interface org.springframework.beans.factory.DisposableBean
destroy
 

Constructor Detail

CamelContextFactoryBean

public CamelContextFactoryBean()
Method Detail

getObjectType

public Class<SpringCamelContext> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<SpringCamelContext>
Specified by:
getObjectType in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

getBeanForType

protected <S> S getBeanForType(Class<S> clazz)
Specified by:
getBeanForType in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

findRouteBuildersByPackageScan

protected void findRouteBuildersByPackageScan(String[] packages,
                                              org.apache.camel.spi.PackageScanFilter filter,
                                              List<org.apache.camel.RoutesBuilder> builders)
                                       throws Exception
Specified by:
findRouteBuildersByPackageScan in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>
Throws:
Exception

findRouteBuildersByContextScan

protected void findRouteBuildersByContextScan(org.apache.camel.spi.PackageScanFilter filter,
                                              List<org.apache.camel.RoutesBuilder> builders)
                                       throws Exception
Specified by:
findRouteBuildersByContextScan in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>
Throws:
Exception

initBeanPostProcessor

protected void initBeanPostProcessor(SpringCamelContext context)
Specified by:
initBeanPostProcessor in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

postProcessBeforeInit

protected void postProcessBeforeInit(org.apache.camel.builder.RouteBuilder builder)
Specified by:
postProcessBeforeInit in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

initCustomRegistry

protected void initCustomRegistry(SpringCamelContext context)
Specified by:
initCustomRegistry in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

initPropertyPlaceholder

protected void initPropertyPlaceholder()
                                throws Exception
Overrides:
initPropertyPlaceholder in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>
Throws:
Exception

onApplicationEvent

public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()

setApplicationContext

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

setBeanPostProcessor

public void setBeanPostProcessor(org.springframework.beans.factory.config.BeanPostProcessor postProcessor)

getBeanPostProcessor

public org.springframework.beans.factory.config.BeanPostProcessor getBeanPostProcessor()

createContext

protected SpringCamelContext createContext()
Create the context


newCamelContext

protected SpringCamelContext newCamelContext()

getContext

public SpringCamelContext getContext(boolean create)
Specified by:
getContext in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setContext

public void setContext(SpringCamelContext context)

getRoutes

public List<org.apache.camel.model.RouteDefinition> getRoutes()
Specified by:
getRoutes in interface org.apache.camel.model.RouteContainer
Specified by:
getRoutes in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setRoutes

public void setRoutes(List<org.apache.camel.model.RouteDefinition> routes)
Specified by:
setRoutes in interface org.apache.camel.model.RouteContainer

getEndpoints

public List<CamelEndpointFactoryBean> getEndpoints()
Specified by:
getEndpoints in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

getRedeliveryPolicies

public List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies()
Specified by:
getRedeliveryPolicies in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

getIntercepts

public List<org.apache.camel.model.InterceptDefinition> getIntercepts()
Specified by:
getIntercepts in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setIntercepts

public void setIntercepts(List<org.apache.camel.model.InterceptDefinition> intercepts)

getInterceptFroms

public List<org.apache.camel.model.InterceptFromDefinition> getInterceptFroms()
Specified by:
getInterceptFroms in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setInterceptFroms

public void setInterceptFroms(List<org.apache.camel.model.InterceptFromDefinition> interceptFroms)

getInterceptSendToEndpoints

public List<org.apache.camel.model.InterceptSendToEndpointDefinition> getInterceptSendToEndpoints()
Specified by:
getInterceptSendToEndpoints in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setInterceptSendToEndpoints

public void setInterceptSendToEndpoints(List<org.apache.camel.model.InterceptSendToEndpointDefinition> interceptSendToEndpoints)

getProperties

public org.apache.camel.model.config.PropertiesDefinition getProperties()
Specified by:
getProperties in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setProperties

public void setProperties(org.apache.camel.model.config.PropertiesDefinition properties)

getPackages

public String[] getPackages()
Specified by:
getPackages in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setPackages

public void setPackages(String[] packages)
Sets the package names to be recursively searched for Java classes which extend RouteBuilder to be auto-wired up to the CamelContext as a route. Note that classes are excluded if they are specifically configured in the spring.xml

A more advanced configuration can be done using setPackageScan(org.apache.camel.model.PackageScanDefinition)

Parameters:
packages - the package names which are recursively searched
See Also:
setPackageScan(org.apache.camel.model.PackageScanDefinition)

getPackageScan

public org.apache.camel.model.PackageScanDefinition getPackageScan()
Specified by:
getPackageScan in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setPackageScan

public void setPackageScan(org.apache.camel.model.PackageScanDefinition packageScan)
Sets the package scanning information. Package scanning allows for the automatic discovery of certain camel classes at runtime for inclusion e.g. RouteBuilder implementations

Specified by:
setPackageScan in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>
Parameters:
packageScan - the package scan

getContextScan

public org.apache.camel.model.ContextScanDefinition getContextScan()
Specified by:
getContextScan in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setContextScan

public void setContextScan(org.apache.camel.model.ContextScanDefinition contextScan)
Sets the context scanning (eg Spring's ApplicationContext) information. Context scanning allows for the automatic discovery of Camel routes runtime for inclusion e.g. RouteBuilder implementations

Specified by:
setContextScan in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>
Parameters:
contextScan - the context scan

getCamelPropertyPlaceholder

public org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder()
Specified by:
getCamelPropertyPlaceholder in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setCamelPropertyPlaceholder

public void setCamelPropertyPlaceholder(org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition camelPropertyPlaceholder)

setCamelJMXAgent

public void setCamelJMXAgent(org.apache.camel.core.xml.CamelJMXAgentDefinition agent)

getTrace

public String getTrace()
Specified by:
getTrace in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setTrace

public void setTrace(String trace)

getStreamCache

public String getStreamCache()
Specified by:
getStreamCache in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setStreamCache

public void setStreamCache(String streamCache)

getDelayer

public String getDelayer()
Specified by:
getDelayer in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setDelayer

public void setDelayer(String delayer)

getHandleFault

public String getHandleFault()
Specified by:
getHandleFault in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setHandleFault

public void setHandleFault(String handleFault)

getAutoStartup

public String getAutoStartup()
Specified by:
getAutoStartup in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setAutoStartup

public void setAutoStartup(String autoStartup)

getUseMDCLogging

public String getUseMDCLogging()
Specified by:
getUseMDCLogging in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setUseMDCLogging

public void setUseMDCLogging(String useMDCLogging)

getUseBreadcrumb

public String getUseBreadcrumb()
Specified by:
getUseBreadcrumb in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setUseBreadcrumb

public void setUseBreadcrumb(String useBreadcrumb)

getManagementNamePattern

public String getManagementNamePattern()
Specified by:
getManagementNamePattern in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setManagementNamePattern

public void setManagementNamePattern(String managementNamePattern)

getLazyLoadTypeConverters

@Deprecated
public Boolean getLazyLoadTypeConverters()
Deprecated. 

Specified by:
getLazyLoadTypeConverters in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setLazyLoadTypeConverters

@Deprecated
public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters)
Deprecated. 


getTypeConverterStatisticsEnabled

public Boolean getTypeConverterStatisticsEnabled()
Specified by:
getTypeConverterStatisticsEnabled in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setTypeConverterStatisticsEnabled

public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled)

getCamelJMXAgent

public org.apache.camel.core.xml.CamelJMXAgentDefinition getCamelJMXAgent()
Specified by:
getCamelJMXAgent in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

getBuilderRefs

public List<org.apache.camel.model.RouteBuilderDefinition> getBuilderRefs()
Specified by:
getBuilderRefs in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setBuilderRefs

public void setBuilderRefs(List<org.apache.camel.model.RouteBuilderDefinition> builderRefs)

getRouteRefs

public List<org.apache.camel.model.RouteContextRefDefinition> getRouteRefs()
Specified by:
getRouteRefs in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setRouteRefs

public void setRouteRefs(List<org.apache.camel.model.RouteContextRefDefinition> routeRefs)

getErrorHandlerRef

public String getErrorHandlerRef()
Specified by:
getErrorHandlerRef in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setErrorHandlerRef

public void setErrorHandlerRef(String errorHandlerRef)
Sets the name of the error handler object used to default the error handling strategy

Parameters:
errorHandlerRef - the Spring bean ref of the error handler

setDataFormats

public void setDataFormats(org.apache.camel.model.dataformat.DataFormatsDefinition dataFormats)

getDataFormats

public org.apache.camel.model.dataformat.DataFormatsDefinition getDataFormats()
Specified by:
getDataFormats in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setOnExceptions

public void setOnExceptions(List<org.apache.camel.model.OnExceptionDefinition> onExceptions)

getOnExceptions

public List<org.apache.camel.model.OnExceptionDefinition> getOnExceptions()
Specified by:
getOnExceptions in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

getOnCompletions

public List<org.apache.camel.model.OnCompletionDefinition> getOnCompletions()
Specified by:
getOnCompletions in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setOnCompletions

public void setOnCompletions(List<org.apache.camel.model.OnCompletionDefinition> onCompletions)

getShutdownRoute

public org.apache.camel.ShutdownRoute getShutdownRoute()
Specified by:
getShutdownRoute in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setShutdownRoute

public void setShutdownRoute(org.apache.camel.ShutdownRoute shutdownRoute)

getShutdownRunningTask

public org.apache.camel.ShutdownRunningTask getShutdownRunningTask()
Specified by:
getShutdownRunningTask in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setShutdownRunningTask

public void setShutdownRunningTask(org.apache.camel.ShutdownRunningTask shutdownRunningTask)

getThreadPoolProfiles

public List<org.apache.camel.model.ThreadPoolProfileDefinition> getThreadPoolProfiles()
Specified by:
getThreadPoolProfiles in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setThreadPoolProfiles

public void setThreadPoolProfiles(List<org.apache.camel.model.ThreadPoolProfileDefinition> threadPoolProfiles)

getDependsOn

public String getDependsOn()
Specified by:
getDependsOn in class org.apache.camel.core.xml.AbstractCamelContextFactoryBean<SpringCamelContext>

setDependsOn

public void setDependsOn(String dependsOn)

isImplicitId

public boolean isImplicitId()

setImplicitId

public void setImplicitId(boolean flag)


Apache CAMEL