|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.avalon.fortress.impl.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 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 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 java.util.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 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(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,
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. |
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 ServiceManager |
getServiceManager()
Exposes to subclasses the service manager which this impl uses to manage its child components. |
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 Context |
provideComponentContext(Context parent)
Override this method to control what context will be passed to the components created by this container. |
protected ServiceManager |
provideServiceManager(ServiceManager parent)
Override this method to control creation of the serviceManager belonging to this container. |
void |
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 java.lang.String DEFAULT_ENTRY
public static final java.lang.String SELECTOR_ENTRY
protected Context m_context
protected ServiceManager m_serviceManager
protected 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 MetaInfoManager m_metaManager
protected InstrumentManager m_instrumentManager
protected LifecycleExtensionManager m_extManager
protected Context m_componentContext
protected java.util.Map m_mapper
protected java.util.List m_components
protected java.util.List m_shutDownOrder
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(Context context) throws ContextException
contextualize
in interface Contextualizable
context
- the impl context
ContextException
- if a contexaulization error occurspublic void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
serviceManager
- the service manager to apply to the impl
ServiceException
- is a servicing related error occursprotected 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 componentprotected org.d_haven.mpool.ObjectFactory createObjectFactory(java.lang.String classname, 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 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).
ServiceException
- if the container cannot get the componentprotected 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 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 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
- if an error occurspublic void dispose()
dispose
in interface Disposable
protected ServiceManager getServiceManager()
protected ServiceManager provideServiceManager(ServiceManager parent) throws ServiceException
ServiceException
protected Context provideComponentContext(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 |