|
Keel 2.1RC2 | ||||||||||
| 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
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_ENTRYThe hint map's entry to get the default component type. |
protected java.lang.ClassLoader |
m_classLoadercontains the impl's root ClassLoader, which is extracted from m_serviceManager. |
protected Sink |
m_commandSinkcontains the impl's Sink, which is extracted from m_serviceManager. |
protected Context |
m_componentContextcontains the context that will be passed to the components we will create. |
protected java.util.List |
m_componentsContains an entry for each ComponentHandler |
protected Context |
m_contextcontains the impl's context passed in through contextualize(). |
protected LifecycleExtensionManager |
m_extManagercontains the impl's LifecycleExtensionManager, which is extracted from m_serviceManager. |
protected InstrumentManager |
m_instrumentManagercontains the impl's InstrumentManager, which is extracted from m_serviceManager. |
protected LoggerManager |
m_loggerManagercontains the impl's LoggerManager, which is extracted from m_serviceManager. |
protected java.util.Map |
m_mapperContains entries mapping roles to hint maps, where the hint map contains mappings from hints to ComponentHandlers. |
protected MetaInfoManager |
m_metaManagercontains the impl's RoleManager, which is extracted from m_serviceManager. |
protected PoolManager |
m_poolManagercontains the impl's PoolManager, which is extracted from m_serviceManager. |
private ProxyManager |
m_proxyManager |
protected ServiceManager |
m_serviceManagercontains 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_ENTRYThe component map's entry to get a ServiceSelector. |
| Fields inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
|
| 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 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. |
private ComponentHandler |
getComponentHandler(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 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. |
private void |
setupExtensionManager(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 Context m_context
protected ServiceManager m_serviceManager
protected LoggerManager m_loggerManager
protected PoolManager m_poolManager
protected 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
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 problem
public void contextualize(Context context)
throws ContextException
contextualize in interface Contextualizablecontext - the impl contextContextException - if a contexaulization error occurs
public void service(ServiceManager serviceManager)
throws ServiceException
service in interface ServiceableserviceManager - the service manager to apply to the implServiceException - is a servicing related error occurs
private void setupExtensionManager(ServiceManager serviceManager)
throws ServiceException
serviceManager - The serviceManager we are using to determine if the extension manager is being passed.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 componentjava.lang.IllegalArgumentException - if the classname defined by the meta data argument is undefined within the scope of the role managerjava.lang.Exception - if unable to create a Handler for the component
private ComponentHandler getComponentHandler(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 componentjava.lang.Exception - if unable to provide a componenthandler
protected ObjectFactory createObjectFactory(java.lang.String classname,
Configuration configuration)
throws java.lang.Exception
classname - the classname of objectconfiguration - the objests configurationjava.lang.ClassNotFoundException - if the specified class does not existjava.lang.Exception
public java.lang.Object get(java.lang.String role,
java.lang.Object hint)
throws ServiceException
get in interface Containerrole - 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 Containerrole - 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 InitializableCompositeException - 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 gracefullyjava.lang.Exception - if an error occurs
private void verifyComponents()
throws CyclicDependencyException
CyclicDependencyExceptionpublic void dispose()
dispose in interface Disposableprotected ServiceManager getServiceManager()
protected ServiceManager provideServiceManager(ServiceManager parent)
throws ServiceException
ServiceException
protected Context provideComponentContext(Context parent)
throws java.lang.Exception
java.lang.Exception
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||