org.apache.avalon.framework.component

Class WrapperComponentSelector

public class WrapperComponentSelector extends Object implements ComponentSelector

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

Since: 4.1.4

Version: $Id: WrapperComponentSelector.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $

Author: Avalon Development Team

Field Summary
Stringm_key
The role that this selector was aquired via.
ServiceSelectorm_selector
The Selector we are wrapping.
Constructor Summary
WrapperComponentSelector(String key, ServiceSelector selector)
This constructor is a constructor for a WrapperComponentSelector.
Method Summary
ServiceSelectorgetWrappedSelector()
The WrapperComponentManager wraps ServiceSelectors in WrapperServiceSelectors when they are looked up.
booleanhasComponent(Object policy)
Check to see if a Component exists relative to the supplied policy.
voidrelease(Component object)
Return the Object when you are finished with it.
Componentselect(Object policy)
Select a Component based on a policy.

Field Detail

m_key

private final String m_key
The role that this selector was aquired via.

m_selector

private final ServiceSelector m_selector
The Selector we are wrapping.

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

getWrappedSelector

ServiceSelector getWrappedSelector()
The WrapperComponentManager wraps ServiceSelectors in WrapperServiceSelectors when they are looked up. This method makes it possible to release the original component selector.

Returns: The ServiceSelector being wrapped.

hasComponent

public boolean hasComponent(Object policy)
Check to see if a Component 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(Component 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 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