org.directwebremoting
Interface Container

All Known Implementing Classes:
AbstractContainer, DefaultContainer, JaxerContainer, SpringContainer

public interface Container

A very basic IoC container. See ContainerUtil for information on how to setup a Container

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

Method Summary
 void contextDestroyed()
          This should be called only by DwrListener.
<T> T
getBean(java.lang.Class<T> type)
          Get the contained instance of a bean of a given type
 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 initializeBean(java.lang.Object object)
          Deprecated.  
<T> T
newInstance(java.lang.Class<T> type)
          Sometimes we need to create a bean as a one-off object and have it injected with settings by the container.
 void servletDestroyed()
          Should be called only by DwrServlet (or other servlet implementations).
 

Method Detail

getBean

java.lang.Object getBean(java.lang.String id)
Get the contained instance of a bean/setting of a given name.

Parameters:
id - The type to get an instance of
Returns:
The object of the given type, or null if the object does not exist

getBean

<T> T getBean(java.lang.Class<T> type)
Get the contained instance of a bean of a given type

Parameters:
type - The type to get an instance of
Returns:
The object of the given type, or null if the object does not exist

getBeanNames

java.util.Collection<java.lang.String> getBeanNames()
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 getBean(String). This method should only be used for debugging purposes.

Returns:
A collection containing all the available bean names.

contextDestroyed

void contextDestroyed()
This should be called only by DwrListener. It requests all reverse ajax threads to stop.

GenericServlet.destroy() is called only when all connections are closed. If a DwrListener is configured then we can close down the connections in a timely way. All other tidy-up is done by servletDestroyed() which will work even when a DwrListener has not been configured.

See Also:
servletDestroyed()

servletDestroyed

void servletDestroyed()
Should be called only by DwrServlet (or other servlet implementations). It requests all other threads to stop, and any tidy-up that can be done after the context has been fully destroyed.

See Also:
contextDestroyed()

newInstance

<T> T newInstance(java.lang.Class<T> type)
              throws java.lang.InstantiationException,
                     java.lang.IllegalAccessException
Sometimes we need to create a bean as a one-off object and have it injected with settings by the container. This does not make the object part of the container.

Parameters:
type - The type to get an instance of
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

initializeBean

@Deprecated
void initializeBean(java.lang.Object object)
Deprecated. 

Sometimes we need to take a bean not created by the container, and inject it with the data that it would contain if it was created by the container. This does not make the object part of the container.

Parameters:
object - The object to inject.

Copyright 2008