org.apache.avalon.fortress.impl
Class DefaultContainerManager

java.lang.Object
  extended by org.apache.avalon.fortress.impl.DefaultContainerManager
All Implemented Interfaces:
org.apache.avalon.fortress.ContainerConstants, org.apache.avalon.fortress.ContainerManager, org.apache.avalon.fortress.ContainerManagerConstants, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable

public class DefaultContainerManager
extends java.lang.Object
implements org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.fortress.ContainerManager, org.apache.avalon.fortress.ContainerManagerConstants

This is the default implementation of the ContainerManager interface. See that interface for a description.

Version:
CVS $Revision: 1.29 $ $Date: 2004/02/28 15:16:24 $
Author:
The Avalon Team

Field Summary
private  java.lang.Object m_containerInstance
           
private  ContextManager m_contextManager
           
private  org.apache.avalon.framework.logger.Logger m_logger
           
 
Fields inherited from interface org.apache.avalon.fortress.ContainerManagerConstants
COMMAND_FAILURE_HANDLER_CLASS, CONFIGURATION, CONTAINER_CLASS, LOGGER, PARAMETERS, SERVICE_MANAGER
 
Fields inherited from interface org.apache.avalon.fortress.ContainerConstants
CONTEXT_DIRECTORY, THREAD_TIMEOUT, THREADS_CPU, WORK_DIRECTORY
 
Constructor Summary
DefaultContainerManager(org.apache.avalon.framework.context.Context initParameters)
           
DefaultContainerManager(org.apache.avalon.framework.context.Context initParameters, org.apache.avalon.framework.logger.Logger logger)
           
DefaultContainerManager(ContextManager contextManager)
           
DefaultContainerManager(ContextManager contextManager, org.apache.avalon.framework.logger.Logger logger)
           
 
Method Summary
private  void createContainer()
           
protected  org.apache.avalon.framework.logger.Logger createLoggerFromContext(org.apache.avalon.framework.context.Context initParameters)
           
 void dispose()
          Dispose of the ContainerManager and managed Container
protected  void disposeContainer()
           
 java.lang.Object getContainer()
          Get a reference to your Container.
private  java.lang.Object getContextEntry(org.apache.avalon.framework.context.Context context, java.lang.String key)
          Retrieve an entry from context if it exists, else return null.
private static ContextManager getInitializedContextManager(org.apache.avalon.framework.context.Context initParameters, org.apache.avalon.framework.logger.Logger logger)
          Creates and initializes a contextManager given an initialization context.
 org.apache.avalon.framework.logger.Logger getLogger()
          Allows to get the logger and associated hierarchy for logging.
 void initialize()
          Initialize the ContainerManager
protected  void initializeContainer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_contextManager

private final ContextManager m_contextManager

m_logger

private final org.apache.avalon.framework.logger.Logger m_logger

m_containerInstance

private java.lang.Object m_containerInstance
Constructor Detail

DefaultContainerManager

public DefaultContainerManager(ContextManager contextManager)

DefaultContainerManager

public DefaultContainerManager(ContextManager contextManager,
                               org.apache.avalon.framework.logger.Logger logger)

DefaultContainerManager

public DefaultContainerManager(org.apache.avalon.framework.context.Context initParameters)
                        throws java.lang.Exception
Throws:
java.lang.Exception

DefaultContainerManager

public DefaultContainerManager(org.apache.avalon.framework.context.Context initParameters,
                               org.apache.avalon.framework.logger.Logger logger)
                        throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getInitializedContextManager

private static ContextManager getInitializedContextManager(org.apache.avalon.framework.context.Context initParameters,
                                                           org.apache.avalon.framework.logger.Logger logger)
                                                    throws java.lang.Exception
Creates and initializes a contextManager given an initialization context. This is necessary so that these operations can complete before the super constructor has been executed.

Throws:
java.lang.Exception

createLoggerFromContext

protected org.apache.avalon.framework.logger.Logger createLoggerFromContext(org.apache.avalon.framework.context.Context initParameters)

initialize

public void initialize()
                throws java.lang.Exception
Initialize the ContainerManager

Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception

initializeContainer

protected void initializeContainer()
                            throws org.apache.avalon.fortress.InitializationException
Throws:
org.apache.avalon.fortress.InitializationException

createContainer

private void createContainer()
                      throws org.apache.avalon.fortress.InitializationException
Throws:
org.apache.avalon.fortress.InitializationException

getContextEntry

private java.lang.Object getContextEntry(org.apache.avalon.framework.context.Context context,
                                         java.lang.String key)
Retrieve an entry from context if it exists, else return null.

Parameters:
context - the context
key - the key
Returns:
the entry

disposeContainer

protected void disposeContainer()

dispose

public void dispose()
Dispose of the ContainerManager and managed Container

Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

getContainer

public java.lang.Object getContainer()
Get a reference to your Container. Typically, you would cast this to whatever interface you will use to interact with it.

Specified by:
getContainer in interface org.apache.avalon.fortress.ContainerManager

getLogger

public final org.apache.avalon.framework.logger.Logger getLogger()
Allows to get the logger and associated hierarchy for logging.

Returns:
Logger