org.mule.extras.spring
Class SpringContainerContext

java.lang.Object
  extended byorg.mule.impl.container.AbstractContainerContext
      extended byorg.mule.extras.spring.SpringContainerContext
All Implemented Interfaces:
Disposable, Initialisable, UMOContainerContext

public class SpringContainerContext
extends AbstractContainerContext

SpringContainerContext is a Spring Context that can expose spring-managed components for use in the Mule framework.


Field Summary
protected  BeanFactory beanFactory
          the application contect to use when resolving components
protected  String configFile
           
protected  String configuration
           
protected  BeanFactory externalBeanFactory
           
protected static Log logger
          logger used by this class
static String SPRING_DOCTYPE_REF
           
 
Constructor Summary
SpringContainerContext()
           
 
Method Summary
 void configure(Reader configuration)
           
 void configure(String configurationXmlAsString)
          Configure Spring by passing an in-memory XML Spring config.
 void dispose()
          A lifecycle method where implementor should free up any resources.
 BeanFactory getBeanFactory()
          The spring application context used to build components
 Object getComponent(Object key)
          Queries a component from the underlying container
 String getConfigFile()
           
 String getConfiguration()
           
 void initialise()
          Method used to perform any initialisation work.
 void setBeanFactory(BeanFactory beanFactory)
          Sets the spring application context used to build components
 void setConfigFile(String configFile)
           
 void setConfiguration(String configuration)
           
 void setExternalBeanFactory(BeanFactory factory)
           
 
Methods inherited from class org.mule.impl.container.AbstractContainerContext
configure, getDefaultDocType, getDefaultEncoding, getName, getXmlDeclaration, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPRING_DOCTYPE_REF

public static final String SPRING_DOCTYPE_REF
See Also:
Constant Field Values

logger

protected static Log logger
logger used by this class


beanFactory

protected BeanFactory beanFactory
the application contect to use when resolving components


externalBeanFactory

protected BeanFactory externalBeanFactory

configFile

protected String configFile

configuration

protected String configuration
Constructor Detail

SpringContainerContext

public SpringContainerContext()
Method Detail

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
Sets the spring application context used to build components

Parameters:
beanFactory - the context to use

setExternalBeanFactory

public void setExternalBeanFactory(BeanFactory factory)

getBeanFactory

public BeanFactory getBeanFactory()
The spring application context used to build components

Returns:
spring application context

getComponent

public Object getComponent(Object key)
                    throws ObjectNotFoundException
Description copied from interface: UMOContainerContext
Queries a component from the underlying container

Parameters:
key - the key fo find the component with. Its up to the individual implementation to check the type of this key and look up objects accordingly
Returns:
The component found in the container
Throws:
ObjectNotFoundException - if the component is not found

getConfigFile

public String getConfigFile()

setConfigFile

public void setConfigFile(String configFile)
                   throws ConfigurationException
Parameters:
configFile - The configFile to set.
Throws:
ConfigurationException

configure

public void configure(Reader configuration)
               throws ContainerException
Specified by:
configure in class AbstractContainerContext
Throws:
ContainerException

configure

public void configure(String configurationXmlAsString)
               throws ContainerException
Configure Spring by passing an in-memory XML Spring config.

Parameters:
configurationXmlAsString - XML config contents
Throws:
ContainerException - in case of any error

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Overrides:
initialise in class AbstractContainerContext
Throws:
InitialisationException

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractContainerContext

getConfiguration

public String getConfiguration()

setConfiguration

public void setConfiguration(String configuration)


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.