org.apache.avalon.framework.service

Class WrapperServiceSelector

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.

Version:
CVS $Revision: 1.10 $ $Date: 2004/02/11 14:34:26 $
Author:
Avalon Development Team
Since:
4.1.4

Constructor Summary

WrapperServiceSelector(String key, ComponentSelector selector)
This constructor is a constructor for a ComponentServiceManager

Method Summary

boolean
isSelectable(Object policy)
Check to see if a Object exists relative to the supplied policy.
void
release(Object object)
Return the Object when you are finished with it.
Object
select(Object policy)
Select a service based on a policy.

Constructor Details

WrapperServiceSelector

public WrapperServiceSelector(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

Method Details

isSelectable

public boolean isSelectable(Object policy)
Check to see if a Object exists relative to the supplied policy.
Parameters:
policy - a Object containing the selection criteria
Returns:
True if the component is available, False if it not.

release

public void release(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.
Parameters:
object - The Object we are releasing.

select

public Object select(Object policy)
            throws ServiceException
Select a service based on a policy.
Parameters:
policy - the policy
Returns:
the service