|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.directwebremoting.impl.AbstractContainer
org.directwebremoting.impl.DefaultContainer
public class DefaultContainer
DefaultContainer is like a mini-IoC container for DWR. At least it is an IoC container by interface (check: no params that have anything to do with DWR), but it is hard coded specifically for DWR. If we want to make more of it we can later, but this is certainly not going to become a full blown IoC container.
| Constructor Summary | |
|---|---|
DefaultContainer()
|
|
| Method Summary | ||
|---|---|---|
|
addBean(java.lang.Class<T> base,
T bean)
Set the class that should be used to implement the given interface |
|
|
addImplementation(java.lang.Class<T> base,
java.lang.Class<? extends T> implementation)
Set the class that should be used to implement the given interface |
|
|
addImplementationOption(java.lang.Class<T> base,
java.lang.Class<? extends T> implementation)
Set the class that should be used to implement the given interface |
|
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. |
|
void |
destroy(java.util.Collection<java.lang.String> beanNames)
|
|
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. |
|
java.lang.String |
getParameter(java.lang.String name)
Retrieve a previously set parameter |
|
void |
initializeBean(java.lang.Object bean)
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. |
|
|
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 |
setupFinished()
Called to indicate that we finished adding parameters. |
|
| 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 |
| Constructor Detail |
|---|
public DefaultContainer()
| Method Detail |
|---|
public <T> void addBean(java.lang.Class<T> base,
T bean)
base - The interface to implementbean - The new implementation
ContainerConfigurationException - If the specified beans could not be used
public <T> void addImplementation(java.lang.Class<T> base,
java.lang.Class<? extends T> implementation)
base - The interface to implementimplementation - The new implementation
ContainerConfigurationException - If the specified beans could not be used
public <T> void addImplementationOption(java.lang.Class<T> base,
java.lang.Class<? extends T> implementation)
base - The interface to implementimplementation - The new implementation
ContainerConfigurationException - If the specified beans could not be used
public void addParameter(java.lang.String askFor,
java.lang.Object valueParam)
throws ContainerConfigurationException
askFor - The key that will be looked upvalueParam - The value to be returned from the key lookup
ContainerConfigurationException - If the specified beans could not be usedpublic java.lang.String getParameter(java.lang.String name)
name - The parameter name to retrieve
public void setupFinished()
Servlet.init(javax.servlet.ServletConfig),
where all the setup is done, and where we depend on the undocumented
feature of all servlet containers that they complete the init process
of a Servlet before they begin servicing requests.
addParameter(String, Object)
public <T> T newInstance(java.lang.Class<T> type)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
Container
newInstance in interface Containertype - The type to get an instance of
java.lang.InstantiationException
java.lang.IllegalAccessExceptionpublic void initializeBean(java.lang.Object bean)
Container
initializeBean in interface Containerbean - The object to inject.public java.lang.Object getBean(java.lang.String id)
Container
getBean in interface Containerid - The type to get an instance of
public java.util.Collection<java.lang.String> getBeanNames()
ContainerContainer.getBean(String). This method should only be used
for debugging purposes.
getBeanNames in interface Containerpublic void destroy()
Container
destroy in interface Containerpublic void destroy(java.util.Collection<java.lang.String> beanNames)
|
Copyright ยจ 2008 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||