|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.fortress.impl.AbstractContainer
public abstract class AbstractContainer
This abstract implementation provides basic functionality for building
an implementation of the Container
interface.
It exposes a protected getServiceManager() method so that the
Container's Manager can expose that to the instantiating class.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_ENTRY
The hint map's entry to get the default component type. |
protected java.lang.ClassLoader |
m_classLoader
contains the impl's root ClassLoader, which is extracted from m_serviceManager. |
protected org.d_haven.event.Sink |
m_commandSink
contains the impl's Sink, which is extracted from m_serviceManager. |
protected org.apache.avalon.framework.context.Context |
m_componentContext
contains the context that will be passed to the components we will create. |
protected java.util.List |
m_components
Contains an entry for each ComponentHandler |
protected org.apache.avalon.framework.context.Context |
m_context
contains the impl's context passed in through contextualize(). |
protected LifecycleExtensionManager |
m_extManager
contains the impl's LifecycleExtensionManager, which is extracted from m_serviceManager. |
protected org.apache.excalibur.instrument.InstrumentManager |
m_instrumentManager
contains the impl's InstrumentManager, which is extracted from m_serviceManager. |
protected org.apache.avalon.excalibur.logger.LoggerManager |
m_loggerManager
contains the impl's LoggerManager, which is extracted from m_serviceManager. |
protected java.util.Map |
m_mapper
Contains entries mapping roles to hint maps, where the hint map contains mappings from hints to ComponentHandlers. |
protected org.apache.avalon.fortress.MetaInfoManager |
m_metaManager
contains the impl's RoleManager, which is extracted from m_serviceManager. |
protected org.d_haven.mpool.PoolManager |
m_poolManager
contains the impl's PoolManager, which is extracted from m_serviceManager. |
private ProxyManager |
m_proxyManager
|
protected org.apache.avalon.framework.service.ServiceManager |
m_serviceManager
contains the ServiceManager the impl will use, based on the one passed in through service(). |
protected java.util.List |
m_shutDownOrder
|
static java.lang.String |
SELECTOR_ENTRY
The component map's entry to get a ServiceSelector. |
Fields inherited from interface org.apache.avalon.fortress.Container |
---|
ROLE |
Constructor Summary | |
---|---|
AbstractContainer()
|
Method Summary | |
---|---|
protected void |
addComponent(ComponentHandlerMetaData metaData)
Add a Component into the impl. |
void |
contextualize(org.apache.avalon.framework.context.Context context)
Pull the manager items from the context so we can use them to set up the system. |
protected java.util.Map |
createHintMap()
Create the hint map for a role. |
protected org.d_haven.mpool.ObjectFactory |
createObjectFactory(java.lang.String classname,
org.apache.avalon.framework.configuration.Configuration configuration)
Create an objectFactory for specified Object configuration. |
void |
dispose()
Disposes of all components and frees resources that they consume. |
java.lang.Object |
get(java.lang.String role,
java.lang.Object hint)
This is the method that the ContainerComponentManager and Selector use to gain access to the ComponentHandlers and ComponentSelectors. |
private ComponentHandler |
getComponentHandler(org.apache.avalon.fortress.MetaInfoEntry metaEntry,
ComponentHandlerMetaData metaData)
Get a ComponentHandler with the default constructor for the component class passed in. |
protected ProxyManager |
getProxyManager()
Guarantees that the ProxyManager will be assigned before use. |
protected static java.lang.String |
getRoleKey(java.lang.String role,
java.lang.Object hint)
Get the composite role name based on the specified role and hint. |
protected org.apache.avalon.framework.service.ServiceManager |
getServiceManager()
Exposes to subclasses the service manager which this impl uses to manage its child components. |
private java.lang.String |
getVertexDeps(org.apache.avalon.fortress.util.dag.Vertex vertex)
Obtain the names of the dependencies for a given vertex. |
boolean |
has(java.lang.String role,
java.lang.Object hint)
This is the method that the ContainerComponentManager and Selector use to gain access to the ComponentHandlers and ComponentSelectors. |
void |
initialize()
Initializes the impl and all the components it hosts so that they are ready to be used. |
protected org.apache.avalon.framework.context.Context |
provideComponentContext(org.apache.avalon.framework.context.Context parent)
Override this method to control what context will be passed to the components created by this container. |
protected org.apache.avalon.framework.service.ServiceManager |
provideServiceManager(org.apache.avalon.framework.service.ServiceManager parent)
Override this method to control creation of the serviceManager belonging to this container. |
void |
service(org.apache.avalon.framework.service.ServiceManager serviceManager)
Root ServiceManager. |
protected void |
setProxyManager(ProxyManager proxyManager)
Allows you to override the ProxyManager used in the container. |
private void |
setupExtensionManager(org.apache.avalon.framework.service.ServiceManager serviceManager)
Set up the Lifecycle Extension Manager. |
private void |
verifyComponents()
|
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_ENTRY
public static final java.lang.String SELECTOR_ENTRY
protected org.apache.avalon.framework.context.Context m_context
protected org.apache.avalon.framework.service.ServiceManager m_serviceManager
protected org.apache.avalon.excalibur.logger.LoggerManager m_loggerManager
protected org.d_haven.mpool.PoolManager m_poolManager
protected org.d_haven.event.Sink m_commandSink
protected java.lang.ClassLoader m_classLoader
protected org.apache.avalon.fortress.MetaInfoManager m_metaManager
protected org.apache.excalibur.instrument.InstrumentManager m_instrumentManager
protected LifecycleExtensionManager m_extManager
protected org.apache.avalon.framework.context.Context m_componentContext
protected java.util.Map m_mapper
protected java.util.List m_components
protected java.util.List m_shutDownOrder
private ProxyManager m_proxyManager
Constructor Detail |
---|
public AbstractContainer()
Method Detail |
---|
protected void setProxyManager(ProxyManager proxyManager)
proxyManager
- protected ProxyManager getProxyManager() throws java.lang.Exception
java.lang.Exception
- if there is a problempublic void contextualize(org.apache.avalon.framework.context.Context context) throws org.apache.avalon.framework.context.ContextException
contextualize
in interface org.apache.avalon.framework.context.Contextualizable
context
- the impl context
org.apache.avalon.framework.context.ContextException
- if a contexaulization error occurspublic void service(org.apache.avalon.framework.service.ServiceManager serviceManager) throws org.apache.avalon.framework.service.ServiceException
service
in interface org.apache.avalon.framework.service.Serviceable
serviceManager
- the service manager to apply to the impl
org.apache.avalon.framework.service.ServiceException
- is a servicing related error occursprivate void setupExtensionManager(org.apache.avalon.framework.service.ServiceManager serviceManager) throws org.apache.avalon.framework.service.ServiceException
serviceManager
- The serviceManager we are using to determine if the extension manager is being passed.
org.apache.avalon.framework.service.ServiceException
- if the ServiceManager does not live up to its contract.protected void addComponent(ComponentHandlerMetaData metaData) throws java.lang.IllegalArgumentException, java.lang.Exception
ComponentHandler
.
metaData
- the information needed to construct a ComponentHandler for the component
java.lang.IllegalArgumentException
- if the classname defined by the meta data
argument is undefined within the scope of the role manager
java.lang.Exception
- if unable to create a Handler for the componentprivate ComponentHandler getComponentHandler(org.apache.avalon.fortress.MetaInfoEntry metaEntry, ComponentHandlerMetaData metaData) throws java.lang.Exception
metaEntry
- the description of the Role this handler will be formetaData
- the information needed to construct a ComponentHandler for the component
java.lang.Exception
- if unable to provide a componenthandlerprotected org.d_haven.mpool.ObjectFactory createObjectFactory(java.lang.String classname, org.apache.avalon.framework.configuration.Configuration configuration) throws java.lang.Exception
classname
- the classname of objectconfiguration
- the objests configuration
java.lang.ClassNotFoundException
- if the specified class does not exist
java.lang.Exception
public java.lang.Object get(java.lang.String role, java.lang.Object hint) throws org.apache.avalon.framework.service.ServiceException
get
in interface org.apache.avalon.fortress.Container
role
- The role we intend to access a Component for.hint
- The hint that we use as a qualifier
(note: if null, the default implementation is returned).
org.apache.avalon.framework.service.ServiceException
protected java.util.Map createHintMap()
StaticBucketMap
or a synchronized Map
.
Otherwise you will experience erratic behavior due to the nature
of the asyncronous component management.
protected static java.lang.String getRoleKey(java.lang.String role, java.lang.Object hint)
role
- hint
-
public boolean has(java.lang.String role, java.lang.Object hint)
has
in interface org.apache.avalon.fortress.Container
role
- The role we intend to access a Component for.hint
- The hint that we use as a qualifier
(note: if null, the default implementation is returned).
public void initialize() throws CompositeException, java.lang.Exception
initialize
in interface org.apache.avalon.framework.activity.Initializable
CompositeException
- if one or more components could not be initialized.
The system is running properly so if the missing components are
not vital to operation, it should be possible to recover gracefully
java.lang.Exception
private void verifyComponents() throws org.apache.avalon.fortress.util.dag.CyclicDependencyException
org.apache.avalon.fortress.util.dag.CyclicDependencyException
public void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
private java.lang.String getVertexDeps(org.apache.avalon.fortress.util.dag.Vertex vertex)
vertex
- vertex to examine
protected org.apache.avalon.framework.service.ServiceManager getServiceManager()
protected org.apache.avalon.framework.service.ServiceManager provideServiceManager(org.apache.avalon.framework.service.ServiceManager parent) throws org.apache.avalon.framework.service.ServiceException
org.apache.avalon.framework.service.ServiceException
protected org.apache.avalon.framework.context.Context provideComponentContext(org.apache.avalon.framework.context.Context parent) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |