org.apache.avalon.framework.service.ServiceManagerpublic class DefaultServiceManager
extends java.lang.Object
implements org.apache.avalon.framework.service.ServiceManager
ServiceManager. Allow ineritance
and extension so you can generate a tree of ServiceManager each defining
Object scope.| Modifier and Type | Field | Description |
|---|---|---|
private java.util.HashMap |
m_objects |
|
private org.apache.avalon.framework.service.ServiceManager |
m_parent |
|
private boolean |
m_readOnly |
| Constructor | Description |
|---|---|
DefaultServiceManager() |
Construct
ServiceManager with no parent. |
DefaultServiceManager(org.apache.avalon.framework.service.ServiceManager parent) |
Construct
ServiceManager with specified parent. |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
checkWriteable() |
Checks if this
ServiceManager is writeable. |
protected java.util.Map |
getObjectMap() |
Helper method for subclasses to retrieve object map.
|
protected org.apache.avalon.framework.service.ServiceManager |
getParent() |
Helper method for subclasses to retrieve parent.
|
boolean |
hasService(java.lang.String key) |
Check to see if a
Object exists for a key. |
java.lang.Object |
lookup(java.lang.String key) |
Retrieve
Object by key from ServiceManager. |
void |
makeReadOnly() |
Makes this
ServiceManager read-only. |
void |
put(java.lang.String key,
java.lang.Object object) |
Place
Object into ServiceManager. |
void |
release(java.lang.Object object) |
Release the
Object. |
java.lang.String |
toString() |
Build a human readable representation of this
ServiceManager. |
private final java.util.HashMap m_objects
private final org.apache.avalon.framework.service.ServiceManager m_parent
private boolean m_readOnly
public DefaultServiceManager()
ServiceManager with no parent.public DefaultServiceManager(org.apache.avalon.framework.service.ServiceManager parent)
ServiceManager with specified parent.parent - this ServiceManager's parentpublic java.lang.Object lookup(java.lang.String key)
throws org.apache.avalon.framework.service.ServiceException
Object by key from ServiceManager.lookup in interface org.apache.avalon.framework.service.ServiceManagerkey - the keyObjectorg.apache.avalon.framework.service.ServiceException - if an error occurspublic boolean hasService(java.lang.String key)
Object exists for a key.hasService in interface org.apache.avalon.framework.service.ServiceManagerkey - a string identifying the key to check.public void put(java.lang.String key,
java.lang.Object object)
Object into ServiceManager.key - the object's keyobject - an Object valuepublic java.lang.String toString()
ServiceManager.toString in class java.lang.ObjectServiceManagerprotected final org.apache.avalon.framework.service.ServiceManager getParent()
ServiceManagerprotected final java.util.Map getObjectMap()
public void makeReadOnly()
ServiceManager read-only.protected final void checkWriteable()
throws java.lang.IllegalStateException
ServiceManager is writeable.java.lang.IllegalStateException - if this ServiceManager is
read-onlypublic void release(java.lang.Object object)
Object.release in interface org.apache.avalon.framework.service.ServiceManagerobject - The Object to release.