Class DefaultServiceManager
- java.lang.Object
-
- org.apache.avalon.framework.service.DefaultServiceManager
-
- All Implemented Interfaces:
ServiceManager
public class DefaultServiceManager extends java.lang.Object implements ServiceManager
This class is a static implementation of aServiceManager. Allow ineritance and extension so you can generate a tree ofServiceManagereach defining Object scope.- Version:
- CVS $Revision: 1.20 $ $Date: 2004/02/11 14:34:26 $
- Author:
- Avalon Development Team
-
-
Constructor Summary
Constructors Constructor Description DefaultServiceManager()ConstructServiceManagerwith no parent.DefaultServiceManager(ServiceManager parent)ConstructServiceManagerwith specified parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckWriteable()Checks if thisServiceManageris writeable.protected java.util.MapgetObjectMap()Helper method for subclasses to retrieve object map.protected ServiceManagergetParent()Helper method for subclasses to retrieve parent.booleanhasService(java.lang.String key)Check to see if aObjectexists for a key.java.lang.Objectlookup(java.lang.String key)RetrieveObjectby key fromServiceManager.voidmakeReadOnly()Makes thisServiceManagerread-only.voidput(java.lang.String key, java.lang.Object object)PlaceObjectintoServiceManager.voidrelease(java.lang.Object object)Release theObject.java.lang.StringtoString()Build a human readable representation of thisServiceManager.
-
-
-
Constructor Detail
-
DefaultServiceManager
public DefaultServiceManager()
ConstructServiceManagerwith no parent.
-
DefaultServiceManager
public DefaultServiceManager(ServiceManager parent)
ConstructServiceManagerwith specified parent.- Parameters:
parent- thisServiceManager's parent
-
-
Method Detail
-
lookup
public java.lang.Object lookup(java.lang.String key) throws ServiceExceptionRetrieveObjectby key fromServiceManager.- Specified by:
lookupin interfaceServiceManager- Parameters:
key- the key- Returns:
- the
Object - Throws:
ServiceException- if an error occurs
-
hasService
public boolean hasService(java.lang.String key)
Check to see if aObjectexists for a key.- Specified by:
hasServicein interfaceServiceManager- Parameters:
key- a string identifying the key to check.- Returns:
- True if the object exists, False if it does not.
-
put
public void put(java.lang.String key, java.lang.Object object)PlaceObjectintoServiceManager.- Parameters:
key- the object's keyobject- anObjectvalue
-
toString
public java.lang.String toString()
Build a human readable representation of thisServiceManager.- Overrides:
toStringin classjava.lang.Object- Returns:
- the description of this
ServiceManager
-
getParent
protected final ServiceManager getParent()
Helper method for subclasses to retrieve parent.- Returns:
- the parent
ServiceManager
-
getObjectMap
protected final java.util.Map getObjectMap()
Helper method for subclasses to retrieve object map.- Returns:
- the object map
-
makeReadOnly
public void makeReadOnly()
Makes thisServiceManagerread-only.
-
checkWriteable
protected final void checkWriteable() throws java.lang.IllegalStateExceptionChecks if thisServiceManageris writeable.- Throws:
java.lang.IllegalStateException- if thisServiceManageris read-only
-
release
public void release(java.lang.Object object)
Release theObject.- Specified by:
releasein interfaceServiceManager- Parameters:
object- TheObjectto release.
-
-