public interface ContainerManager
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| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getContainer()
Get a reference to the managed Container.
|