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

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

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.String askFor, java.lang.Object valueParam)
          Add a parameter to the container as a possibility for injection
 void destroy()
          Closes down all parts of DWR in a timely way, stops threads, and performs tidy-up.
 java.lang.Object getBean(java.lang.String id)
          Get the contained instance of a bean/setting of a given name.
 java.util.Collection<java.lang.String> 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
addBean, addImplementation, addImplementationOption, destroy, getParameter, initializeBean, newInstance, setupFinished
 
Methods inherited from class org.directwebremoting.impl.AbstractContainer
getBean
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.directwebremoting.Container
getBean, initializeBean, newInstance
 

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.String askFor,
                         java.lang.Object valueParam)
                  throws ContainerConfigurationException
Description copied from class: DefaultContainer
Add a parameter to the container as a possibility for injection

Overrides:
addParameter in class DefaultContainer
Parameters:
askFor - The key that will be looked up
valueParam - The value to be returned from the key lookup
Throws:
ContainerConfigurationException - If the specified beans could not be used

getBean

public java.lang.Object getBean(java.lang.String id)
Description copied from interface: Container
Get the contained instance of a bean/setting of a given 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<java.lang.String> 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 available bean names.

destroy

public void destroy()
Description copied from interface: Container
Closes down all parts of DWR in a timely way, stops threads, and performs tidy-up.

Specified by:
destroy in interface Container
Specified by:
destroy in interface UninitializingBean
Overrides:
destroy in class DefaultContainer

Copyright ยจ 2008