java.beans.beancontext
protected class BeanContextServicesSupport.BCSSProxyServiceProvider extends Object implements BeanContextServiceProvider, BeanContextServiceRevokedListener
Modifier and Type | Method and Description |
---|---|
Iterator |
getCurrentServiceSelectors(BeanContextServices bcs,
Class serviceClass)
Get a list of valid service selectors for the specified service class.
|
Object |
getService(BeanContextServices bcs,
Object requestor,
Class serviceClass,
Object serviceSelector)
Get a service.
|
void |
releaseService(BeanContextServices bcs,
Object requestor,
Object service)
Release the service.
|
void |
serviceRevoked(BeanContextServiceRevokedEvent bcsre)
Called by
BeanContextServices.revokeService() to indicate that a service has been revoked. |
public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass)
BeanContextServiceProvider
BeanContextServices.getCurrentServiceSelectors()
.
If the specified service class does not have a finite number of
valid service selectors, it should return null
.
If it takes a general Integer
parameter, for
example, you may as well return null
or the poor
soul who called this method will be iterating all day.
If it has no valid service selectors, it should still return an empty
Iterator
.
getCurrentServiceSelectors
in interface BeanContextServiceProvider
bcs
- the BeanContextServices
that wants
to get the service selectors. Only weak references to this will
be retained, and it will never be changed, only queried
in a read-only manner.serviceClass
- the service class to get selectors for.null
.BeanContextServices.getCurrentServiceSelectors(java.lang.Class)
public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector)
BeanContextServiceProvider
BeanContextServices.getService()
.
If the requested service class is not available, or if this
BeanContextServiceProvider
chooses not honor the
request for some reason, then this method will return
null
.
getService
in interface BeanContextServiceProvider
bcs
- the BeanContextServices
that wants
to get the service. Only weak references to this will
be retained, and it will never be changed, only queried
in a read-only manner.requestor
- the actual requestor of the service. Only
weak references to this will be retained, and it will
never be changed, only queried in a read-only manner.serviceClass
- the Class
of the service being
requested.serviceSelector
- a parameter to customize the service
returned with.serviceClass
(such that
instanceof
serviceClass is true), or
null
.BeanContextServices.getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener)
public void releaseService(BeanContextServices bcs, Object requestor, Object service)
BeanContextServiceProvider
Called by BeanContextServices.releaseService()
.
Most BeanContextServiceProvider
s won't have to do
anything here.
releaseService
in interface BeanContextServiceProvider
bcs
- the BeanContextServices
that wants
to release the service. Only weak references to this will
be retained, and it will never be changed, only queried
in a read-only manner.requestor
- the original requestor of the service.service
- the service to relinquishBeanContextServices.releaseService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Object)
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre)
BeanContextServiceRevokedListener
BeanContextServices.revokeService()
to indicate that a service has been revoked.
If you have a reference to such a service, it should be
discarded and may no longer function properly.
getService()
will no longer work on the specified
service class after this event has been fired.serviceRevoked
in interface BeanContextServiceRevokedListener
bcsre
- the service revoked event.BeanContextServices.revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean)