org.apache.camel.spring
Class CamelContextFactoryBean

java.lang.Object
  extended by org.apache.camel.model.IdentifiedType
      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 IdentifiedType
implements RouteContainer, 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: 17530 $

Constructor Summary
CamelContextFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  SpringCamelContext createContext()
          Create the context
 void destroy()
           
protected  void findRouteBuilders()
          Strategy method to try find RouteBuilder instances on the classpath
 ApplicationContext getApplicationContext()
           
 BeanPostProcessor getBeanPostProcessor()
           
 List<RouteBuilderDefinition> getBuilderRefs()
           
 CamelJMXAgentDefinition getCamelJMXAgent()
           
 SpringCamelContext getContext()
           
 ClassLoader getContextClassLoaderOnStart()
           
 DataFormatsDefinition getDataFormats()
           
 Long getDelayer()
           
 String getErrorHandlerRef()
           
 Boolean getHandleFault()
           
 List<InterceptFromDefinition> getInterceptFroms()
           
 List<InterceptDefinition> getIntercepts()
           
 List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints()
           
 Object getObject()
           
 Class getObjectType()
           
 List<OnCompletionDefinition> getOnCompletions()
           
 List<OnExceptionDefinition> getOnExceptions()
           
 String[] getPackages()
           
 PackageScanDefinition getPackageScan()
           
 PropertiesDefinition getProperties()
           
 List<RouteDefinition> getRoutes()
          Returns the routes
 ShutdownRoute getShutdownRoute()
           
 ShutdownRunningTask getShutdownRunningTask()
           
 Boolean getStreamCache()
           
 Boolean getTrace()
           
protected  void installRoutes()
          Strategy to install all available routes into the context
 Boolean isAutoStartup()
           
 boolean isSingleton()
           
protected  SpringCamelContext newCamelContext()
           
 void onApplicationEvent(ApplicationEvent event)
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setAutoStartup(Boolean autoStartup)
           
 void setBeanPostProcessor(BeanPostProcessor postProcessor)
           
 void setBuilderRefs(List<RouteBuilderDefinition> builderRefs)
           
 void setCamelJMXAgent(CamelJMXAgentDefinition agent)
           
 void setContext(SpringCamelContext context)
           
 void setDataFormats(DataFormatsDefinition dataFormats)
           
 void setDelayer(Long delayer)
           
 void setErrorHandlerRef(String errorHandlerRef)
          Sets the name of the error handler object used to default the error handling strategy
 void setHandleFault(Boolean 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 SpringCamelContext as a route.
 void setPackageScan(PackageScanDefinition packageScan)
          Sets the package scanning information.
 void setProperties(PropertiesDefinition properties)
           
 void setRoutes(List<RouteDefinition> routes)
          Sets the routes to use
 void setShutdownRoute(ShutdownRoute shutdownRoute)
           
 void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask)
           
 void setStreamCache(Boolean streamCache)
           
 void setTrace(Boolean trace)
           
 
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
 

Constructor Detail

CamelContextFactoryBean

public CamelContextFactoryBean()
Method Detail

getObject

public Object getObject()
                 throws Exception
Specified by:
getObject in interface FactoryBean
Throws:
Exception

getObjectType

public Class getObjectType()
Specified by:
getObjectType in interface FactoryBean

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean

getContextClassLoaderOnStart

public ClassLoader getContextClassLoaderOnStart()

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface DisposableBean
Throws:
Exception

onApplicationEvent

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

getContext

public SpringCamelContext getContext()
                              throws Exception
Throws:
Exception

setContext

public void setContext(SpringCamelContext context)

getRoutes

public List<RouteDefinition> getRoutes()
Description copied from interface: RouteContainer
Returns the routes

Specified by:
getRoutes in interface RouteContainer
Returns:
the routes

setRoutes

public void setRoutes(List<RouteDefinition> routes)
Description copied from interface: RouteContainer
Sets the routes to use

Specified by:
setRoutes in interface RouteContainer
Parameters:
routes - the routes

getIntercepts

public List<InterceptDefinition> getIntercepts()

setIntercepts

public void setIntercepts(List<InterceptDefinition> intercepts)

getInterceptFroms

public List<InterceptFromDefinition> getInterceptFroms()

setInterceptFroms

public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms)

getInterceptSendToEndpoints

public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints()

setInterceptSendToEndpoints

public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints)

getApplicationContext

public ApplicationContext getApplicationContext()

setApplicationContext

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

getProperties

public PropertiesDefinition getProperties()

setProperties

public void setProperties(PropertiesDefinition properties)

getPackages

public String[] getPackages()

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 SpringCamelContext 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()

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

Parameters:
packageScan - the package scan

setBeanPostProcessor

public void setBeanPostProcessor(BeanPostProcessor postProcessor)

getBeanPostProcessor

public BeanPostProcessor getBeanPostProcessor()

setCamelJMXAgent

public void setCamelJMXAgent(CamelJMXAgentDefinition agent)

getTrace

public Boolean getTrace()

setTrace

public void setTrace(Boolean trace)

getStreamCache

public Boolean getStreamCache()

setStreamCache

public void setStreamCache(Boolean streamCache)

getDelayer

public Long getDelayer()

setDelayer

public void setDelayer(Long delayer)

getHandleFault

public Boolean getHandleFault()

setHandleFault

public void setHandleFault(Boolean handleFault)

getCamelJMXAgent

public CamelJMXAgentDefinition getCamelJMXAgent()

getBuilderRefs

public List<RouteBuilderDefinition> getBuilderRefs()

setBuilderRefs

public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs)

getErrorHandlerRef

public String getErrorHandlerRef()

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()

setOnExceptions

public void setOnExceptions(List<OnExceptionDefinition> onExceptions)

getOnExceptions

public List<OnExceptionDefinition> getOnExceptions()

getOnCompletions

public List<OnCompletionDefinition> getOnCompletions()

setOnCompletions

public void setOnCompletions(List<OnCompletionDefinition> onCompletions)

isAutoStartup

public Boolean isAutoStartup()

setAutoStartup

public void setAutoStartup(Boolean autoStartup)

getShutdownRoute

public ShutdownRoute getShutdownRoute()

setShutdownRoute

public void setShutdownRoute(ShutdownRoute shutdownRoute)

getShutdownRunningTask

public ShutdownRunningTask getShutdownRunningTask()

setShutdownRunningTask

public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask)

createContext

protected SpringCamelContext createContext()
Create the context


newCamelContext

protected SpringCamelContext newCamelContext()

installRoutes

protected void installRoutes()
                      throws Exception
Strategy to install all available routes into the context

Throws:
Exception

findRouteBuilders

protected void findRouteBuilders()
                          throws Exception
Strategy method to try find RouteBuilder instances on the classpath

Throws:
Exception


Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.