org.apache.avalon.framework.component

Class WrapperComponentSelector

public class WrapperComponentSelector extends Object implements ComponentSelector

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.

Version: CVS $Revision: 1.8 $ $Date: 2003/02/11 07:13:45 $

Author: Avalon Development Team

Constructor Summary
WrapperComponentSelector(String key, ServiceSelector selector)
This constructor is a constructor for a WrapperComponentSelector.
Method Summary
booleanhasComponent(Object policy)
Check to see if a {@link Component} exists relative to the supplied policy.
voidrelease(Component object)
Return the {@link Object} when you are finished with it.
Componentselect(Object policy)
Select a Component based on a policy.

Constructor Detail

WrapperComponentSelector

public WrapperComponentSelector(String key, ServiceSelector selector)
This constructor is a constructor for a WrapperComponentSelector.

Parameters: key the key used to aquire this selector selector the selector to wrap

Method Detail

hasComponent

public boolean hasComponent(Object policy)
Check to see if a {@link Component} 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(Component 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 Component select(Object policy)
Select a Component based on a policy.

Parameters: policy the policy

Returns: the Component

Throws: ComponentException if unable to select service