org.apache.camel.spring
Class SpringCamelContext

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.impl.DefaultCamelContext
          extended by org.apache.camel.spring.SpringCamelContext
All Implemented Interfaces:
CamelContext, RuntimeConfiguration, Service, ShutdownableService, SuspendableService, DisposableBean, InitializingBean, ApplicationContextAware
Direct Known Subclasses:
GaeSpringCamelContext, OsgiSpringCamelContext

public class SpringCamelContext
extends DefaultCamelContext
implements InitializingBean, DisposableBean, ApplicationContextAware

A Spring aware implementation of CamelContext which will automatically register itself with Springs lifecycle methods plus allows spring to be used to customize a any Type Converters as well as supporting accessing components and beans via the Spring ApplicationContext

Version:
$Revision: 18569 $

Constructor Summary
SpringCamelContext()
           
SpringCamelContext(ApplicationContext applicationContext)
           
 
Method Summary
 void afterPropertiesSet()
           
protected  Endpoint convertBeanToEndpoint(String uri, Object bean)
          Strategy method for attempting to convert the bean from a Registry to an endpoint using some kind of transformation or wrapper
protected  EventEndpoint createEventEndpoint()
           
protected  Injector createInjector()
          Lazily create a default implementation
protected  Registry createRegistry()
          Lazily create a default implementation
 void destroy()
           
protected  void doStart()
           
 ApplicationContext getApplicationContext()
           
 EventEndpoint getEventEndpoint()
           
 void onApplicationEvent(ApplicationEvent event)
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setEventEndpoint(EventEndpoint eventEndpoint)
           
static SpringCamelContext springCamelContext(ApplicationContext applicationContext)
           
static SpringCamelContext springCamelContext(String configLocations)
           
 String toString()
           
 
Methods inherited from class org.apache.camel.impl.DefaultCamelContext
addComponent, addEndpoint, addEndpointToRegistry, addInterceptStrategy, addLifecycleStrategy, addRegisterEndpointCallback, addRouteDefinition, addRouteDefinitions, addRoutes, addService, addStartupListener, createComponentResolver, createConsumerTemplate, createConsumerTemplate, createEndpoint, createManagementStrategy, createProducerTemplate, createProducerTemplate, createTypeConverter, disableJMX, doResume, doStartOrResumeRoutes, doStop, doSuspend, forceLazyInitialization, forceStopLazyInitialization, getApplicationContextClassLoader, getClassResolver, getComponent, getComponent, getComponentNames, getComponentResolver, getDataFormatResolver, getDataFormats, getDebugger, getDefaultFactoryFinder, getDefaultTracer, getDelayer, getEndpoint, getEndpoint, getEndpointKey, getEndpointMap, getEndpoints, getErrorHandlerBuilder, getExecutorServiceStrategy, getFactoryFinder, getInflightRepository, getInjector, getInterceptStrategies, getLanguageNames, getLanguageResolver, getLifecycleStrategies, getManagementName, getManagementStrategy, getName, getNameStrategy, getNodeIdFactory, getPackageScanClassResolver, getProcessorFactory, getProducerServicePool, getProperties, getRegistry, getRoute, getRouteDefinition, getRouteDefinitions, getRoutes, getRouteServices, getRouteStartupOrder, getRouteStatus, getShutdownRoute, getShutdownRunningTask, getShutdownStrategy, getTypeConverter, getTypeConverterRegistry, getUptime, getUuidGenerator, hasComponent, hasEndpoint, hasService, isAutoCreateComponents, isAutoStartup, isHandleFault, isLazyLoadTypeConverters, isStreamCaching, isTracing, removeComponent, removeEndpoints, removeRoute, removeRouteDefinition, removeRouteDefinition, removeRouteDefinitions, resolveDataFormat, resolveDataFormatDefinition, resolveLanguage, resolvePropertyPlaceholders, resumeRoute, resumeRouteService, routeSupportsSuspension, safelyStartRouteServices, safelyStartRouteServices, setApplicationContextClassLoader, setAutoCreateComponents, setAutoStartup, setClassResolver, setComponentResolver, setContextCounter, setDataFormatResolver, setDataFormats, setDebugger, setDefaultTracer, setDelayer, setErrorHandlerBuilder, setExecutorServiceStrategy, setFactoryFinderResolver, setHandleFault, setInflightRepository, setInjector, setInterceptStrategies, setJndiContext, setLanguageResolver, setLazyLoadTypeConverters, setLifecycleStrategies, setManagementName, setManagementStrategy, setName, setNameStrategy, setNodeIdFactory, setPackageScanClassResolver, setProcessorFactory, setProducerServicePool, setProperties, setRegistry, setRoutes, setShutdownRoute, setShutdownRunningTask, setShutdownStrategy, setStreamCaching, setTracing, setTypeConverter, setTypeConverterRegistry, setUuidGenerator, shouldStartRoutes, shutdownRoute, shutdownRoute, shutdownRouteService, start, startRoute, startRoute, startRouteDefinitions, startRouteService, stopRoute, stopRoute, stopRoute, stopRouteService, suspendRoute, suspendRoute, suspendRouteService
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, doShutdown, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.CamelContext
getStatus, getVersion
 
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
 
Methods inherited from interface org.apache.camel.Service
stop
 

Constructor Detail

SpringCamelContext

public SpringCamelContext()

SpringCamelContext

public SpringCamelContext(ApplicationContext applicationContext)
Method Detail

springCamelContext

public static SpringCamelContext springCamelContext(ApplicationContext applicationContext)
                                             throws Exception
Throws:
Exception

springCamelContext

public static SpringCamelContext springCamelContext(String configLocations)
                                             throws Exception
Throws:
Exception

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)

getApplicationContext

public ApplicationContext getApplicationContext()

setApplicationContext

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

getEventEndpoint

public EventEndpoint getEventEndpoint()

setEventEndpoint

public void setEventEndpoint(EventEndpoint eventEndpoint)

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class DefaultCamelContext
Throws:
Exception

createInjector

protected Injector createInjector()
Description copied from class: DefaultCamelContext
Lazily create a default implementation

Overrides:
createInjector in class DefaultCamelContext

createEventEndpoint

protected EventEndpoint createEventEndpoint()

convertBeanToEndpoint

protected Endpoint convertBeanToEndpoint(String uri,
                                         Object bean)
Description copied from class: DefaultCamelContext
Strategy method for attempting to convert the bean from a Registry to an endpoint using some kind of transformation or wrapper

Overrides:
convertBeanToEndpoint in class DefaultCamelContext
Parameters:
uri - the uri for the endpoint (and name in the registry)
bean - the bean to be converted to an endpoint, which will be not null
Returns:
a new endpoint

createRegistry

protected Registry createRegistry()
Description copied from class: DefaultCamelContext
Lazily create a default implementation

Overrides:
createRegistry in class DefaultCamelContext

toString

public String toString()
Overrides:
toString in class DefaultCamelContext


Apache CAMEL