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, RouteContainer, DisposableBean, FactoryBean, InitializingBean, ApplicationContextAware, ApplicationListener
Direct Known Subclasses:
CamelContextFactoryBean

public class CamelContextFactoryBean
extends AbstractCamelContextFactoryBean<SpringCamelContext>
implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener

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:
$Revision: 954861 $

Constructor Summary
CamelContextFactoryBean()
           
 
Method Summary
protected  SpringCamelContext createContext()
          Create the context
protected  void findRouteBuildersByContextScan(PackageScanFilter filter, List<RoutesBuilder> builders)
           
protected  void findRouteBuildersByPackageScan(String[] packages, PackageScanFilter filter, List<RoutesBuilder> builders)
           
 ApplicationContext getApplicationContext()
           
 String getAutoStartup()
           
protected
<S> S
getBeanForType(Class<S> clazz)
           
 BeanPostProcessor getBeanPostProcessor()
           
 List<RouteBuilderDefinition> getBuilderRefs()
           
 CamelJMXAgentDefinition getCamelJMXAgent()
           
 CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder()
           
 SpringCamelContext getContext(boolean create)
           
 ContextScanDefinition getContextScan()
           
 DataFormatsDefinition getDataFormats()
           
 String getDelayer()
           
 String getDependsOn()
           
 String getErrorHandlerRef()
           
 String getHandleFault()
           
 List<InterceptFromDefinition> getInterceptFroms()
           
 List<InterceptDefinition> getIntercepts()
           
 List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints()
           
 Class getObjectType()
           
 List<OnCompletionDefinition> getOnCompletions()
           
 List<OnExceptionDefinition> getOnExceptions()
           
 String[] getPackages()
           
 PackageScanDefinition getPackageScan()
           
 PropertiesDefinition getProperties()
           
 List<RouteContextRefDefinition> getRouteRefs()
           
 List<RouteDefinition> getRoutes()
           
 ShutdownRoute getShutdownRoute()
           
 ShutdownRunningTask getShutdownRunningTask()
           
 String getStreamCache()
           
 List<ThreadPoolProfileDefinition> getThreadPoolProfiles()
           
 String getTrace()
           
protected  void initBeanPostProcessor(SpringCamelContext context)
           
protected  void initCustomRegistry(SpringCamelContext context)
           
protected  SpringCamelContext newCamelContext()
           
 void onApplicationEvent(ApplicationEvent event)
           
protected  void postProcessBeforeInit(RouteBuilder builder)
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setAutoStartup(String autoStartup)
           
 void setBeanPostProcessor(BeanPostProcessor postProcessor)
           
 void setBuilderRefs(List<RouteBuilderDefinition> builderRefs)
           
 void setCamelJMXAgent(CamelJMXAgentDefinition agent)
           
 void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder)
           
 void setContext(SpringCamelContext context)
           
 void setContextScan(ContextScanDefinition contextScan)
          Sets the context scanning (eg Spring's ApplicationContext) information.
 void setDataFormats(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 setInterceptFroms(List<InterceptFromDefinition> interceptFroms)
           
 void setIntercepts(List<InterceptDefinition> intercepts)
           
 void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints)
           
 void setOnCompletions(List<OnCompletionDefinition> onCompletions)
           
 void setOnExceptions(List<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(PackageScanDefinition packageScan)
          Sets the package scanning information.
 void setProperties(PropertiesDefinition properties)
           
 void setRouteRefs(List<RouteContextRefDefinition> routeRefs)
           
 void setRoutes(List<RouteDefinition> routes)
           
 void setShutdownRoute(ShutdownRoute shutdownRoute)
           
 void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask)
           
 void setStreamCache(String streamCache)
           
 void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles)
           
 void setTrace(String trace)
           
 
Methods inherited from class org.apache.camel.core.xml.AbstractCamelContextFactoryBean
afterPropertiesSet, destroy, findRouteBuilders, getContext, getContextClassLoaderOnStart, getObject, initCamelContext, 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 getObjectType()
Specified by:
getObjectType in interface FactoryBean
Overrides:
getObjectType in class AbstractCamelContextFactoryBean<SpringCamelContext>

getBeanForType

protected <S> S getBeanForType(Class<S> clazz)
Specified by:
getBeanForType in class AbstractCamelContextFactoryBean<SpringCamelContext>

findRouteBuildersByPackageScan

protected void findRouteBuildersByPackageScan(String[] packages,
                                              PackageScanFilter filter,
                                              List<RoutesBuilder> builders)
                                       throws Exception
Specified by:
findRouteBuildersByPackageScan in class AbstractCamelContextFactoryBean<SpringCamelContext>
Throws:
Exception

findRouteBuildersByContextScan

protected void findRouteBuildersByContextScan(PackageScanFilter filter,
                                              List<RoutesBuilder> builders)
                                       throws Exception
Specified by:
findRouteBuildersByContextScan in class AbstractCamelContextFactoryBean<SpringCamelContext>
Throws:
Exception

initBeanPostProcessor

protected void initBeanPostProcessor(SpringCamelContext context)
Specified by:
initBeanPostProcessor in class AbstractCamelContextFactoryBean<SpringCamelContext>

postProcessBeforeInit

protected void postProcessBeforeInit(RouteBuilder builder)
Specified by:
postProcessBeforeInit in class AbstractCamelContextFactoryBean<SpringCamelContext>

initCustomRegistry

protected void initCustomRegistry(SpringCamelContext context)
Specified by:
initCustomRegistry in class AbstractCamelContextFactoryBean<SpringCamelContext>

onApplicationEvent

public void onApplicationEvent(ApplicationEvent event)
Specified by:
onApplicationEvent in interface ApplicationListener

getApplicationContext

public ApplicationContext getApplicationContext()

setApplicationContext

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

setBeanPostProcessor

public void setBeanPostProcessor(BeanPostProcessor postProcessor)

getBeanPostProcessor

public BeanPostProcessor getBeanPostProcessor()

createContext

protected SpringCamelContext createContext()
Create the context


newCamelContext

protected SpringCamelContext newCamelContext()

getContext

public SpringCamelContext getContext(boolean create)
Specified by:
getContext in class AbstractCamelContextFactoryBean<SpringCamelContext>

setContext

public void setContext(SpringCamelContext context)

getRoutes

public List<RouteDefinition> getRoutes()
Specified by:
getRoutes in interface RouteContainer
Specified by:
getRoutes in class AbstractCamelContextFactoryBean<SpringCamelContext>

setRoutes

public void setRoutes(List<RouteDefinition> routes)
Specified by:
setRoutes in interface RouteContainer

getIntercepts

public List<InterceptDefinition> getIntercepts()
Specified by:
getIntercepts in class AbstractCamelContextFactoryBean<SpringCamelContext>

setIntercepts

public void setIntercepts(List<InterceptDefinition> intercepts)

getInterceptFroms

public List<InterceptFromDefinition> getInterceptFroms()
Specified by:
getInterceptFroms in class AbstractCamelContextFactoryBean<SpringCamelContext>

setInterceptFroms

public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms)

getInterceptSendToEndpoints

public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints()
Specified by:
getInterceptSendToEndpoints in class AbstractCamelContextFactoryBean<SpringCamelContext>

setInterceptSendToEndpoints

public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints)

getProperties

public PropertiesDefinition getProperties()
Specified by:
getProperties in class AbstractCamelContextFactoryBean<SpringCamelContext>

setProperties

public void setProperties(PropertiesDefinition properties)

getPackages

public String[] getPackages()
Specified by:
getPackages in class 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 PackageScanDefinition getPackageScan()
Specified by:
getPackageScan in class AbstractCamelContextFactoryBean<SpringCamelContext>

setPackageScan

public void setPackageScan(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 AbstractCamelContextFactoryBean<SpringCamelContext>
Parameters:
packageScan - the package scan

getContextScan

public ContextScanDefinition getContextScan()
Specified by:
getContextScan in class AbstractCamelContextFactoryBean<SpringCamelContext>

setContextScan

public void setContextScan(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 AbstractCamelContextFactoryBean<SpringCamelContext>
Parameters:
contextScan - the context scan

getCamelPropertyPlaceholder

public CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder()
Specified by:
getCamelPropertyPlaceholder in class AbstractCamelContextFactoryBean<SpringCamelContext>

setCamelPropertyPlaceholder

public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder)

setCamelJMXAgent

public void setCamelJMXAgent(CamelJMXAgentDefinition agent)

getTrace

public String getTrace()
Specified by:
getTrace in class AbstractCamelContextFactoryBean<SpringCamelContext>

setTrace

public void setTrace(String trace)

getStreamCache

public String getStreamCache()
Specified by:
getStreamCache in class AbstractCamelContextFactoryBean<SpringCamelContext>

setStreamCache

public void setStreamCache(String streamCache)

getDelayer

public String getDelayer()
Specified by:
getDelayer in class AbstractCamelContextFactoryBean<SpringCamelContext>

setDelayer

public void setDelayer(String delayer)

getHandleFault

public String getHandleFault()
Specified by:
getHandleFault in class AbstractCamelContextFactoryBean<SpringCamelContext>

setHandleFault

public void setHandleFault(String handleFault)

getAutoStartup

public String getAutoStartup()
Specified by:
getAutoStartup in class AbstractCamelContextFactoryBean<SpringCamelContext>

setAutoStartup

public void setAutoStartup(String autoStartup)

getCamelJMXAgent

public CamelJMXAgentDefinition getCamelJMXAgent()
Specified by:
getCamelJMXAgent in class AbstractCamelContextFactoryBean<SpringCamelContext>

getBuilderRefs

public List<RouteBuilderDefinition> getBuilderRefs()
Specified by:
getBuilderRefs in class AbstractCamelContextFactoryBean<SpringCamelContext>

setBuilderRefs

public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs)

getRouteRefs

public List<RouteContextRefDefinition> getRouteRefs()
Specified by:
getRouteRefs in class AbstractCamelContextFactoryBean<SpringCamelContext>

setRouteRefs

public void setRouteRefs(List<RouteContextRefDefinition> routeRefs)

getErrorHandlerRef

public String getErrorHandlerRef()
Specified by:
getErrorHandlerRef in class 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(DataFormatsDefinition dataFormats)

getDataFormats

public DataFormatsDefinition getDataFormats()
Specified by:
getDataFormats in class AbstractCamelContextFactoryBean<SpringCamelContext>

setOnExceptions

public void setOnExceptions(List<OnExceptionDefinition> onExceptions)

getOnExceptions

public List<OnExceptionDefinition> getOnExceptions()
Specified by:
getOnExceptions in class AbstractCamelContextFactoryBean<SpringCamelContext>

getOnCompletions

public List<OnCompletionDefinition> getOnCompletions()
Specified by:
getOnCompletions in class AbstractCamelContextFactoryBean<SpringCamelContext>

setOnCompletions

public void setOnCompletions(List<OnCompletionDefinition> onCompletions)

getShutdownRoute

public ShutdownRoute getShutdownRoute()
Specified by:
getShutdownRoute in class AbstractCamelContextFactoryBean<SpringCamelContext>

setShutdownRoute

public void setShutdownRoute(ShutdownRoute shutdownRoute)

getShutdownRunningTask

public ShutdownRunningTask getShutdownRunningTask()
Specified by:
getShutdownRunningTask in class AbstractCamelContextFactoryBean<SpringCamelContext>

setShutdownRunningTask

public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask)

getThreadPoolProfiles

public List<ThreadPoolProfileDefinition> getThreadPoolProfiles()
Specified by:
getThreadPoolProfiles in class AbstractCamelContextFactoryBean<SpringCamelContext>

setThreadPoolProfiles

public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles)

getDependsOn

public String getDependsOn()
Specified by:
getDependsOn in class AbstractCamelContextFactoryBean<SpringCamelContext>

setDependsOn

public void setDependsOn(String dependsOn)


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.