org.apache.avalon.framework.service

Class WrapperServiceSelector

public class WrapperServiceSelector extends Object implements ServiceSelector

This is a {@link ServiceSelector} implementation that can wrap around a legacy {@link ComponentSelector} object effectively adapting a {@link ComponentSelector} interface to a {@link ServiceSelector} interface.

This class implements the {@link 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
WrapperServiceSelector(String key, ComponentSelector selector)
This constructor is a constructor for a ComponentServiceManager
Method Summary
booleanisSelectable(Object policy)
Check to see if a {@link Object} exists relative to the supplied policy.
voidrelease(Object object)
Return the {@link Object} when you are finished with it.
Objectselect(Object policy)
Select a service based on a policy.

Constructor Detail

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 Detail

isSelectable

public boolean isSelectable(Object policy)
Check to see if a {@link Object} exists relative to the supplied policy.

Parameters: policy a {@link Object} containing the selection criteria

Returns: True if the component is available, False if it not.

release

public void release(Object object)
Return the {@link Object} when you are finished with it. This allows the {@link ServiceSelector} to handle the End-Of-Life Lifecycle events associated with the {@link 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 {@link Object} we are releasing.

select

public Object select(Object policy)
Select a service based on a policy.

Parameters: policy the policy

Returns: the service

Throws: ServiceException if unable to select service