Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.beans.beancontext
Class BeanContextServicesSupport  view BeanContextServicesSupport download BeanContextServicesSupport.java

java.lang.Object
  extended byjava.beans.beancontext.BeanContextChildSupport
      extended byjava.beans.beancontext.BeanContextSupport
          extended byjava.beans.beancontext.BeanContextServicesSupport
All Implemented Interfaces:
BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServices, BeanContextServicesListener, java.util.Collection, java.beans.DesignMode, java.util.EventListener, java.lang.Iterable, java.beans.PropertyChangeListener, java.io.Serializable, java.beans.VetoableChangeListener, java.beans.Visibility

public class BeanContextServicesSupport
extends BeanContextSupport
implements BeanContextServices

Since:
1.2

Nested Class Summary
protected  class BeanContextServicesSupport.BCSSChild
           
protected  class BeanContextServicesSupport.BCSSProxyServiceProvider
           
protected static class BeanContextServicesSupport.BCSSServiceProvider
           
 
Nested classes inherited from class java.beans.beancontext.BeanContextSupport
BeanContextSupport.BCSChild, BeanContextSupport.BCSIterator
 
Field Summary
protected  java.util.ArrayList bcsListeners
           
protected  BeanContextServicesSupport.BCSSProxyServiceProvider proxy
           
protected  int serializable
           
private static long serialVersionUID
           
protected  java.util.HashMap services
           
 
Fields inherited from class java.beans.beancontext.BeanContextSupport
bcmListeners, children, designTime, locale, okToUseGui
 
Fields inherited from class java.beans.beancontext.BeanContextChildSupport
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
Fields inherited from interface java.beans.beancontext.BeanContext
globalHierarchyLock
 
Fields inherited from interface java.beans.DesignMode
PROPERTYNAME
 
Constructor Summary
BeanContextServicesSupport()
           
BeanContextServicesSupport(BeanContextServices peer)
           
BeanContextServicesSupport(BeanContextServices peer, java.util.Locale locale)
           
BeanContextServicesSupport(BeanContextServices peer, java.util.Locale locale, boolean dtime)
           
BeanContextServicesSupport(BeanContextServices peer, java.util.Locale locale, boolean dtime, boolean visible)
           
 
Method Summary
 void addBeanContextServicesListener(BeanContextServicesListener listener)
          Add a listener on all adds and removes of services.
 boolean addService(java.lang.Class serviceClass, BeanContextServiceProvider bcsp)
          Register a service to make it available to others.
protected  boolean addService(java.lang.Class serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent)
           
protected  void bcsPreDeserializationHook(java.io.ObjectInputStream ois)
           
protected  void bcsPreSerializationHook(java.io.ObjectOutputStream oos)
           
protected  void childJustRemovedHook(java.lang.Object child, BeanContextSupport.BCSChild bcsc)
           
protected  BeanContextSupport.BCSChild createBCSChild(java.lang.Object targetChild, java.lang.Object peer)
           
protected  BeanContextServicesSupport.BCSSServiceProvider createBCSSServiceProvider(java.lang.Class sc, BeanContextServiceProvider bcsp)
           
protected  void fireServiceAdded(BeanContextServiceAvailableEvent bcssae)
           
protected  void fireServiceAdded(java.lang.Class serviceClass)
           
protected  void fireServiceRevoked(BeanContextServiceRevokedEvent event)
           
protected  void fireServiceRevoked(java.lang.Class serviceClass, boolean revokeNow)
           
 BeanContextServices getBeanContextServicesPeer()
           
protected static BeanContextServicesListener getChildBeanContextServicesListener(java.lang.Object child)
           
 java.util.Iterator getCurrentServiceClasses()
          Get a list of all service classes supported.
 java.util.Iterator getCurrentServiceSelectors(java.lang.Class serviceClass)
          Get a list of valid service selectors for the specified service class.
 java.lang.Object getService(BeanContextChild child, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector, BeanContextServiceRevokedListener bcsrl)
          Get a service from this BeanContextServices.
 boolean hasService(java.lang.Class serviceClass)
          Tell whether the specified service class is available.
 void initialize()
           
protected  void initializeBeanContextResources()
          Called by setBeanContext() to grab resources when the parent has been set.
protected  void releaseBeanContextResources()
          Called by setBeanContext() to release resources of a what will soon no longer be the parent.
 void releaseService(BeanContextChild child, java.lang.Object requestor, java.lang.Object service)
          Release your copy of this service.
 void removeBeanContextServicesListener(BeanContextServicesListener listener)
          Remove a listener on all adds and removes of services.
 void revokeService(java.lang.Class serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow)
          Make it so that no one else can use this service.
 void serviceAvailable(BeanContextServiceAvailableEvent bcssae)
          Called by BeanContextServices whenever a service is made available.
 void serviceRevoked(BeanContextServiceRevokedEvent bcssre)
          Called by BeanContextServices.revokeService() to indicate that a service has been revoked.
 
Methods inherited from class java.beans.beancontext.BeanContextSupport
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, writeChildren
 
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, validatePendingSetBeanContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.beans.beancontext.BeanContext
addBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListener
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
 
Methods inherited from interface java.beans.Visibility
avoidingGui, dontUseGui, needsGui, okToUseGui
 
Methods inherited from interface java.beans.DesignMode
isDesignTime, setDesignTime
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

bcsListeners

protected transient java.util.ArrayList bcsListeners

proxy

protected transient BeanContextServicesSupport.BCSSProxyServiceProvider proxy

serializable

protected transient int serializable

services

protected transient java.util.HashMap services
Constructor Detail

BeanContextServicesSupport

public BeanContextServicesSupport()

BeanContextServicesSupport

public BeanContextServicesSupport(BeanContextServices peer)

BeanContextServicesSupport

public BeanContextServicesSupport(BeanContextServices peer,
                                  java.util.Locale locale)

BeanContextServicesSupport

public BeanContextServicesSupport(BeanContextServices peer,
                                  java.util.Locale locale,
                                  boolean dtime)

BeanContextServicesSupport

public BeanContextServicesSupport(BeanContextServices peer,
                                  java.util.Locale locale,
                                  boolean dtime,
                                  boolean visible)
Method Detail

addBeanContextServicesListener

public void addBeanContextServicesListener(BeanContextServicesListener listener)
Description copied from interface: BeanContextServices
Add a listener on all adds and removes of services.

Specified by:
addBeanContextServicesListener in interface BeanContextServices

addService

public boolean addService(java.lang.Class serviceClass,
                          BeanContextServiceProvider bcsp)
Description copied from interface: BeanContextServices
Register a service to make it available to others. This class may refuse to add the service based on whatever information it can gather, including whether the service provider is trusted.

Specified by:
addService in interface BeanContextServices

addService

protected boolean addService(java.lang.Class serviceClass,
                             BeanContextServiceProvider bcsp,
                             boolean fireEvent)

bcsPreDeserializationHook

protected void bcsPreDeserializationHook(java.io.ObjectInputStream ois)
                                  throws java.lang.ClassNotFoundException,
                                         java.io.IOException,
                                         gnu.classpath.NotImplementedException
Overrides:
bcsPreDeserializationHook in class BeanContextSupport

bcsPreSerializationHook

protected void bcsPreSerializationHook(java.io.ObjectOutputStream oos)
                                throws java.io.IOException,
                                       gnu.classpath.NotImplementedException
Overrides:
bcsPreSerializationHook in class BeanContextSupport

childJustRemovedHook

protected void childJustRemovedHook(java.lang.Object child,
                                    BeanContextSupport.BCSChild bcsc)
                             throws gnu.classpath.NotImplementedException
Overrides:
childJustRemovedHook in class BeanContextSupport

createBCSChild

protected BeanContextSupport.BCSChild createBCSChild(java.lang.Object targetChild,
                                                     java.lang.Object peer)
Overrides:
createBCSChild in class BeanContextSupport

createBCSSServiceProvider

protected BeanContextServicesSupport.BCSSServiceProvider createBCSSServiceProvider(java.lang.Class sc,
                                                                                   BeanContextServiceProvider bcsp)
                                                                            throws gnu.classpath.NotImplementedException

fireServiceAdded

protected final void fireServiceAdded(BeanContextServiceAvailableEvent bcssae)

fireServiceAdded

protected final void fireServiceAdded(java.lang.Class serviceClass)

fireServiceRevoked

protected final void fireServiceRevoked(BeanContextServiceRevokedEvent event)

fireServiceRevoked

protected final void fireServiceRevoked(java.lang.Class serviceClass,
                                        boolean revokeNow)

getBeanContextServicesPeer

public BeanContextServices getBeanContextServicesPeer()
                                               throws gnu.classpath.NotImplementedException

getChildBeanContextServicesListener

protected static final BeanContextServicesListener getChildBeanContextServicesListener(java.lang.Object child)
                                                                                throws gnu.classpath.NotImplementedException

getCurrentServiceClasses

public java.util.Iterator getCurrentServiceClasses()
Description copied from interface: BeanContextServices
Get a list of all service classes supported.

This method must synchronize on BeanContext.globalHierarchyLock.

Specified by:
getCurrentServiceClasses in interface BeanContextServices

getCurrentServiceSelectors

public java.util.Iterator getCurrentServiceSelectors(java.lang.Class serviceClass)
Description copied from interface: BeanContextServices
Get a list of valid service selectors for the specified service class.

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.

Specified by:
getCurrentServiceSelectors in interface BeanContextServices

getService

public java.lang.Object getService(BeanContextChild child,
                                   java.lang.Object requestor,
                                   java.lang.Class serviceClass,
                                   java.lang.Object serviceSelector,
                                   BeanContextServiceRevokedListener bcsrl)
                            throws java.util.TooManyListenersException,
                                   gnu.classpath.NotImplementedException
Description copied from interface: BeanContextServices
Get a service from this BeanContextServices.

The specified listener will be registered to receive a revocation notice for the specified serviceClass. One notification per service class per requestor object will be sent.

The listener will be unregistered when all services that were obtained by that requestor for that service class are released.

If the requested service class is not available, or if this BeanContextServices object chooses not honor the request because the service class has been revoked or for some other reason, then this method will return null.

This method may throw unchecked exceptions, so watch out.

Specified by:
getService in interface BeanContextServices

hasService

public boolean hasService(java.lang.Class serviceClass)
Description copied from interface: BeanContextServices
Tell whether the specified service class is available. Iff getService() could return a non-null value for the specified service, this method will return true.

Specified by:
hasService in interface BeanContextServices

initialize

public void initialize()
Overrides:
initialize in class BeanContextSupport

initializeBeanContextResources

protected void initializeBeanContextResources()
                                       throws gnu.classpath.NotImplementedException
Description copied from class: BeanContextChildSupport
Called by setBeanContext() to grab resources when the parent has been set.

This method is meant to be overriden. BeanContextChildSupport's implementation does nothing.

Overrides:
initializeBeanContextResources in class BeanContextChildSupport

releaseBeanContextResources

protected void releaseBeanContextResources()
                                    throws gnu.classpath.NotImplementedException
Description copied from class: BeanContextChildSupport
Called by setBeanContext() to release resources of a what will soon no longer be the parent.

This method is meant to be overriden. BeanContextChildSupport's implementation does nothing.

Overrides:
releaseBeanContextResources in class BeanContextChildSupport

releaseService

public void releaseService(BeanContextChild child,
                           java.lang.Object requestor,
                           java.lang.Object service)
                    throws gnu.classpath.NotImplementedException
Description copied from interface: BeanContextServices
Release your copy of this service.

If all copies of the service's class have been relinquished by the requestor, the BeanContextServiceRevokedListener previously registered by getService() will be unregistered.

Specified by:
releaseService in interface BeanContextServices

removeBeanContextServicesListener

public void removeBeanContextServicesListener(BeanContextServicesListener listener)
Description copied from interface: BeanContextServices
Remove a listener on all adds and removes of services.

Specified by:
removeBeanContextServicesListener in interface BeanContextServices

revokeService

public void revokeService(java.lang.Class serviceClass,
                          BeanContextServiceProvider bcsp,
                          boolean revokeCurrentServicesNow)
                   throws gnu.classpath.NotImplementedException
Description copied from interface: BeanContextServices
Make it so that no one else can use this service.

If revokeNow is false, the only effect of this method is to make all subsequent calls to getService() on this service class fail.

If it is true, a message is also sent out to all listeners on the service and all references to it are released.

Specified by:
revokeService in interface BeanContextServices

serviceAvailable

public void serviceAvailable(BeanContextServiceAvailableEvent bcssae)
Description copied from interface: BeanContextServicesListener
Called by BeanContextServices whenever a service is made available.

Specified by:
serviceAvailable in interface BeanContextServicesListener
Overrides:
serviceAvailable in class BeanContextChildSupport

serviceRevoked

public void serviceRevoked(BeanContextServiceRevokedEvent bcssre)
Description copied from interface: BeanContextServiceRevokedListener
Called by 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.

Specified by:
serviceRevoked in interface BeanContextServiceRevokedListener
Overrides:
serviceRevoked in class BeanContextChildSupport