public class BeanContextServicesSupport extends BeanContextSupportimplements BeanContextServices
This helper class provides a utility implementation of the java.beans.beancontext.BeanContextServices interface.
Since this class directly implements the BeanContextServices interface, the class can, and is intended to be used either by subclassing this implementation, or via delegation of an instance of this class from another through the BeanContextProxy interface.
| Modifier and Type | Class and Description |
|---|---|
protected class |
BeanContextServicesSupport
|
protected class |
BeanContextServicesSupport
|
protected static class |
BeanContextServicesSupport
subclasses may subclass this nested class to add behaviors for each BeanContextServicesProvider.
|
BeanContextSupport.BCSChild , BeanContextSupport.BCSIterator | Modifier and Type | Field and Description |
|---|---|
protected ArrayList |
bcsListeners
List of
BeanContextServicesListener objects.
|
protected BeanContextServicesSupport |
proxy
Delegate for the
BeanContextServiceProvider.
|
protected int |
serializable
The number of instances of a serializable
BeanContextServceProvider.
|
protected HashMap |
services
all accesses to the
protected transient HashMap services field should be synchronized on that object
|
bcmListeners, children, designTime, locale, okToUseGuibeanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupportglobalHierarchyLockPROPERTYNAME| Constructor and Description |
|---|
BeanContextServicesSupport()
Create an instance that is not a delegate of another object
|
BeanContextServicesSupport(BeanContextServices
Create an instance with a peer
|
BeanContextServicesSupport(BeanContextServices
Create an instance using the specified locale
|
BeanContextServicesSupport(BeanContextServices
Create an instance using the specified Locale and design mode.
|
BeanContextServicesSupport(BeanContextServices
Construct a BeanContextServicesSupport instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBeanContextServicesListener(BeanContextServicesListener
add a BeanContextServicesListener
|
boolean |
addService(Class
add a service
|
protected boolean |
addService(Class
add a service
|
protected void |
bcsPreDeserializationHook(ObjectInputStream
called from BeanContextSupport readObject before it deserializes the children ...
|
protected void |
bcsPreSerializationHook(ObjectOutputStream
called from BeanContextSupport writeObject before it serializes the children ...
|
protected void |
childJustRemovedHook(Object
called from superclass child removal operations after a child has been successfully removed.
|
protected BeanContextSupport |
createBCSChild(Object
Subclasses can override this method to insert their own subclass of Child without having to override add() or the other Collection methods that add children to the set.
|
protected BeanContextServicesSupport |
createBCSSServiceProvider(Class
subclasses can override this method to create new subclasses of BCSSServiceProvider without having to override addService() in order to instantiate.
|
protected void |
fireServiceAdded(BeanContextServiceAvailableEvent
Fires a
BeanContextServiceAvailableEvent indicating that a new service has become available.
|
protected void |
fireServiceAdded(Class
Fires a
BeanContextServiceEvent notifying of a new service.
|
protected void |
fireServiceRevoked(BeanContextServiceRevokedEvent
Fires a
BeanContextServiceEvent notifying of a service being revoked.
|
protected void |
fireServiceRevoked(Class
Fires a
BeanContextServiceRevokedEvent indicating that a particular service is no longer available.
|
BeanContextServices |
getBeanContextServicesPeer()
Gets the
BeanContextServices associated with this
BeanContextServicesSupport.
|
protected static BeanContextServicesListener |
getChildBeanContextServicesListener(Object
Gets the
BeanContextServicesListener (if any) of the specified child.
|
Iterator |
getCurrentServiceClasses()
Gets the currently available services for this context.
|
Iterator |
getCurrentServiceSelectors(Class
Gets the list of service dependent service parameters (Service Selectors) for the specified service, by calling getCurrentServiceSelectors() on the underlying BeanContextServiceProvider.
|
Object |
getService(BeanContextChild
obtain a service which may be delegated
|
boolean |
hasService(Class
has a service, which may be delegated
|
void |
initialize()
called by BeanContextSupport superclass during construction and deserialization to initialize subclass transient state.
|
protected void |
initializeBeanContextResources()
called from setBeanContext to notify a BeanContextChild to allocate resources obtained from the nesting BeanContext.
|
protected void |
releaseBeanContextResources()
called from setBeanContext to notify a BeanContextChild to release resources obtained from the nesting BeanContext.
|
void |
releaseService(BeanContextChild
release a service
|
void |
removeBeanContextServicesListener(BeanContextServicesListener
remove a BeanContextServicesListener
|
void |
revokeService(Class
remove a service
|
void |
serviceAvailable(BeanContextServiceAvailableEvent
BeanContextServicesListener callback, propagates event to all currently registered listeners and BeanContextServices children, if this BeanContextService does not already implement this service itself.
|
void |
serviceRevoked(BeanContextServiceRevokedEvent
BeanContextServicesListener callback, propagates event to all currently registered listeners and BeanContextServices children, if this BeanContextService does not already implement this service itself.
|
add, addAll, addBeanContextMembershipListener, avoidingGui, bcsChildren, childDeserializedHook, childJustAddedHook, classEquals, clear, contains, containsAll, containsKey, copyChildren, deserialize, dontUseGui, fireChildrenAdded, fireChildrenRemoved, getBeanContextPeer, getChildBeanContextChild, getChildBeanContextMembershipListener, getChildPropertyChangeListener, getChildSerializable, getChildVetoableChangeListener, getChildVisibility, getLocale, getResource, getResourceAsStream, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, remove, removeAll, removeBeanContextMembershipListener, retainAll, serialize, setDesignTime, setLocale, size, toArray, toArray, validatePendingAdd, validatePendingRemove, vetoableChange, writeChildrenaddPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, validatePendingSetBeanContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListeneraddPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContextadd, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArrayisDesignTime, setDesignTimeavoidingGui, dontUseGui, needsGui, okToUseGuiprotected transient HashMapservices
protected transient HashMap services field should be synchronized on that object
protected transient int serializable
protected transient BeanContextServicesSupport.BCSSProxyServiceProvider proxy
protected transient ArrayListbcsListeners
public BeanContextServicesSupport(BeanContextServicespeer, Locale lcle, boolean dTime, boolean visible)
Construct a BeanContextServicesSupport instance
peer - The peer BeanContext we are supplying an implementation for, if null the this object is its own peer
lcle - The current Locale for this BeanContext.
dTime - The initial state, true if in design mode, false if runtime.
visible - The initial visibility.
public BeanContextServicesSupport(BeanContextServicespeer, Locale lcle, boolean dtime)
peer - The peer BeanContext we are supplying an implementation for, if null the this object is its own peer
lcle - The current Locale for this BeanContext.
dtime - The initial state, true if in design mode, false if runtime.
public BeanContextServicesSupport(BeanContextServicespeer, Locale lcle)
peer - The peer BeanContext we are supplying an implementation for, if null the this object is its own peer
lcle - The current Locale for this BeanContext.
public BeanContextServicesSupport(BeanContextServicespeer)
peer - The peer BeanContext we are supplying an implementation for, if null the this object is its own peer
public BeanContextServicesSupport()
public void initialize()
public BeanContextServicesgetBeanContextServicesPeer()
protected BeanContextSupport.BCSChild createBCSChild(Object targetChild, Object peer)
Subclasses can override this method to insert their own subclass of Child without having to override add() or the other Collection methods that add children to the set.
createBCSChild in class
BeanContextSupport
targetChild - the child to create the Child on behalf of
peer - the peer if the targetChild and peer are related by BeanContextProxy
protected BeanContextServicesSupport.BCSSServiceProvider createBCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp)
sc - the class
bcsp - the service provider
public void addBeanContextServicesListener(BeanContextServicesListenerbcsl)
addBeanContextServicesListener in interface
BeanContextServices
bcsl - the
BeanContextServicesListener to add
NullPointerException - if the argument is null
public void removeBeanContextServicesListener(BeanContextServicesListenerbcsl)
removeBeanContextServicesListener in interface
BeanContextServices
bcsl - the
BeanContextServicesListener to remove from this context
public boolean addService(ClassserviceClass, BeanContextServiceProvider bcsp)
addService in interface
BeanContextServices
serviceClass - the service class
bcsp - the service provider
protected boolean addService(ClassserviceClass, BeanContextServiceProvider bcsp, boolean fireEvent)
serviceClass - the service class
bcsp - the service provider
fireEvent - whether or not an event should be fired
public void revokeService(ClassserviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow)
revokeService in interface
BeanContextServices
serviceClass - the service class
bcsp - the service provider
revokeCurrentServicesNow - whether or not to revoke the service
public boolean hasService(ClassserviceClass)
hasService in interface
BeanContextServices
serviceClass - the service in question
public ObjectgetService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException
getService in interface
BeanContextServices
child - the
BeanContextChild associated with this request
requestor - the object requesting the service
serviceClass - class of the requested service
serviceSelector - the service dependent parameter
bcsrl - the
BeanContextServiceRevokedListener to notify if the service should later become revoked
null
TooManyListenersException - if there are too many listeners
public void releaseService(BeanContextChildchild, Object requestor, Object service)
releaseService in interface
BeanContextServices
child - the
BeanContextChild
requestor - the requestor
service - the service
public IteratorgetCurrentServiceClasses()
BeanContextServices
getCurrentServiceClasses in interface
BeanContextServices
public IteratorgetCurrentServiceSelectors(Class serviceClass)
BeanContextServices
getCurrentServiceSelectors in interface
BeanContextServices
serviceClass - the specified service
public void serviceAvailable(BeanContextServiceAvailableEventbcssae)
serviceAvailable in interface
BeanContextServicesListener
serviceAvailable in class
BeanContextChildSupport
bcssae - The BeanContextServiceAvailableEvent fired as a result of a service becoming available
public void serviceRevoked(BeanContextServiceRevokedEventbcssre)
serviceRevoked in interface
BeanContextServiceRevokedListener
serviceRevoked in class
BeanContextChildSupport
bcssre - The
BeanContextServiceRevokedEvent fired as a result of a service being revoked
protected static final BeanContextServicesListenergetChildBeanContextServicesListener(Object child)
child - the specified child
protected void childJustRemovedHook(Objectchild, BeanContextSupport .BCSChild bcsc)
childJustRemovedHook in class
BeanContextSupport
child - the child
bcsc - the BCSChild
protected void releaseBeanContextResources()
protected void initializeBeanContextResources()
protected final void fireServiceAdded(ClassserviceClass)
serviceClass - the service class
protected final void fireServiceAdded(BeanContextServiceAvailableEventbcssae)
bcssae - the
BeanContextServiceAvailableEvent
protected final void fireServiceRevoked(BeanContextServiceRevokedEventbcsre)
bcsre - the
BeanContextServiceRevokedEvent
protected final void fireServiceRevoked(ClassserviceClass, boolean revokeNow)
serviceClass - the service class
revokeNow - whether or not the event should be revoked now
protected void bcsPreSerializationHook(ObjectOutputStreamoos) throws IOException
bcsPreSerializationHook in class
BeanContextSupport
oos - the
ObjectOutputStream to use during serialization
IOException - if serialization failed
protected void bcsPreDeserializationHook(ObjectInputStreamois) throws IOException , ClassNotFoundException
bcsPreDeserializationHook in class
BeanContextSupport
ois - the
ObjectInputStream to use during deserialization
IOException - if deserialization failed
ClassNotFoundException - if needed classes are not found