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 ofServiceManager
each defining Object scope.- Version:
- CVS $Revision: 1.18 $ $Date: 2003/02/11 15:58:42 $
- Author:
- Avalon Development Team
-
-
Constructor Summary
Constructors Constructor Description DefaultServiceManager()
ConstructServiceManager
with no parent.DefaultServiceManager(ServiceManager parent)
ConstructServiceManager
with specified parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkWriteable()
Checks if thisServiceManager
is writeable.protected java.util.Map
getObjectMap()
Helper method for subclasses to retrieve object map.protected ServiceManager
getParent()
Helper method for subclasses to retrieve parent.boolean
hasService(java.lang.String key)
Check to see if aObject
exists for a key.java.lang.Object
lookup(java.lang.String key)
RetrieveObject
by key fromServiceManager
.void
makeReadOnly()
Makes thisServiceManager
read-only.void
put(java.lang.String key, java.lang.Object object)
PlaceObject
intoServiceManager
.void
release(java.lang.Object object)
Release theObject
.java.lang.String
toString()
Build a human readable representation of thisServiceManager
.
-
-
-
Constructor Detail
-
DefaultServiceManager
public DefaultServiceManager()
ConstructServiceManager
with no parent.
-
DefaultServiceManager
public DefaultServiceManager(ServiceManager parent)
ConstructServiceManager
with specified parent.- Parameters:
parent
- thisServiceManager
's parent
-
-
Method Detail
-
lookup
public java.lang.Object lookup(java.lang.String key) throws ServiceException
RetrieveObject
by key fromServiceManager
.- Specified by:
lookup
in 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 aObject
exists for a key.- Specified by:
hasService
in 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)
PlaceObject
intoServiceManager
.- Parameters:
key
- the object's keyobject
- anObject
value
-
toString
public java.lang.String toString()
Build a human readable representation of thisServiceManager
.- Overrides:
toString
in 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 thisServiceManager
read-only.
-
checkWriteable
protected final void checkWriteable() throws java.lang.IllegalStateException
Checks if thisServiceManager
is writeable.- Throws:
java.lang.IllegalStateException
- if thisServiceManager
is read-only
-
release
public void release(java.lang.Object object)
Release theObject
.- Specified by:
release
in interfaceServiceManager
- Parameters:
object
- TheObject
to release.
-
-