Top Description Fields Constructors Methods
org.apache.avalon.framework.component

public Class WrapperComponentSelector

extends Object
implements ComponentSelector
Class Inheritance
All Implemented Interfaces
org.apache.avalon.framework.component.ComponentSelector, org.apache.avalon.framework.component.Component
Imports
org.apache.avalon.framework.service.ServiceSelector, .ServiceException

This is a ServiceSelector implementation that can wrap around a legacy ComponentSelector object effectively adapting a ComponentSelector interface to a ServiceSelector interface.
Author
Avalon Development Team
Since
4.1.4
Version
$Id: WrapperComponentSelector.java 506231 2007-02-12 02:36:54Z crossley $

Field Summary

Modifier and TypeField and Description
private final String
m_key

The role that this selector was aquired via.

private final ServiceSelector
m_selector

The Selector we are wrapping.

Constructor Summary

AccessConstructor and Description
public
WrapperComponentSelector(final String
the key used to aquire this selector
key
,
final ServiceSelector
the selector to wrap
selector
)

This constructor is a constructor for a WrapperComponentSelector.

Method Summary

Modifier and TypeMethod and Description
pack-priv ServiceSelector

Returns:

The ServiceSelector being wrapped.
getWrappedSelector
()

The WrapperComponentManager wraps ServiceSelectors in WrapperServiceSelectors when they are looked up.

public boolean

Returns:

True if the component is available, False if it not.
hasComponent
(final Object
a Object containing the selection criteria
policy
)

Implements org.apache.avalon.framework.component.ComponentSelector.hasComponent.

Check to see if a Component exists relative to the supplied policy.
public void
release(final Component
The Object we are releasing.
object
)

Implements org.apache.avalon.framework.component.ComponentSelector.release.

Return the Object when you are finished with it.
public Component

Returns:

the Component
select
(final Object
the policy
policy
)

Implements org.apache.avalon.framework.component.ComponentSelector.select.

Select a Component based on a policy.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_keyback to summary
private final String m_key

The role that this selector was aquired via.

m_selectorback to summary
private final ServiceSelector m_selector

The Selector we are wrapping.

Constructor Detail

WrapperComponentSelectorback to summary
public WrapperComponentSelector(final String key, final ServiceSelector selector)

This constructor is a constructor for a WrapperComponentSelector.

Parameters
key:String

the key used to aquire this selector

selector:ServiceSelector

the selector to wrap

Method Detail

getWrappedSelectorback to summary
pack-priv 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:ServiceSelector

The ServiceSelector being wrapped.

hasComponentback to summary
public boolean hasComponent(final Object policy)

Implements org.apache.avalon.framework.component.ComponentSelector.hasComponent.

Check to see if a Component exists relative to the supplied policy.

Parameters
policy:Object

a Object containing the selection criteria

Returns:boolean

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

releaseback to summary
public void release(final Component object)

Implements org.apache.avalon.framework.component.ComponentSelector.release.

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:Component

The Object we are releasing.

selectback to summary
public Component select(final Object policy) throws ComponentException

Implements org.apache.avalon.framework.component.ComponentSelector.select.

Select a Component based on a policy.

Parameters
policy:Object

the policy

Returns:Component

the Component

Exceptions
ComponentException:
if unable to select service