|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.avalon.fortress.util.ContextManager
You can get two different contexts from the ContextManager: the container context (m_childContext) and the container manager context (m_containerManagerContext)
You can get two different contexts from the ContextManager: the child context and the impl manager context. The former contains all managers, such as the pool manager etc. necessary for a child impl to create additional child containers. The impl manager context contains all of the child context, but also initialization parameters for the impl, such as a Configuration object, a ComponentLocator, etc., that the impl wants, but does not want to pass on to its children.
The container manager context is used to provide the container manager with all the data needed to initialize the container.
The container context is passed directly to the container.
The ContextManager will sometimes create new components, such as a service manager, a pool manager, etc. It will manage these components and dispose of them properly when it itself is disposed .
| Nested Class Summary | |
private class |
ContextManager.DestroyOrderComparator |
private static class |
ContextManager.EAServiceManagerThis is a compatibility thing for early adopters of Fortress so that they will use the correct ROLE for the CommandSink. |
| Field Summary | |
private DefaultConfigurationBuilder |
configBuilderThe ConfigurationBuilder is instantiated lazilly in getConfiguration to avoid LinkageErrors in some environments. |
protected static Configuration |
EMPTY_CONFIG |
protected DefaultContext |
m_childContextThe context of the new impl. |
protected DefaultContext |
m_containerManagerContextContainer manager's context. |
protected SourceResolver |
m_defaultSourceResolverSource resolver used to read-in the configurations. |
protected InstrumentManager |
m_instrumentManagerThe InstrumentManager to be used by the container. |
protected Logger |
m_logger |
protected LoggerManager |
m_loggerManagerThe logger manager in use. |
protected MetaInfoManager |
m_metaInfoManagerThe MetaInfoManager to be used by the container. |
protected PoolManager |
m_poolManagerThe PoolManager to be used by the container. |
protected Logger |
m_primordialLogger |
protected Context |
m_rootContextThe root context. |
protected Sink |
m_sinkThe Sink in use. |
protected ThreadManager |
m_threadManagerThe ThreadManager to be used by the container. |
private java.util.ArrayList |
ownedComponentsThe components that are "owned" by this context and should be disposed by it. |
| Fields inherited from interface org.apache.avalon.fortress.util.ContextManagerConstants |
CONFIGURATION_URI, INSTRUMENT_MANAGER_CONFIGURATION, INSTRUMENT_MANAGER_CONFIGURATION_URI, LOG_CATEGORY, LOGGER_MANAGER_CONFIGURATION, LOGGER_MANAGER_CONFIGURATION_URI, ROLE_MANAGER_CLASS, ROLE_MANAGER_CONFIGURATION, ROLE_MANAGER_CONFIGURATION_URI |
| 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 | |
ContextManager(Context rootContext, Logger logger)Create a new ContextManager. |
|
| Method Summary | |
protected void |
assumeOwnership(java.lang.Object object)Method to assume ownership of one of the managers the ContextManager created. |
private Parameters |
buildThreadManagerParameters()Helper method for creating ThreadManager configuration. |
protected void |
copyEntry(java.lang.String key)Copies the specified entry from the rootContext to the containerManagerContext. |
private Sink |
createCommandSink()Helper method for creating a default CommandSink |
void |
dispose()Disposes all items that this ContextManager has created. |
void |
disposeOwned()Disposes all items ContextManager has assumed ownership over |
protected boolean |
entryPresent(Context context, java.lang.String key)Checks if a specified entry in context has been supplied by the invoker. |
protected java.lang.Object |
get(Context context, java.lang.String key, java.lang.Object defaultValue)Convenience method to obtain a value, or defer to a default if it does not exist. |
Context |
getChildContext()Finalizes and returns the context. |
protected Configuration |
getConfiguration(java.lang.String configKey, java.lang.String uriKey)Get a configuration based on a config and URI key. |
Context |
getContainerManagerContext()Finalizes and returns the context. |
protected Logger |
getLogger()Get a reference the Logger. |
void |
initialize()Initialize the ContextManager. |
protected void |
initializeCommandSink()Set up the CommandSink to enable asynchronous management. |
protected void |
initializeConfiguration()Load the configuration file that the Container will need to operate. |
protected void |
initializeContext()Initialize the context that will be passed into the impl. |
protected void |
initializeDefaultSourceResolver()Initialize the default source resolver |
protected void |
initializeInstrumentManager()Will set up an InstrumentManager if none is supplied. |
protected void |
initializeLoggerManager()Will set up a LogKitLoggerManager if none is supplied. |
protected void |
initializeMetaInfoManager() |
protected void |
initializePoolManager()Set up the Pool Manager for the managed pool. |
protected void |
initializeServiceManager()Get a reference to the initial ComponentLocator used by the ContainerManager to hold the Components used for parsing the config files and setting up the environment. |
protected void |
initializeThreadManager() |
protected RoleManager |
obtainRoleManager()Set up a RoleManager for the Container if configuration for it has been supplied. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final Configuration EMPTY_CONFIG
protected final Context m_rootContext
protected final DefaultContext m_childContext
protected final DefaultContext m_containerManagerContext
protected Logger m_logger
protected final Logger m_primordialLogger
protected SourceResolver m_defaultSourceResolver
protected LoggerManager m_loggerManager
protected Sink m_sink
protected MetaInfoManager m_metaInfoManager
protected PoolManager m_poolManager
protected ThreadManager m_threadManager
protected InstrumentManager m_instrumentManager
private final java.util.ArrayList ownedComponents
private DefaultConfigurationBuilder configBuilder
| Constructor Detail |
public ContextManager(Context rootContext,
Logger logger)
rootContext - the default values.logger - logger to use when creating new components.| Method Detail |
protected void assumeOwnership(java.lang.Object object)
ContextManager created. Ownership means that the ContextManager is responsible for destroying the manager when the ContextManager is destroyed.
object - The object being claimedjava.lang.IllegalArgumentException - if the object is null.
public void initialize()
throws java.lang.Exception
ContextManager. This will cause the ContextManager to create any managers it needs.
initialize in interface Initializablejava.lang.Exception - if there is a problem at any point in the initialization.protected void initializeConfiguration()
protected void initializeContext()
throws java.lang.Exception
java.lang.Exception - if any of the parameters cannot be copied properly.
protected void copyEntry(java.lang.String key)
throws ContextException
rootContext to the containerManagerContext.
ContextException - if the parameter does not exist
protected boolean entryPresent(Context context,
java.lang.String key)
context has been supplied by the invoker.
context - The context to checkkey - The key name to checkpublic void dispose()
dispose in interface Disposablepublic void disposeOwned()
protected java.lang.Object get(Context context,
java.lang.String key,
java.lang.Object defaultValue)
context - The context object we intend to get a value from.key - The key we want to use to get the value.defaultValue - The default value we return if the key does not exist.
protected void initializeCommandSink()
throws java.lang.Exception
java.lang.Exception - if the CommandSink could not be created.
private Sink createCommandSink()
throws java.lang.Exception
CommandSinkjava.lang.Exception - if an error occursprivate Parameters buildThreadManagerParameters()
Parameters instance
protected void initializePoolManager()
throws java.lang.Exception
java.lang.Exception - if there is an error.
protected RoleManager obtainRoleManager()
throws java.lang.Exception
java.lang.Exception - if there is an error.
protected void initializeMetaInfoManager()
throws java.lang.Exception
java.lang.Exception
protected void initializeDefaultSourceResolver()
throws java.lang.Exception
java.lang.Exception - when there is an error.
protected void initializeServiceManager()
throws java.lang.Exception
java.lang.Exception - when there is an error.
protected Configuration getConfiguration(java.lang.String configKey,
java.lang.String uriKey)
configKey - Get the Configuration object directly from the context.uriKey - Get the uri from the context.public Context getContainerManagerContext()
Contextpublic Context getChildContext()
Contextprotected Logger getLogger()
Logger
protected void initializeLoggerManager()
throws java.lang.Exception
The postcondition is that childContext.get( LoggerManager.ROLE ) should return a valid logger manager.
java.lang.Exception - if it cannot instantiate the LoggerManager
protected void initializeThreadManager()
throws java.lang.Exception
java.lang.Exception
protected void initializeInstrumentManager()
throws java.lang.Exception
The postcondition is that childContext.get( InstrumentManager.ROLE ) should return a valid instrument manager.
java.lang.Exception - if it cannot instantiate the InstrumentManager
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||