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, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

public class SpringContainer
extends DefaultContainer
implements Container, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

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]

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(org.springframework.beans.factory.BeanFactory beanFactory)
           
 
Methods inherited from class org.directwebremoting.impl.DefaultContainer
setupFinished
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringContainer

public SpringContainer()
Method Detail

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Throws:
org.springframework.beans.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
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

Copyright ? 2005