Class DefaultServiceManager

java.lang.Object
org.apache.avalon.framework.service.DefaultServiceManager
All Implemented Interfaces:
ServiceManager

public class DefaultServiceManager extends Object implements ServiceManager
This class is a static implementation of a ServiceManager. Allow ineritance and extension so you can generate a tree of ServiceManager each defining Object scope.
Version:
CVS $Revision: 1.20 $ $Date: 2004/02/11 14:34:26 $
Author:
Avalon Development Team
  • Constructor Details

    • DefaultServiceManager

      public DefaultServiceManager()
      Construct ServiceManager with no parent.
    • DefaultServiceManager

      public DefaultServiceManager(ServiceManager parent)
      Construct ServiceManager with specified parent.
      Parameters:
      parent - this ServiceManager's parent
  • Method Details

    • lookup

      public Object lookup(String key) throws ServiceException
      Retrieve Object by key from ServiceManager.
      Specified by:
      lookup in interface ServiceManager
      Parameters:
      key - the key
      Returns:
      the Object
      Throws:
      ServiceException - if an error occurs
    • hasService

      public boolean hasService(String key)
      Check to see if a Object exists for a key.
      Specified by:
      hasService in interface ServiceManager
      Parameters:
      key - a string identifying the key to check.
      Returns:
      True if the object exists, False if it does not.
    • put

      public void put(String key, Object object)
      Place Object into ServiceManager.
      Parameters:
      key - the object's key
      object - an Object value
    • toString

      public String toString()
      Build a human readable representation of this ServiceManager.
      Overrides:
      toString in class 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 Map getObjectMap()
      Helper method for subclasses to retrieve object map.
      Returns:
      the object map
    • makeReadOnly

      public void makeReadOnly()
      Makes this ServiceManager read-only.
    • checkWriteable

      protected final void checkWriteable() throws IllegalStateException
      Checks if this ServiceManager is writeable.
      Throws:
      IllegalStateException - if this ServiceManager is read-only
    • release

      public void release(Object object)
      Release the Object.
      Specified by:
      release in interface ServiceManager
      Parameters:
      object - The Object to release.