Interface ContainerManager

All Known Implementing Classes:

public interface ContainerManager

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 );

CVS $Revision: 1.9 $ $Date: 2004/02/28 15:16:24 $
The Avalon Team
See Also:
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()
Get a reference to the managed Container. This instance is typically cast to the interface used to interact with the impl.

the container implementation

Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.