org.apache.avalon.excalibur.system
Class ContainerManager

java.lang.Object
  |
  +--org.apache.avalon.excalibur.system.ContainerManager

public class ContainerManager
extends java.lang.Object

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.

Constant Description
CONTAINER_CLASS String fully qualified class name for the container class. this is absolutely necessary for the ContainerManager to create the Container class instance.
CONTEXT_DIRECTORY String path to the Context's root directory. This is used to resolve all relative paths, and the "context:" psuedo-protocol. Defaults to "./".
WORK_DIRECTORY String path to a work area on the file system. Defaults to "/tmp".
XML_PARSER String fully qualified class name of the Parser component implementation. It defaults to "org.apache.avalon.excalibur.xml.JaxpParser".
LOG_CATEGORY String root category name for the container and its manager. If no value is given, the default (null) is used.
LOGKIT_CONFIG String path to the LogKitLoggerManager configuration file. If this is not set, ContainerManager tries the uri "context://logkit.xconf". If nothing is there, the LogKitLoggerManager is not configured. Note: If you passed in a reference to a LoggerManager yourself, ContainerManager ignores this parameter altogether.
ROLE_CONFIG String path to the RoleManager configuration file. If this is not set, ContainerManager does not create a RoleManager at all.
CONTAINER_CONFIG String path the points to the container's Configuration file. This value defaults to the uri "context://container.xconf". If the Container is Configurable and no entry can be found, then the Container is given an empty Configuration object.
THREADS_CPU Integer that holds the value of the number of threads used by the ThreadManager per CPU. This defaults to 2.
CPU_COUNT Integer representing the number of CPUs on a machine. The value is used in efficiency calculations, and determining the number of threads to have running for the CommandManager. Defaults to 1.

Version:
CVS $Revision: 1.10 $ $Date: 2002/01/28 19:29:47 $
Author:
Berin Loritsch

Field Summary
static java.lang.String CONTAINER_CLASS
           
static java.lang.String CONTAINER_CONFIG
           
static java.lang.String CONTEXT_DIRECTORY
           
static java.lang.String CPU_COUNT
           
static java.lang.String LOG_CATEGORY
           
static java.lang.String LOGKIT_CONFIG
           
static java.lang.String ROLE_CONFIG
           
static java.lang.String THREADS_CPU
           
static java.lang.String WORK_DIRECTORY
           
static java.lang.String XML_PARSER
           
 
Constructor Summary
ContainerManager(org.apache.avalon.framework.parameters.Parameters initialParameters)
          This constructor creates a new ContainerManager with a LogKitLoggerManager for managing your logging categories.
ContainerManager(org.apache.avalon.framework.parameters.Parameters initialParameters, LoggerManager defaultLogManager)
          Create a ContainerManager with all the information in the Context, and the supplied LoggerManager.
ContainerManager(org.apache.avalon.framework.parameters.Parameters initialParameters, LoggerManager defaultLogManager, java.lang.ClassLoader rootClassLoader)
          Create a ContainerManager with all the information in the Context, and the supplied LoggerManager.
 
Method Summary
 org.apache.avalon.framework.component.ComponentManager getComponentManager()
          Get a reference to the initial ComponentManager used by the ContainerManager to hold the Components used for parsing the config files and setting up the environment.
protected  org.apache.avalon.framework.configuration.Configuration getContainerConfig()
          Get the Container Configuration hierarchy.
protected  org.apache.avalon.framework.context.Context getContext()
          Override this if you have any special needs for the Container's Context.
 org.apache.avalon.framework.logger.Logger getLogger()
          Get a reference the default Logger.
 LoggerManager getLoggerManager()
          Get the LoggerManager.
protected  org.apache.avalon.framework.configuration.Configuration getLogKitConfig()
          Get the Container Configuration hierarchy.
protected  org.apache.avalon.framework.configuration.Configuration getRoleConfig()
          Get the Container Configuration hierarchy.
protected  RoleManager getRoleManager()
          Sets up the RoleManager.
protected  void recycleContainer()
          Override this if you have any special needs for the container (such as wanting to use your own class).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_DIRECTORY

public static final java.lang.String CONTEXT_DIRECTORY

WORK_DIRECTORY

public static final java.lang.String WORK_DIRECTORY

CONTAINER_CLASS

public static final java.lang.String CONTAINER_CLASS

XML_PARSER

public static final java.lang.String XML_PARSER

LOGKIT_CONFIG

public static final java.lang.String LOGKIT_CONFIG

ROLE_CONFIG

public static final java.lang.String ROLE_CONFIG

THREADS_CPU

public static final java.lang.String THREADS_CPU

CONTAINER_CONFIG

public static final java.lang.String CONTAINER_CONFIG

LOG_CATEGORY

public static final java.lang.String LOG_CATEGORY

CPU_COUNT

public static final java.lang.String CPU_COUNT
Constructor Detail

ContainerManager

public ContainerManager(org.apache.avalon.framework.parameters.Parameters initialParameters)
                 throws InitializationException
This constructor creates a new ContainerManager with a LogKitLoggerManager for managing your logging categories. If you want another LoggerManager implementation, then use the constructor with two arguments.

ContainerManager

public ContainerManager(org.apache.avalon.framework.parameters.Parameters initialParameters,
                        LoggerManager defaultLogManager)
                 throws InitializationException
Create a ContainerManager with all the information in the Context, and the supplied LoggerManager.

ContainerManager

public ContainerManager(org.apache.avalon.framework.parameters.Parameters initialParameters,
                        LoggerManager defaultLogManager,
                        java.lang.ClassLoader rootClassLoader)
                 throws InitializationException
Create a ContainerManager with all the information in the Context, and the supplied LoggerManager.
Method Detail

getComponentManager

public org.apache.avalon.framework.component.ComponentManager getComponentManager()
Get a reference to the initial ComponentManager used by the ContainerManager to hold the Components used for parsing the config files and setting up the environment.

recycleContainer

protected void recycleContainer()
                         throws InitializationException
Override this if you have any special needs for the container (such as wanting to use your own class).

getContext

protected org.apache.avalon.framework.context.Context getContext()
Override this if you have any special needs for the Container's Context. Typically, this will f

getLoggerManager

public LoggerManager getLoggerManager()
Get the LoggerManager. Will set up a LogKitLoggerManager if none is supplied. This can be overridden if you don't want a LogKitLoggerManager.

getLogger

public org.apache.avalon.framework.logger.Logger getLogger()
Get a reference the default Logger.

getRoleManager

protected RoleManager getRoleManager()
Sets up the RoleManager. You may override this method to implement your own logic. This is the RoleManager given to the Container so that the Container can interpret it's Configuration.

getContainerConfig

protected org.apache.avalon.framework.configuration.Configuration getContainerConfig()
Get the Container Configuration hierarchy.

getRoleConfig

protected org.apache.avalon.framework.configuration.Configuration getRoleConfig()
Get the Container Configuration hierarchy.

getLogKitConfig

protected org.apache.avalon.framework.configuration.Configuration getLogKitConfig()
Get the Container Configuration hierarchy.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.