org.apache.avalon.framework.service
Class WrapperServiceSelector
java.lang.Object
org.apache.avalon.framework.service.WrapperServiceSelector
- All Implemented Interfaces:
- ServiceSelector
- public class WrapperServiceSelector
- extends java.lang.Object
- implements ServiceSelector
This is a ServiceSelector implementation that can wrap around a legacy ComponentSelector object effectively adapting a ComponentSelector interface to a ServiceSelector interface.
This class implements the Component interface because it is used in environments which expect all components to implement Component.
- Since:
- 4.1.4
- Version:
- CVS $Revision: 1.8 $ $Date: 2003/03/12 12:08:46 $
- Author:
| Method Summary |
(package private) ComponentSelector |
getWrappedSelector()
The WrapperServiceManager wraps ComponentSelectors in WrapperServiceSelectors when they are looked up. |
boolean |
isSelectable(java.lang.Object policy)
Check to see if a Object exists relative to the supplied policy. |
void |
release(java.lang.Object object)
Return the Object when you are finished with it. |
java.lang.Object |
select(java.lang.Object policy)
Select a service based on a policy. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_selector
private final ComponentSelector m_selector
-
The Selector we are wrapping.
m_key
private final java.lang.String m_key
-
The role that this selector was aquired via.
WrapperServiceSelector
public WrapperServiceSelector(java.lang.String key,
ComponentSelector selector)
-
This constructor is a constructor for a ComponentServiceManager
- Parameters:
key - the key used to aquire this selector
selector - the selector to wrap
select
public java.lang.Object select(java.lang.Object policy)
throws ServiceException
-
Select a service based on a policy.
-
- Specified by:
select in interface ServiceSelector
-
- Parameters:
policy - the policy
- Returns:
- the service
- Throws:
ServiceException - if unable to select service
isSelectable
public boolean isSelectable(java.lang.Object policy)
-
Check to see if a
Object exists relative to the supplied policy.
-
- Specified by:
isSelectable in interface ServiceSelector
-
- Parameters:
policy - a Object containing the selection criteria
- Returns:
- True if the component is available, False if it not.
release
public void release(java.lang.Object object)
-
Return the
Object when you are finished with it. This allows the ServiceSelector 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 ServiceSelector system without having to trap Exceptions on a release.
-
- Specified by:
release in interface ServiceSelector
-
- Parameters:
object - The Object we are releasing.
getWrappedSelector
ComponentSelector getWrappedSelector()
-
The
WrapperServiceManager wraps ComponentSelectors in WrapperServiceSelectors when they are looked up. This method makes it possible to release the original component selector.
-
-
- Returns:
- The
ComponentSelector being wrapped.
Please see keelframework.org for information about new Keel releases.