org.directwebremoting.spring
Class SpringContainer

java.lang.Object
  extended by org.directwebremoting.impl.AbstractContainer
      extended by org.directwebremoting.impl.DefaultContainer
          extended by org.directwebremoting.spring.SpringContainer
All Implemented Interfaces:
Container

public class SpringContainer
extends DefaultContainer
implements Container

A Container implementation that looks up all beans from the configuration specified in a Spring context. It loads the configuration from a Spring web application context.

Author:
Bram Smeets, Joe Walker [joe at getahead dot ltd dot uk]

Field Summary
protected  BeanFactory beanFactory
          The Spring BeanFactory that we read from
 
Fields inherited from class org.directwebremoting.impl.DefaultContainer
beans
 
Constructor Summary
SpringContainer()
           
 
Method Summary
 void addParameter(java.lang.Object askFor, java.lang.Object valueParam)
          Set the class that should be used to implement the given interface
 void afterPropertiesSet()
           
 java.lang.Object getBean(java.lang.String id)
          Get an instance of a bean of a given name (usually name=class name).
 java.util.Collection getBeanNames()
          Get a list of all the available beans.
 void setBeanFactory(BeanFactory beanFactory)
           
 
Methods inherited from class org.directwebremoting.impl.DefaultContainer
setupFinished
 
Methods inherited from class org.directwebremoting.impl.AbstractContainer
callInitializingBeans
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beanFactory

protected BeanFactory beanFactory
The Spring BeanFactory that we read from

Constructor Detail

SpringContainer

public SpringContainer()
Method Detail

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
                    throws BeansException
Throws:
BeansException

addParameter

public void addParameter(java.lang.Object askFor,
                         java.lang.Object valueParam)
                  throws java.lang.InstantiationException,
                         java.lang.IllegalAccessException
Description copied from class: DefaultContainer
Set the class that should be used to implement the given interface

Overrides:
addParameter in class DefaultContainer
Parameters:
askFor - The interface to implement
valueParam - The new implementation
Throws:
java.lang.InstantiationException - If the specified beans could not be created
java.lang.IllegalAccessException - If the specified beans could not be accessed

getBean

public java.lang.Object getBean(java.lang.String id)
Description copied from interface: Container
Get an instance of a bean of a given name (usually name=class name).

Specified by:
getBean in interface Container
Overrides:
getBean in class DefaultContainer
Parameters:
id - The type to get an instance of
Returns:
The object of the given type, or null if the object does not exist

getBeanNames

public java.util.Collection getBeanNames()
Description copied from interface: Container
Get a list of all the available beans. Implementation of this method is optional so it is valid for this method to return an empty collection, but to return Objects when queried directly using Container.getBean(String). This method should only be used for debugging purposes.

Specified by:
getBeanNames in interface Container
Overrides:
getBeanNames in class DefaultContainer
Returns:
A collection containing all the availble bean names.

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Throws:
java.lang.Exception