|
||||||||||
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 String |
DEFAULT_ENTRY
The hint map's entry to get the default component type. |
protected 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 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 InstrumentManager |
m_instrumentManager
contains the impl's InstrumentManager, which is extracted from m_serviceManager. |
protected LoggerManager |
m_loggerManager
contains the impl's LoggerManager, which is extracted from m_serviceManager. |
protected Map |
m_mapper
Contains entries mapping roles to hint maps, where the hint map contains mappings from hints to ComponentHandlers. |
protected 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. |
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 List |
m_shutDownOrder
|
static 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 Map |
createHintMap()
Create the hint map for a role. |
protected org.d_haven.mpool.ObjectFactory |
createObjectFactory(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. |
Object |
get(String role,
Object hint)
This is the method that the ContainerComponentManager and Selector use to gain access to the ComponentHandlers and ComponentSelectors. |
protected ProxyManager |
getProxyManager()
Guarantees that the ProxyManager will be assigned before use. |
protected static String |
getRoleKey(String role,
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. |
boolean |
has(String role,
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. |
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 String DEFAULT_ENTRY
public static final String SELECTOR_ENTRY
protected org.apache.avalon.framework.context.Context m_context
protected org.apache.avalon.framework.service.ServiceManager m_serviceManager
protected LoggerManager m_loggerManager
protected org.d_haven.mpool.PoolManager m_poolManager
protected org.d_haven.event.Sink m_commandSink
protected ClassLoader m_classLoader
protected MetaInfoManager m_metaManager
protected InstrumentManager m_instrumentManager
protected LifecycleExtensionManager m_extManager
protected org.apache.avalon.framework.context.Context m_componentContext
protected Map m_mapper
protected List m_components
protected List m_shutDownOrder
Constructor Detail |
---|
public AbstractContainer()
Method Detail |
---|
protected void setProxyManager(ProxyManager proxyManager)
proxyManager
- protected ProxyManager getProxyManager() throws Exception
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 occursprotected void addComponent(ComponentHandlerMetaData metaData) throws IllegalArgumentException, Exception
ComponentHandler
.
metaData
- the information needed to construct a ComponentHandler for the component
IllegalArgumentException
- if the classname defined by the meta data
argument is undefined within the scope of the role manager
Exception
- if unable to create a Handler for the componentprotected org.d_haven.mpool.ObjectFactory createObjectFactory(String classname, org.apache.avalon.framework.configuration.Configuration configuration) throws Exception
classname
- the classname of objectconfiguration
- the objests configuration
ClassNotFoundException
- if the specified class does not exist
Exception
public Object get(String role, Object hint) throws org.apache.avalon.framework.service.ServiceException
get
in interface 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 Map createHintMap()
StaticBucketMap
or a synchronized Map
.
Otherwise you will experience erratic behavior due to the nature
of the asyncronous component management.
protected static String getRoleKey(String role, Object hint)
role
- hint
-
public boolean has(String role, Object hint)
has
in interface 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, 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
Exception
public void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
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 Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |