|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The ContainerManager is a single point of contact to manage your Container resources. It takes care of creating the other managers that a Container needs to use, as well as initializing the Container. It is designed to be directly instantiated by whatever class needs to initialize your system.
The ContainerManager provides some constants used in the initial
Parameters
passed into the ContainerManager. The
ContainerManager uses these values to create all the pieces necessary
for the Container. Below is a table that describes what those options
are.
You can think of a ContainerManager is a pocket universe for a impl and its components.
Case 1: Use by a servlet or other "root" entity
FortressConfig config = new FortressConfig();
config.setContainerClass( Thread.currentThread().getContextClassLoader().loadClass( "org.apache.avalon.fortress.test.TestContainer" ) );
config.setContextDirectory( "./" );
config.setWorkDirectory( "./" );
config.setContainerConfiguration( "resource://org.apache.avalon.fortress/test/ContainerProfile.xconf" );
config.setLoggerManagerConfiguration( "resource://org.apache.avalon.fortress/test/ContainerProfile.xlog" );
ContextManager contextManager = config.getContext();
ContainerManager containerManager = new DefaultContainerManager( contextManager );
ContainerUtil.initialize( containerManager );
Then, for example, wait for a request and pass it on to the impl:
TestContainer impl = (TestContainer) containerManager.getContainer();
impl.handleRequest( ... );
When done, dispose of the managers.
ContainerUtil.dispose( containerManager );
ContainerUtil.dispose( contextManager );
for the contract surrounding the ContainerManager context
Method Summary | |
java.lang.Object |
getContainer()
Get a reference to the managed Container. |
Method Detail |
public java.lang.Object getContainer()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |