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

public Class WrapperServiceSelector

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

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.

Author
Avalon Development Team
Since
4.1.4
Version
$Id: WrapperServiceSelector.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 ComponentSelector
m_selector

The Selector we are wrapping.

Constructor Summary

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

This constructor is a constructor for a ComponentServiceManager

Method Summary

Modifier and TypeMethod and Description
pack-priv ComponentSelector

Returns:

The ComponentSelector being wrapped.
getWrappedSelector
()

The WrapperServiceManager wraps ComponentSelectors in WrapperServiceSelectors when they are looked up.

public boolean

Returns:

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

Implements org.apache.avalon.framework.service.ServiceSelector.isSelectable.

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

Implements org.apache.avalon.framework.service.ServiceSelector.release.

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

Returns:

the service
select
(final Object
the policy
policy
)

Implements org.apache.avalon.framework.service.ServiceSelector.select.

Select a service 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 ComponentSelector m_selector

The Selector we are wrapping.

Constructor Detail

WrapperServiceSelectorback to summary
public WrapperServiceSelector(final String key, final ComponentSelector selector)

This constructor is a constructor for a ComponentServiceManager

Parameters
key:String

the key used to aquire this selector

selector:ComponentSelector

the selector to wrap

Method Detail

getWrappedSelectorback to summary
pack-priv ComponentSelector getWrappedSelector()

The WrapperServiceManager wraps ComponentSelectors in WrapperServiceSelectors when they are looked up. This method makes it possible to release the original component selector.

Returns:ComponentSelector

The ComponentSelector being wrapped.

isSelectableback to summary
public boolean isSelectable(final Object policy)

Implements org.apache.avalon.framework.service.ServiceSelector.isSelectable.

Check to see if a Object 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(Object object)

Implements org.apache.avalon.framework.service.ServiceSelector.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:Object

The Object we are releasing.

selectback to summary
public Object select(final Object policy) throws ServiceException

Implements org.apache.avalon.framework.service.ServiceSelector.select.

Select a service based on a policy.

Parameters
policy:Object

the policy

Returns:Object

the service

Exceptions
ServiceException:
if unable to select service