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:
EventListener, org.apache.camel.CamelContext, org.apache.camel.Service, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener

public class SpringCamelContext
extends org.apache.camel.impl.DefaultCamelContext
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener

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: 563665 $

Constructor Summary
SpringCamelContext()
           
SpringCamelContext(org.springframework.context.ApplicationContext applicationContext)
           
 
Method Summary
 void afterPropertiesSet()
           
protected  org.apache.camel.Endpoint convertBeanToEndpoint(String uri, Object bean)
           
protected  org.apache.camel.spi.ComponentResolver createComponentResolver()
           
protected  EventEndpoint createEventEndpoint()
           
protected  org.apache.camel.spi.Injector createInjector()
           
protected  org.apache.camel.spi.Registry createRegistry()
           
 void destroy()
           
protected  void doStart()
           
 org.springframework.context.ApplicationContext getApplicationContext()
           
 EventEndpoint getEventEndpoint()
           
 void onApplicationEvent(org.springframework.context.ApplicationEvent event)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setEventEndpoint(EventEndpoint eventEndpoint)
           
static SpringCamelContext springCamelContext(org.springframework.context.ApplicationContext applicationContext)
           
static SpringCamelContext springCamelContext(String configLocations)
           
 
Methods inherited from class org.apache.camel.impl.DefaultCamelContext
addComponent, addRoutes, addRoutes, addSingletonEndpoint, createEndpoint, createExchangeConverter, createTypeConverter, doStop, forceLazyInitialization, getComponent, getComponent, getComponentResolver, getEndpoint, getEndpoint, getExchangeConverter, getInjector, getLanguageResolver, getLifecycleStrategy, getOrCreateComponent, getRegistry, getRoutes, getSingletonEndpoints, getTypeConverter, isAutoCreateComponents, removeComponent, removeSingletonEndpoint, resolveLanguage, setAutoCreateComponents, setComponentResolver, setExchangeConverter, setInjector, setLanguageResolver, setLifecycleStrategy, setRegistry, setRoutes, setTypeConverter, startRoutes
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getThreadName, isStarted, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Constructor Detail

SpringCamelContext

public SpringCamelContext()

SpringCamelContext

public SpringCamelContext(org.springframework.context.ApplicationContext applicationContext)
Method Detail

springCamelContext

public static SpringCamelContext springCamelContext(org.springframework.context.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 org.springframework.beans.factory.InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception

onApplicationEvent

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

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()

setApplicationContext

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

getEventEndpoint

public EventEndpoint getEventEndpoint()

setEventEndpoint

public void setEventEndpoint(EventEndpoint eventEndpoint)

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class org.apache.camel.impl.DefaultCamelContext
Throws:
Exception

createInjector

protected org.apache.camel.spi.Injector createInjector()
Overrides:
createInjector in class org.apache.camel.impl.DefaultCamelContext

createComponentResolver

protected org.apache.camel.spi.ComponentResolver createComponentResolver()
Overrides:
createComponentResolver in class org.apache.camel.impl.DefaultCamelContext

createEventEndpoint

protected EventEndpoint createEventEndpoint()

convertBeanToEndpoint

protected org.apache.camel.Endpoint convertBeanToEndpoint(String uri,
                                                          Object bean)
Overrides:
convertBeanToEndpoint in class org.apache.camel.impl.DefaultCamelContext

createRegistry

protected org.apache.camel.spi.Registry createRegistry()
Overrides:
createRegistry in class org.apache.camel.impl.DefaultCamelContext


Copyright © 2007 Apache Software Foundation. All Rights Reserved.