public class BeanContextServicesSupport extends BeanContextSupport implements BeanContextServices, Serializable
BeanContextServices
interface.
This class can be used directly, or be a super class of your class, or be a
delegate of your implementation that needs to support
BeanContextServices
interface.beanContextChildPeer
globalHierarchyLock
PROPERTYNAME
Constructor and Description |
---|
BeanContextServicesSupport()
Constructs a standard
BeanContextServicesSupport . |
BeanContextServicesSupport(BeanContextServices peer)
Constructs a
BeanContextServicesSupport which is a
delegate of the given peer. |
BeanContextServicesSupport(BeanContextServices peer,
Locale locale)
Constructs a
BeanContextServicesSupport which is a
delegate of the given peer. |
BeanContextServicesSupport(BeanContextServices peer,
Locale locale,
boolean designTime)
Constructs a
BeanContextServicesSupport which is a
delegate of the given peer. |
BeanContextServicesSupport(BeanContextServices peer,
Locale locale,
boolean designTime,
boolean okToUseGui)
Constructs a
BeanContextServicesSupport which is a
delegate of the given peer. |
Modifier and Type | Method and Description |
---|---|
void |
addBeanContextServicesListener(BeanContextServicesListener listener) |
boolean |
addService(Class serviceClass,
BeanContextServiceProvider provider)
Add a service to this context.
|
BeanContextServices |
getBeanContextServicesPeer()
Returns the peer of this context casted as
BeanContextServices . |
Iterator |
getCurrentServiceClasses()
Returns an iterator of all registered service classes, with
removed() disabled. |
Iterator |
getCurrentServiceSelectors(Class serviceClass)
Returns the service selectors of the specified service.
|
Object |
getService(BeanContextChild child,
Object requestor,
Class serviceClass,
Object serviceSelector,
BeanContextServiceRevokedListener bcsrl)
Get a service instance on behalf of the specified child of this context,
by calling the registered service provider, or by delegating to the
parent context.
|
boolean |
hasService(Class serviceClass)
Checks whether a service is registed in this context or the parent
context.
|
void |
initialize()
Initializes all transient fields of this instance, called by
constructors and
readObject() . |
void |
releaseService(BeanContextChild child,
Object requestor,
Object service)
Release a service which has been requested previously.
|
void |
removeBeanContextServicesListener(BeanContextServicesListener listener) |
void |
revokeService(Class serviceClass,
BeanContextServiceProvider serviceProvider,
boolean revokeCurrentServicesNow)
Revokes a service in this bean context.
|
void |
serviceAvailable(BeanContextServiceAvailableEvent event)
Notify all listeners and children that implements
BeanContextServices of the event. |
void |
serviceRevoked(BeanContextServiceRevokedEvent event)
Notify all listeners and children that implements
BeanContextServices of the event. |
add, addAll, addBeanContextMembershipListener, avoidingGui, clear, contains, containsAll, containsKey, dontUseGui, getBeanContextPeer, getLocale, getResource, getResourceAsStream, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, removeAll, removeBeanContextMembershipListener, retainAll, setDesignTime, setLocale, size, toArray, toArray, vetoableChange, writeChildren
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, validatePendingSetBeanContext
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListener
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
isDesignTime, setDesignTime
avoidingGui, dontUseGui, needsGui, okToUseGui
public BeanContextServicesSupport()
BeanContextServicesSupport
.public BeanContextServicesSupport(BeanContextServices peer)
BeanContextServicesSupport
which is a
delegate of the given peer.peer
- the peer of this contextpublic BeanContextServicesSupport(BeanContextServices peer, Locale locale)
BeanContextServicesSupport
which is a
delegate of the given peer.peer
- the peer of this contextlocale
- the locale of this contextpublic BeanContextServicesSupport(BeanContextServices peer, Locale locale, boolean designTime)
BeanContextServicesSupport
which is a
delegate of the given peer.peer
- the peer of this contextlocale
- the locale of this contextdesignTime
- whether in design mode or notpublic BeanContextServicesSupport(BeanContextServices peer, Locale locale, boolean designTime, boolean okToUseGui)
BeanContextServicesSupport
which is a
delegate of the given peer.peer
- the peer of this contextlocale
- the locale of this contextdesignTime
- whether in design mode or notokToUseGui
- whether GUI is usable or notpublic void addBeanContextServicesListener(BeanContextServicesListener listener)
addBeanContextServicesListener
in interface BeanContextServices
public boolean addService(Class serviceClass, BeanContextServiceProvider provider)
Delegate to addService(serviceClass, provider, true)
.
addService
in interface BeanContextServices
BeanContextServices.addService(java.lang.Class,
jadex.commons.beans.beancontext.BeanContextServiceProvider)
public BeanContextServices getBeanContextServicesPeer()
BeanContextServices
.BeanContextServices
public Iterator getCurrentServiceClasses()
removed()
disabled.getCurrentServiceClasses
in interface BeanContextServices
BeanContextServices.getCurrentServiceClasses()
public Iterator getCurrentServiceSelectors(Class serviceClass)
remove()
operation is disabled.getCurrentServiceSelectors
in interface BeanContextServices
BeanContextServices.getCurrentServiceSelectors(java.lang.Class)
public Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException
getService
in interface BeanContextServices
child
- the child that request servicerequestor
- the requestor objectserviceClass
- the service classserviceSelector
- the service selectorsbcsrl
- the BeanContextServiceRevokedListener
IllegalArgumentException
- if child
is not a child of this contextTooManyListenersException
BeanContextServices.getService(jadex.commons.beans.beancontext.BeanContextChild,
java.lang.Object, java.lang.Class, java.lang.Object,
jadex.commons.beans.beancontext.BeanContextServiceRevokedListener)
public boolean hasService(Class serviceClass)
hasService
in interface BeanContextServices
serviceClass
- the service classBeanContextServices.hasService(java.lang.Class)
public void initialize()
BeanContextSupport
readObject()
.public void releaseService(BeanContextChild child, Object requestor, Object service)
releaseService
in interface BeanContextServices
child
- the child that request the servicerequestor
- the requestor objectservice
- the service instanceIllegalArgumentException
- if child
is not a child of this contextpublic void removeBeanContextServicesListener(BeanContextServicesListener listener)
removeBeanContextServicesListener
in interface BeanContextServices
public void revokeService(Class serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow)
The given service provider is unregistered and a
BeanContextServiceRevokedEvent
is fired. All registered
service listeners and current service users get notified.
revokeService
in interface BeanContextServices
serviceClass
- the service classserviceProvider
- the service providerrevokeCurrentServicesNow
- true if service should be terminated immediantlyBeanContextServices.revokeService(java.lang.Class,
jadex.commons.beans.beancontext.BeanContextServiceProvider, boolean)
public void serviceAvailable(BeanContextServiceAvailableEvent event)
BeanContextServices
of the event.serviceAvailable
in interface BeanContextServicesListener
serviceAvailable
in class BeanContextChildSupport
BeanContextServicesListener.serviceAvailable(jadex.commons.beans.beancontext.BeanContextServiceAvailableEvent)
public void serviceRevoked(BeanContextServiceRevokedEvent event)
BeanContextServices
of the event.serviceRevoked
in interface BeanContextServiceRevokedListener
serviceRevoked
in class BeanContextChildSupport
BeanContextServiceRevokedListener.serviceRevoked(jadex.commons.beans.beancontext.BeanContextServiceRevokedEvent)
Copyright © 2013. All Rights Reserved.