org.apache.avalon.fortress.impl.lookup
Class FortressServiceManager
java.lang.Object
org.apache.avalon.fortress.impl.lookup.FortressServiceManager
- All Implemented Interfaces:
- ServiceManager
- Direct Known Subclasses:
- KeelServiceManager
- public class FortressServiceManager
- extends java.lang.Object
- implements ServiceManager
This is the Default ServiceManager for the Container. It provides a very simple abstraction, and makes it easy for the Container to manage the references.
- Version:
- CVS $Revision: 1.22 $ $Date: 2004/03/13 17:57:59 $
- Author:
| Method Summary |
boolean |
hasService(java.lang.String role)
Check to see if a Object exists for a key. |
java.lang.Object |
lookup(java.lang.String role)
Get the Object associated with the given key. |
private FortressServiceManager.Lookup |
parseRole(java.lang.String role)
|
void |
release(java.lang.Object component)
Return the Object when you are finished with it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_container
private final Container m_container
-
m_used
private final java.util.Map m_used
-
m_parent
private final ServiceManager m_parent
-
FortressServiceManager
public FortressServiceManager(Container container,
ServiceManager parent)
throws java.lang.NullPointerException
-
This constructor is for a ContainerComponentManager with a parent ComponentLocator
- Parameters:
container - the impl
parent - the parent service manager
- Throws:
java.lang.NullPointerException - if the supplied impl is null
lookup
public java.lang.Object lookup(java.lang.String role)
throws ServiceException
- Description copied from interface:
ServiceManager
-
Get the
Object associated with the given key. For instance, If the ServiceManager had a LoggerComponent stored and referenced by key, the following could be used:
try
{
LoggerComponent log;
myComponent = (LoggerComponent) manager.lookup( LoggerComponent.ROLE );
}
catch (...)
{
...
}
-
- Specified by:
lookup in interface ServiceManager
-
- Parameters:
role - The lookup key of the Object to retrieve.
- Returns:
- an
Object value
- Throws:
ServiceException - if an error occurs
hasService
public boolean hasService(java.lang.String role)
- Description copied from interface:
ServiceManager
-
Check to see if a
Object exists for a key.
-
- Specified by:
hasService in interface ServiceManager
-
- Parameters:
role - a string identifying the key to check.
- Returns:
- True if the object exists, False if it does not.
release
public void release(java.lang.Object component)
- Description copied from interface:
ServiceManager
-
Return the
Object when you are finished with it. This allows the ServiceManager to handle the End-Of-Life Lifecycle events associated with the Object. Please note, that no Exception should be thrown at this point. This is to allow easy use of the ServiceManager system without having to trap Exceptions on a release.
-
- Specified by:
release in interface ServiceManager
-
- Parameters:
component - The Object we are releasing.
parseRole
private FortressServiceManager.Lookup parseRole(java.lang.String role)
-
-
Please see keelframework.org for information about new Keel releases.