Class DefaultComponentManager
- java.lang.Object
-
- org.apache.avalon.framework.component.DefaultComponentManager
-
- All Implemented Interfaces:
org.apache.avalon.framework.component.ComponentManager
public class DefaultComponentManager extends java.lang.Object implements org.apache.avalon.framework.component.ComponentManagerThis class is a static implementation of a ComponentManager. Allow ineritance and extension so you can generate a tree of ComponentManager each defining Component scope.Deprecated: Use
DefaultServiceManagerinstead.- Version:
- $Id: DefaultComponentManager.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMapm_componentsprivate org.apache.avalon.framework.component.ComponentManagerm_parentprivate booleanm_readOnly
-
Constructor Summary
Constructors Constructor Description DefaultComponentManager()Construct ComponentManager with no parent.DefaultComponentManager(org.apache.avalon.framework.component.ComponentManager parent)Construct ComponentManager with specified parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckWriteable()Check if this component m_manager is writeable.protected java.util.MapgetComponentMap()Helper method for subclasses to retrieve component map.protected org.apache.avalon.framework.component.ComponentManagergetParent()Helper method for subclasses to retrieve parent.booleanhasComponent(java.lang.String key)Returnstrueif the component m_manager is managing a component with the specified key,falseotherwise.org.apache.avalon.framework.component.Componentlookup(java.lang.String key)Retrieve Component by key from ComponentManager.voidmakeReadOnly()Make this component m_manager read only.voidput(java.lang.String key, org.apache.avalon.framework.component.Component component)Place Component into ComponentManager.voidrelease(org.apache.avalon.framework.component.Component component)Release component.java.lang.StringtoString()Build a human readable representation of ComponentManager.
-
-
-
Constructor Detail
-
DefaultComponentManager
public DefaultComponentManager()
Construct ComponentManager with no parent.
-
DefaultComponentManager
public DefaultComponentManager(org.apache.avalon.framework.component.ComponentManager parent)
Construct ComponentManager with specified parent.- Parameters:
parent- the ComponentManagers parent
-
-
Method Detail
-
lookup
public org.apache.avalon.framework.component.Component lookup(java.lang.String key) throws org.apache.avalon.framework.component.ComponentExceptionRetrieve Component by key from ComponentManager.- Specified by:
lookupin interfaceorg.apache.avalon.framework.component.ComponentManager- Parameters:
key- the key- Returns:
- the Component
- Throws:
org.apache.avalon.framework.component.ComponentException- if an error occurs
-
hasComponent
public boolean hasComponent(java.lang.String key)
Returnstrueif the component m_manager is managing a component with the specified key,falseotherwise.- Specified by:
hasComponentin interfaceorg.apache.avalon.framework.component.ComponentManager- Parameters:
key- key of the component you are lokking for- Returns:
trueif the component m_manager has a component with that key
-
put
public void put(java.lang.String key, org.apache.avalon.framework.component.Component component)Place Component into ComponentManager.- Parameters:
key- the components keycomponent- the component
-
release
public void release(org.apache.avalon.framework.component.Component component)
Release component.- Specified by:
releasein interfaceorg.apache.avalon.framework.component.ComponentManager- Parameters:
component- the component
-
toString
public java.lang.String toString()
Build a human readable representation of ComponentManager.- Overrides:
toStringin classjava.lang.Object- Returns:
- the description of ComponentManager
-
getParent
protected final org.apache.avalon.framework.component.ComponentManager getParent()
Helper method for subclasses to retrieve parent.- Returns:
- the parent ComponentManager
-
getComponentMap
protected final java.util.Map getComponentMap()
Helper method for subclasses to retrieve component map.- Returns:
- the component map
-
makeReadOnly
public void makeReadOnly()
Make this component m_manager read only.
-
checkWriteable
protected final void checkWriteable() throws java.lang.IllegalStateExceptionCheck if this component m_manager is writeable.- Throws:
java.lang.IllegalStateException- if this component m_manager is read-only
-
-