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 aServiceSelector
implementation that can wrap around a legacyComponentSelector
object effectively adapting aComponentSelector
interface to aServiceSelector
interface.This class implements the
Component
interface because it is used in environments which expect all components to implement Component.- Version:
- CVS $Revision: 1.7 $ $Date: 2003/02/10 07:19:18 $
- Author:
- Avalon Development Team
-
-
Constructor Summary
Constructors Constructor Description WrapperServiceSelector(java.lang.String key, ComponentSelector selector)
This constructor is a constructor for a ComponentServiceManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isSelectable(java.lang.Object policy)
Check to see if aObject
exists relative to the supplied policy.void
release(java.lang.Object object)
Return theObject
when you are finished with it.java.lang.Object
select(java.lang.Object policy)
Select a service based on a policy.
-
-
-
Constructor Detail
-
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 selectorselector
- the selector to wrap
-
-
Method Detail
-
select
public java.lang.Object select(java.lang.Object policy) throws ServiceException
Select a service based on a policy.- Specified by:
select
in interfaceServiceSelector
- 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 aObject
exists relative to the supplied policy.- Specified by:
isSelectable
in interfaceServiceSelector
- Parameters:
policy
- aObject
containing the selection criteria- Returns:
- True if the component is available, False if it not.
-
release
public void release(java.lang.Object object)
Return theObject
when you are finished with it. This allows theServiceSelector
to handle the End-Of-Life Lifecycle events associated with theObject
. 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 interfaceServiceSelector
- Parameters:
object
- TheObject
we are releasing.
-
-