diff options
Diffstat (limited to 'libjava/classpath/java/beans/beancontext')
18 files changed, 1089 insertions, 1089 deletions
diff --git a/libjava/classpath/java/beans/beancontext/BeanContext.java b/libjava/classpath/java/beans/beancontext/BeanContext.java index 02f4a1a4011..803cb36ff05 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContext.java +++ b/libjava/classpath/java/beans/beancontext/BeanContext.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -166,107 +166,107 @@ import java.util.Collection; */ public interface BeanContext - extends Collection, BeanContextChild, Visibility, DesignMode { + extends Collection, BeanContextChild, Visibility, DesignMode { - /** - * The global lock on changing any BeanContext hierarchy. - * It kinda sucks that there is only one lock, since there can be - * multiple hierarchies. Oh well, I didn't design, I just code. - * <P> - * - * Methods that must (or do) synchronize on the global lock: - * <BR> - * <UL> - * <LI> - * Implementors of <CODE>BeanContext.add()</CODE> and <code>addAll()</code> - * </LI> - * </UL> - * @fixme fill in the rest of the methods which use the global lock. - */ - Object globalHierarchyLock = new Object(); + /** + * The global lock on changing any BeanContext hierarchy. + * It kinda sucks that there is only one lock, since there can be + * multiple hierarchies. Oh well, I didn't design, I just code. + * <P> + * + * Methods that must (or do) synchronize on the global lock: + * <BR> + * <UL> + * <LI> + * Implementors of <CODE>BeanContext.add()</CODE> and <code>addAll()</code> + * </LI> + * </UL> + * @fixme fill in the rest of the methods which use the global lock. + */ + Object globalHierarchyLock = new Object(); - /** - * Instantiate a Bean using this Bean's <code>ClassLoader</code> - * and this <code>BeanContext</code> as the parent. - * <P> - * - * This method exists mainly so that <code>BeanContext</code> - * implementations can perform extra actions on Beans that are - * created within them. - * - * @param beanName the name of the bean to instantiate - * @return the created Bean - * - * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String) - * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String,java.beans.beancontext.BeanContext) - * @exception IOException if there is an I/O problem during - * instantiation. - * @exception ClassNotFoundException if a serialized Bean's class - * is not found. - */ - Object instantiateChild(String beanName) + /** + * Instantiate a Bean using this Bean's <code>ClassLoader</code> + * and this <code>BeanContext</code> as the parent. + * <P> + * + * This method exists mainly so that <code>BeanContext</code> + * implementations can perform extra actions on Beans that are + * created within them. + * + * @param beanName the name of the bean to instantiate + * @return the created Bean + * + * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String) + * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String,java.beans.beancontext.BeanContext) + * @exception IOException if there is an I/O problem during + * instantiation. + * @exception ClassNotFoundException if a serialized Bean's class + * is not found. + */ + Object instantiateChild(String beanName) throws IOException, ClassNotFoundException; - /** - * Get a resource. The <code>BeanContext</code> will typically - * call <code>ClassLoader.getResource()</code>, but may do it any - * way it wants to. This allows a <code>BeanContext</code> to - * have its own set of resources separate from the rest of the - * system. - * <P> - * - * Beans should call this method on their parent rather than the - * associated <code>ClassLoader</code> method. - * <P> - * - * I am assuming, but am not entirely sure, that if a - * <code>BeanContext</code> cannot find a resource, its - * responsibility is to call the <code>getResource</code> method - * of its parent <code>BeanContext</code>. - * - * @return a URL to the requested resource. - * @param resourceName the name of the resource requested. - * @param requestor a reference to the child requesting the resource. - * @see java.lang.ClassLoader#getResource(java.lang.String) - */ - URL getResource(String resourceName, BeanContextChild requestor); + /** + * Get a resource. The <code>BeanContext</code> will typically + * call <code>ClassLoader.getResource()</code>, but may do it any + * way it wants to. This allows a <code>BeanContext</code> to + * have its own set of resources separate from the rest of the + * system. + * <P> + * + * Beans should call this method on their parent rather than the + * associated <code>ClassLoader</code> method. + * <P> + * + * I am assuming, but am not entirely sure, that if a + * <code>BeanContext</code> cannot find a resource, its + * responsibility is to call the <code>getResource</code> method + * of its parent <code>BeanContext</code>. + * + * @return a URL to the requested resource. + * @param resourceName the name of the resource requested. + * @param requestor a reference to the child requesting the resource. + * @see java.lang.ClassLoader#getResource(java.lang.String) + */ + URL getResource(String resourceName, BeanContextChild requestor); - /** - * Get a resource as a stream. The <code>BeanContext</code> will - * typically call <code>ClassLoader.getResourceAsStream()</code>, - * but may do it any way it wants to. This allows a - * <code>BeanContext</code>'s children to have their own set of - * resources separate from the rest of the system. - * <P> - * - * Beans should call this method on their parent rather than the - * associated <code>ClassLoader</code> method. - * <P> - * - * I am assuming, but am not entirely sure, that if a - * <code>BeanContext</code> cannot find a resource, its - * responsibility is to call the <code>getResourceAsStream</code> - * method of its parent <code>BeanContext</code>. - * - * @return the requested resource as a stream. - * @param resourceName the name of the resource requested. - * @param requestor a reference to the child requesting the resource. - * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String) - */ - InputStream getResourceAsStream(String resourceName, BeanContextChild requestor); + /** + * Get a resource as a stream. The <code>BeanContext</code> will + * typically call <code>ClassLoader.getResourceAsStream()</code>, + * but may do it any way it wants to. This allows a + * <code>BeanContext</code>'s children to have their own set of + * resources separate from the rest of the system. + * <P> + * + * Beans should call this method on their parent rather than the + * associated <code>ClassLoader</code> method. + * <P> + * + * I am assuming, but am not entirely sure, that if a + * <code>BeanContext</code> cannot find a resource, its + * responsibility is to call the <code>getResourceAsStream</code> + * method of its parent <code>BeanContext</code>. + * + * @return the requested resource as a stream. + * @param resourceName the name of the resource requested. + * @param requestor a reference to the child requesting the resource. + * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String) + */ + InputStream getResourceAsStream(String resourceName, BeanContextChild requestor); - /** - * Add a listener on changes to the membership of this - * <code>BeanContext</code> object. - * @param listener the listener to add. - */ - void addBeanContextMembershipListener(BeanContextMembershipListener listener); + /** + * Add a listener on changes to the membership of this + * <code>BeanContext</code> object. + * @param listener the listener to add. + */ + void addBeanContextMembershipListener(BeanContextMembershipListener listener); - /** - * Remove a listener on changes to the membership of this - * <code>BeanContext</code> object. - * @param listener the listener to remove. - */ - void removeBeanContextMembershipListener(BeanContextMembershipListener listener); + /** + * Remove a listener on changes to the membership of this + * <code>BeanContext</code> object. + * @param listener the listener to remove. + */ + void removeBeanContextMembershipListener(BeanContextMembershipListener listener); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextChild.java b/libjava/classpath/java/beans/beancontext/BeanContextChild.java index d1115efac85..e2bdcf33633 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextChild.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextChild.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -77,98 +77,98 @@ import java.beans.VetoableChangeListener; */ public interface BeanContextChild { - /** - * Set the parent <code>BeanContext</code>. - * <P> - * - * This method is called from <code>BeanContext.add()</code> and - * should not be called directly. - * <P> - * - * When this Object is being added to a new BeanContext or moved - * from an old one, a non-null value will be passed in. - * <P> - * - * When this Object is being removed from the current - * <code>BeanContext</code>, <code>setBeanContext()</code> will - * receive the parameter <code>null</code>. - * <P> - * - * When being removed from the current <code>BeanContext</code>, - * it is the <code>BeanContextChild</code>'s responsibility to - * release all services it has obtained. - * <P> - * - * This change should generate <code>PropertyChangeEvent</code> - * and <code>VetoableChangeEvent</code>s with the property name - * "beanContext". If the change is vetoed, it must re-throw the - * exception and not change anything. In this way, the parent - * <code>BeanContextChild</code>, who has registered himself with - * you, will have a chance to remove this child from its - * collection. - * <P> - * - * If the Bean does not wish to change the parent or be removed - * from one, it may throw the <code>PropertyVetoException</code>. - * If you veto a <code>setBeanContext(null)</code> call, then you - * should try your hardest to remedy whatever problem is keeping - * you from being removed from the <code>BeanContext</code> so - * that you can <em>not</em> veto it the next time. - * Otherwise, nasty pathological recursion stuff could occur in - * certain situations. - * <P> - * - * If you do veto the change, you must first back out any changes - * you made prior to the veto. Best not to make any such changes - * prior to the veto in the first place. - * <P> - * - * This method is called from <code>BeanContext.add()</code> and - * should not be called directly. - * - * @param parent the new parent for the <code>BeanContextChild</code>, - * or <code>null</code> to signify removal from a tree. - * @exception PropertyVetoException if the - * <code>BeanContextChild</code> implementor does not - * wish to have its parent changed. - */ - void setBeanContext(BeanContext parent) - throws PropertyVetoException; - - /** - * Get the parent <code>BeanContext</code>. - * @return the parent <code>BeanContext</code>. - */ - BeanContext getBeanContext(); - - /** - * Add a listener that will be notified when a specific property changes. - * @param prop the name of the property to listen on - * @param listener the listener to listen on the property. - */ - void addPropertyChangeListener(String prop, PropertyChangeListener listener); - - /** - * Remove a listener to a certain property. - * @param prop the name of the property being listened on - * @param listener the listener listening on the property. - */ - void removePropertyChangeListener(String prop, PropertyChangeListener listener); - - /** - * Add a listener that will be notified when a specific property - * change is requested (a PropertyVetoException may be thrown) as - * well as after the change is successfully made. - * - * @param prop the name of the property to listen on - * @param listener the listener to listen on the property. - */ - void addVetoableChangeListener(String prop, VetoableChangeListener listener); - - /** - * Remove a listener to a certain property. - * @param prop the name of the property being listened on - * @param listener the listener listening on the property. - */ - void removeVetoableChangeListener(String prop, VetoableChangeListener listener); + /** + * Set the parent <code>BeanContext</code>. + * <P> + * + * This method is called from <code>BeanContext.add()</code> and + * should not be called directly. + * <P> + * + * When this Object is being added to a new BeanContext or moved + * from an old one, a non-null value will be passed in. + * <P> + * + * When this Object is being removed from the current + * <code>BeanContext</code>, <code>setBeanContext()</code> will + * receive the parameter <code>null</code>. + * <P> + * + * When being removed from the current <code>BeanContext</code>, + * it is the <code>BeanContextChild</code>'s responsibility to + * release all services it has obtained. + * <P> + * + * This change should generate <code>PropertyChangeEvent</code> + * and <code>VetoableChangeEvent</code>s with the property name + * "beanContext". If the change is vetoed, it must re-throw the + * exception and not change anything. In this way, the parent + * <code>BeanContextChild</code>, who has registered himself with + * you, will have a chance to remove this child from its + * collection. + * <P> + * + * If the Bean does not wish to change the parent or be removed + * from one, it may throw the <code>PropertyVetoException</code>. + * If you veto a <code>setBeanContext(null)</code> call, then you + * should try your hardest to remedy whatever problem is keeping + * you from being removed from the <code>BeanContext</code> so + * that you can <em>not</em> veto it the next time. + * Otherwise, nasty pathological recursion stuff could occur in + * certain situations. + * <P> + * + * If you do veto the change, you must first back out any changes + * you made prior to the veto. Best not to make any such changes + * prior to the veto in the first place. + * <P> + * + * This method is called from <code>BeanContext.add()</code> and + * should not be called directly. + * + * @param parent the new parent for the <code>BeanContextChild</code>, + * or <code>null</code> to signify removal from a tree. + * @exception PropertyVetoException if the + * <code>BeanContextChild</code> implementor does not + * wish to have its parent changed. + */ + void setBeanContext(BeanContext parent) + throws PropertyVetoException; + + /** + * Get the parent <code>BeanContext</code>. + * @return the parent <code>BeanContext</code>. + */ + BeanContext getBeanContext(); + + /** + * Add a listener that will be notified when a specific property changes. + * @param prop the name of the property to listen on + * @param listener the listener to listen on the property. + */ + void addPropertyChangeListener(String prop, PropertyChangeListener listener); + + /** + * Remove a listener to a certain property. + * @param prop the name of the property being listened on + * @param listener the listener listening on the property. + */ + void removePropertyChangeListener(String prop, PropertyChangeListener listener); + + /** + * Add a listener that will be notified when a specific property + * change is requested (a PropertyVetoException may be thrown) as + * well as after the change is successfully made. + * + * @param prop the name of the property to listen on + * @param listener the listener to listen on the property. + */ + void addVetoableChangeListener(String prop, VetoableChangeListener listener); + + /** + * Remove a listener to a certain property. + * @param prop the name of the property being listened on + * @param listener the listener listening on the property. + */ + void removeVetoableChangeListener(String prop, VetoableChangeListener listener); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextChildComponentProxy.java b/libjava/classpath/java/beans/beancontext/BeanContextChildComponentProxy.java index a8d6e34045e..cb75d508dc7 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextChildComponentProxy.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextChildComponentProxy.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -51,10 +51,10 @@ import java.awt.Component; */ public interface BeanContextChildComponentProxy { - /** - * Get the <code>Component</code> associated with this <code>BeanContextChild</code>. - * @return the <code>Component</code> associated with this - * <code>BeanContextChild</code>. - */ - Component getComponent(); + /** + * Get the <code>Component</code> associated with this <code>BeanContextChild</code>. + * @return the <code>Component</code> associated with this + * <code>BeanContextChild</code>. + */ + Component getComponent(); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextChildSupport.java b/libjava/classpath/java/beans/beancontext/BeanContextChildSupport.java index 4444ad71377..8cd887d0c41 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextChildSupport.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextChildSupport.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -64,121 +64,121 @@ public class BeanContextChildSupport { static final long serialVersionUID = 6328947014421475877L; - /** - * The peer on which to perform <code>set</code> actions. - * This is here so that this class can be used as a peer. - * <P> - * - * When extending this class, this variable will be set to - * <code>this</code>. - */ - public BeanContextChild beanContextChildPeer; - - /** - * The parent <code>BeanContext</code>. - */ - protected transient BeanContext beanContext; - - /** - * If <code>setBeanContext()</code> was vetoed once before, this - * is set to <code>true</code> so that the next time, vetoes will - * be ignored. - */ - protected transient boolean rejectedSetBCOnce; - - /** - * Listeners are registered here and events are fired through here. - */ - protected PropertyChangeSupport pcSupport; - - /** - * Listeners are registered here and events are fired through here. - */ - protected VetoableChangeSupport vcSupport; - - /** - * Create a new <code>BeanContextChildSupport</code> with itself as the peer. - * This is meant to be used when you subclass - * <code>BeanContextChildSupport</code> to create your child. - */ - public BeanContextChildSupport() + /** + * The peer on which to perform <code>set</code> actions. + * This is here so that this class can be used as a peer. + * <P> + * + * When extending this class, this variable will be set to + * <code>this</code>. + */ + public BeanContextChild beanContextChildPeer; + + /** + * The parent <code>BeanContext</code>. + */ + protected transient BeanContext beanContext; + + /** + * If <code>setBeanContext()</code> was vetoed once before, this + * is set to <code>true</code> so that the next time, vetoes will + * be ignored. + */ + protected transient boolean rejectedSetBCOnce; + + /** + * Listeners are registered here and events are fired through here. + */ + protected PropertyChangeSupport pcSupport; + + /** + * Listeners are registered here and events are fired through here. + */ + protected VetoableChangeSupport vcSupport; + + /** + * Create a new <code>BeanContextChildSupport</code> with itself as the peer. + * This is meant to be used when you subclass + * <code>BeanContextChildSupport</code> to create your child. + */ + public BeanContextChildSupport() { - this (null); - } - - /** - * Create a new <code>BeanContextChildSupport</code> with the specified peer. - * @param peer the peer to use, or <code>null</code> to specify - * <code>this</code>. - */ - public BeanContextChildSupport (BeanContextChild peer) + this (null); + } + + /** + * Create a new <code>BeanContextChildSupport</code> with the specified peer. + * @param peer the peer to use, or <code>null</code> to specify + * <code>this</code>. + */ + public BeanContextChildSupport (BeanContextChild peer) { - if (peer == null) + if (peer == null) { peer = this; } - beanContextChildPeer = peer; - pcSupport = new PropertyChangeSupport (peer); - vcSupport = new VetoableChangeSupport (peer); - } - - /** - * Set the parent <code>BeanContext</code>. - * <P> - * - * When this Object is being added to a new BeanContext or moved - * from an old one, a non-null value will be passed in. - * <P> - * - * When this Object is being removed from the current - * <code>BeanContext</code>, <code>setBeanContext()</code> will - * receive the parameter <code>null</code>. - * <P> - * - * Order of events: - * <OL> - * <LI> - * If the new <code>BeanContext</code> is the same as the old - * one, nothing happens. - * </LI> - * <LI> - * If the change has not been rejected or vetoed before, call - * <code>validatePendingSetBeanContext()</code>. If this call - * returns <code>false</code>, the change is rejected and a - * <code>PropertyVetoException</code> is thrown. - * </LI> - * <LI> - * If the change has not been rejected or vetoed before, - * <code>VetoableChangeEvent</code>s are fired with the name - * <code>"beanContext"</code>, using the - * <code>fireVetoableChange()</code> method. If a veto - * occurs, reversion events are fired using the same method, - * the change is rejected, and the veto is rethrown. - * </LI> - * <LI> - * <code>releaseBeanContextResources()</code> is called. - * </LI> - * <LI> - * The change is made. - * </LI> - * <LI> - * <code>PropertyChangeEvent</code>s are fired using the - * <code>firePropertyChange()</code> method. - * </LI> - * <LI> - * <code>initializeBeanContextResources()</code> is called. - * </LI> - * </OL> - * <P> - * - * @param newBeanContext the new parent for the - * <code>BeanContextChild</code>, or <code>null</code> to - * signify removal from a tree. - * @exception PropertyVetoException if the - * <code>BeanContextChild</code> implementor does not - * wish to have its parent changed. - */ + beanContextChildPeer = peer; + pcSupport = new PropertyChangeSupport (peer); + vcSupport = new VetoableChangeSupport (peer); + } + + /** + * Set the parent <code>BeanContext</code>. + * <P> + * + * When this Object is being added to a new BeanContext or moved + * from an old one, a non-null value will be passed in. + * <P> + * + * When this Object is being removed from the current + * <code>BeanContext</code>, <code>setBeanContext()</code> will + * receive the parameter <code>null</code>. + * <P> + * + * Order of events: + * <OL> + * <LI> + * If the new <code>BeanContext</code> is the same as the old + * one, nothing happens. + * </LI> + * <LI> + * If the change has not been rejected or vetoed before, call + * <code>validatePendingSetBeanContext()</code>. If this call + * returns <code>false</code>, the change is rejected and a + * <code>PropertyVetoException</code> is thrown. + * </LI> + * <LI> + * If the change has not been rejected or vetoed before, + * <code>VetoableChangeEvent</code>s are fired with the name + * <code>"beanContext"</code>, using the + * <code>fireVetoableChange()</code> method. If a veto + * occurs, reversion events are fired using the same method, + * the change is rejected, and the veto is rethrown. + * </LI> + * <LI> + * <code>releaseBeanContextResources()</code> is called. + * </LI> + * <LI> + * The change is made. + * </LI> + * <LI> + * <code>PropertyChangeEvent</code>s are fired using the + * <code>firePropertyChange()</code> method. + * </LI> + * <LI> + * <code>initializeBeanContextResources()</code> is called. + * </LI> + * </OL> + * <P> + * + * @param newBeanContext the new parent for the + * <code>BeanContextChild</code>, or <code>null</code> to + * signify removal from a tree. + * @exception PropertyVetoException if the + * <code>BeanContextChild</code> implementor does not + * wish to have its parent changed. + */ public void setBeanContext(BeanContext newBeanContext) throws PropertyVetoException { @@ -195,7 +195,7 @@ public class BeanContextChildSupport throw new PropertyVetoException ("validatePendingSetBeanContext() rejected change", new PropertyChangeEvent(beanContextChildPeer, "beanContext", beanContext, newBeanContext)); } - + try { fireVetoableChange ("beanContext", beanContext, newBeanContext); @@ -207,175 +207,175 @@ public class BeanContextChildSupport } } - releaseBeanContextResources (); + releaseBeanContextResources (); - beanContext = newBeanContext; - rejectedSetBCOnce = false; + beanContext = newBeanContext; + rejectedSetBCOnce = false; - firePropertyChange ("beanContext", beanContext, newBeanContext); + firePropertyChange ("beanContext", beanContext, newBeanContext); - initializeBeanContextResources (); - } - } + initializeBeanContextResources (); + } + } - /** - * Get the parent <code>BeanContext</code>. - * @return the parent <code>BeanContext</code>. - */ - public BeanContext getBeanContext() + /** + * Get the parent <code>BeanContext</code>. + * @return the parent <code>BeanContext</code>. + */ + public BeanContext getBeanContext() { - return beanContext; - } - - /** - * Get the peer (or <code>this</code> if there is no peer). - * @return the peer, or <code>this</code> if there is no peer. - */ - public BeanContextChild getBeanContextChildPeer() { - return beanContextChildPeer; - } - - /** - * Determine whether there is a peer. - * This is true iff <code>getBeanContextChildPeer() == this</code>. - * @return whether there is a peer. - */ - public boolean isDelegated() { - return beanContextChildPeer == this; - } - - /** - * Add a listener that will be notified when a specific property changes. - * @param propertyName the name of the property to listen on. - * @param listener the listener to listen on the property. - */ - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - pcSupport.addPropertyChangeListener(propertyName, listener); - } - - /** - * Remove a listener to a certain property. - * - * @param propertyName the name of the property being listened on. - * @param listener the listener listening on the property. - */ - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - pcSupport.removePropertyChangeListener(propertyName, listener); - } - - /** - * Add a listener that will be notified when a specific property - * change is requested (a PropertyVetoException may be thrown) as - * well as after the change is successfully made. - * - * @param propertyName the name of the property to listen on. - * @param listener the listener to listen on the property. - */ - public void addVetoableChangeListener(String propertyName, VetoableChangeListener listener) { - vcSupport.addVetoableChangeListener(propertyName, listener); - } - - /** - * Remove a listener to a certain property. - * - * @param propertyName the name of the property being listened on - * @param listener the listener listening on the property. - */ - public void removeVetoableChangeListener(String propertyName, VetoableChangeListener listener) { - vcSupport.removeVetoableChangeListener(propertyName, listener); - } - - /** - * Fire a property change. - * - * @param propertyName the name of the property that changed - * @param oldVal the old value of the property - * @param newVal the new value of the property - */ - public void firePropertyChange(String propertyName, Object oldVal, Object newVal) { - pcSupport.firePropertyChange(propertyName, oldVal, newVal); - } - - /** - * Fire a vetoable property change. - * - * @param propertyName the name of the property that changed - * @param oldVal the old value of the property - * @param newVal the new value of the property - * @exception PropertyVetoException if the change is vetoed. - */ - public void fireVetoableChange(String propertyName, Object oldVal, Object newVal) + return beanContext; + } + + /** + * Get the peer (or <code>this</code> if there is no peer). + * @return the peer, or <code>this</code> if there is no peer. + */ + public BeanContextChild getBeanContextChildPeer() { + return beanContextChildPeer; + } + + /** + * Determine whether there is a peer. + * This is true iff <code>getBeanContextChildPeer() == this</code>. + * @return whether there is a peer. + */ + public boolean isDelegated() { + return beanContextChildPeer == this; + } + + /** + * Add a listener that will be notified when a specific property changes. + * @param propertyName the name of the property to listen on. + * @param listener the listener to listen on the property. + */ + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + pcSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * Remove a listener to a certain property. + * + * @param propertyName the name of the property being listened on. + * @param listener the listener listening on the property. + */ + public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { + pcSupport.removePropertyChangeListener(propertyName, listener); + } + + /** + * Add a listener that will be notified when a specific property + * change is requested (a PropertyVetoException may be thrown) as + * well as after the change is successfully made. + * + * @param propertyName the name of the property to listen on. + * @param listener the listener to listen on the property. + */ + public void addVetoableChangeListener(String propertyName, VetoableChangeListener listener) { + vcSupport.addVetoableChangeListener(propertyName, listener); + } + + /** + * Remove a listener to a certain property. + * + * @param propertyName the name of the property being listened on + * @param listener the listener listening on the property. + */ + public void removeVetoableChangeListener(String propertyName, VetoableChangeListener listener) { + vcSupport.removeVetoableChangeListener(propertyName, listener); + } + + /** + * Fire a property change. + * + * @param propertyName the name of the property that changed + * @param oldVal the old value of the property + * @param newVal the new value of the property + */ + public void firePropertyChange(String propertyName, Object oldVal, Object newVal) { + pcSupport.firePropertyChange(propertyName, oldVal, newVal); + } + + /** + * Fire a vetoable property change. + * + * @param propertyName the name of the property that changed + * @param oldVal the old value of the property + * @param newVal the new value of the property + * @exception PropertyVetoException if the change is vetoed. + */ + public void fireVetoableChange(String propertyName, Object oldVal, Object newVal) throws PropertyVetoException { - vcSupport.fireVetoableChange(propertyName, oldVal, newVal); - } - - /** - * Called by <code>BeanContextServices.revokeService()</code> 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. - * <code>getService()</code> will no longer work on the specified - * service class after this event has been fired. - * <P> - * - * <EM>This method is meant to be overriden.</EM> - * <code>BeanContextChildSupport</code>'s implementation does - * nothing. - * - * @param event the service revoked event. - * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean) - */ - public void serviceRevoked(BeanContextServiceRevokedEvent event) { - } - - /** - * Called by <code>BeanContextServices</code> whenever a service is made available. - * <P> - * - * <EM>This method is meant to be overriden.</EM> - * <code>BeanContextChildSupport</code>'s implementation does - * nothing. - * - * @param event the service revoked event, with useful information - * about the new service. - */ - public void serviceAvailable(BeanContextServiceAvailableEvent event) { - } - - /** - * Called by <code>setBeanContext()</code> to determine whether the set should be rejected. - * <P> - * - * <EM>This method is meant to be overriden.</EM> - * <code>BeanContextChildSupport</code>'s implementation simply - * returns <code>true</code>. - * - * @param newBeanContext the new parent. - * @return whether to allow the parent to be changed to the new - * value. - */ - public boolean validatePendingSetBeanContext(BeanContext newBeanContext) { - return true; - } - - /** - * Called by <code>setBeanContext()</code> to release resources of a what will soon no longer be the parent. - * <P> - * - * <EM>This method is meant to be overriden.</EM> - * <code>BeanContextChildSupport</code>'s implementation does - * nothing. - */ - protected void releaseBeanContextResources() { - } - - /** - * Called by <code>setBeanContext()</code> to grab resources when the parent has been set. - * <P> - * - * <EM>This method is meant to be overriden.</EM> - * <code>BeanContextChildSupport</code>'s implementation does - * nothing. - */ - protected void initializeBeanContextResources() { - } + vcSupport.fireVetoableChange(propertyName, oldVal, newVal); + } + + /** + * Called by <code>BeanContextServices.revokeService()</code> 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. + * <code>getService()</code> will no longer work on the specified + * service class after this event has been fired. + * <P> + * + * <EM>This method is meant to be overriden.</EM> + * <code>BeanContextChildSupport</code>'s implementation does + * nothing. + * + * @param event the service revoked event. + * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean) + */ + public void serviceRevoked(BeanContextServiceRevokedEvent event) { + } + + /** + * Called by <code>BeanContextServices</code> whenever a service is made available. + * <P> + * + * <EM>This method is meant to be overriden.</EM> + * <code>BeanContextChildSupport</code>'s implementation does + * nothing. + * + * @param event the service revoked event, with useful information + * about the new service. + */ + public void serviceAvailable(BeanContextServiceAvailableEvent event) { + } + + /** + * Called by <code>setBeanContext()</code> to determine whether the set should be rejected. + * <P> + * + * <EM>This method is meant to be overriden.</EM> + * <code>BeanContextChildSupport</code>'s implementation simply + * returns <code>true</code>. + * + * @param newBeanContext the new parent. + * @return whether to allow the parent to be changed to the new + * value. + */ + public boolean validatePendingSetBeanContext(BeanContext newBeanContext) { + return true; + } + + /** + * Called by <code>setBeanContext()</code> to release resources of a what will soon no longer be the parent. + * <P> + * + * <EM>This method is meant to be overriden.</EM> + * <code>BeanContextChildSupport</code>'s implementation does + * nothing. + */ + protected void releaseBeanContextResources() { + } + + /** + * Called by <code>setBeanContext()</code> to grab resources when the parent has been set. + * <P> + * + * <EM>This method is meant to be overriden.</EM> + * <code>BeanContextChildSupport</code>'s implementation does + * nothing. + */ + protected void initializeBeanContextResources() { + } } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextContainerProxy.java b/libjava/classpath/java/beans/beancontext/BeanContextContainerProxy.java index 3df91038bfe..962cb5fc9a8 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextContainerProxy.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextContainerProxy.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -54,10 +54,10 @@ import java.awt.Container; */ public interface BeanContextContainerProxy { - /** - * Get the <code>Container</code> associated with this <code>BeanContext</code>. - * @return the <code>Container</code> associated with this - * <code>BeanContext</code>. - */ - Container getContainer(); + /** + * Get the <code>Container</code> associated with this <code>BeanContext</code>. + * @return the <code>Container</code> associated with this + * <code>BeanContext</code>. + */ + Container getContainer(); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextEvent.java b/libjava/classpath/java/beans/beancontext/BeanContextEvent.java index f326541b034..959d54e5860 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextEvent.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextEvent.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -50,7 +50,7 @@ import java.util.EventObject; public abstract class BeanContextEvent extends EventObject { private static final long serialVersionUID = 7267998073569045052L; - + /** * The <code>BeanContext</code> that most recently passed this * event on. diff --git a/libjava/classpath/java/beans/beancontext/BeanContextMembershipEvent.java b/libjava/classpath/java/beans/beancontext/BeanContextMembershipEvent.java index 9560889f8f2..77b1be43eef 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextMembershipEvent.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextMembershipEvent.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -55,60 +55,60 @@ public class BeanContextMembershipEvent extends BeanContextEvent { private static final long serialVersionUID = 3499346510334590959L; /** - * The children that were added or removed. - */ - protected Collection children; - - /** - * Create a new membership event. - * @param context the event source. - * @param children the children added to or removed from the source. - */ - public BeanContextMembershipEvent(BeanContext context, Collection children) { - super(context); - this.children = children; - } - - /** - * Create a new membership event. - * @param context the event source. - * @param children the children added to or removed from the source. - */ - public BeanContextMembershipEvent(BeanContext context, Object[] children) { - super(context); - this.children = Arrays.asList(children); - } - - /** - * The number of children removed or added. - * @return the number of children removed or added. - */ - public int size() { - return children.size(); - } - - /** - * An iterator that will step through all the children. - * @return an iterator over all the children. - */ - public Iterator iterator() { - return children.iterator(); - } - - /** - * An array of the children. - * @return an array of the children. - */ - public Object[] toArray() { - return children.toArray(); - } - - /** - * Tell whether the <code>Object</code> is one of the children added or removed. - * @param child the child to check. - * @return whether the <code>Object</code> is added or removed. - */ - public boolean contains(Object child) { - return children.contains(child); - } + * The children that were added or removed. + */ + protected Collection children; + + /** + * Create a new membership event. + * @param context the event source. + * @param children the children added to or removed from the source. + */ + public BeanContextMembershipEvent(BeanContext context, Collection children) { + super(context); + this.children = children; + } + + /** + * Create a new membership event. + * @param context the event source. + * @param children the children added to or removed from the source. + */ + public BeanContextMembershipEvent(BeanContext context, Object[] children) { + super(context); + this.children = Arrays.asList(children); + } + + /** + * The number of children removed or added. + * @return the number of children removed or added. + */ + public int size() { + return children.size(); + } + + /** + * An iterator that will step through all the children. + * @return an iterator over all the children. + */ + public Iterator iterator() { + return children.iterator(); + } + + /** + * An array of the children. + * @return an array of the children. + */ + public Object[] toArray() { + return children.toArray(); + } + + /** + * Tell whether the <code>Object</code> is one of the children added or removed. + * @param child the child to check. + * @return whether the <code>Object</code> is added or removed. + */ + public boolean contains(Object child) { + return children.contains(child); + } } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextMembershipListener.java b/libjava/classpath/java/beans/beancontext/BeanContextMembershipListener.java index d39c36c4b12..cdb47c8118e 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextMembershipListener.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextMembershipListener.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -50,21 +50,21 @@ import java.util.EventListener; */ public interface BeanContextMembershipListener extends EventListener { - /** - * When beans are added to a <code>BeanContext</code>, - * this method is called to fire the event. - * - * @param event the event, including which children were added. - * @see java.beans.beancontext.BeanContext#add(java.lang.Object) - */ - void childrenAdded(BeanContextMembershipEvent event); + /** + * When beans are added to a <code>BeanContext</code>, + * this method is called to fire the event. + * + * @param event the event, including which children were added. + * @see java.beans.beancontext.BeanContext#add(java.lang.Object) + */ + void childrenAdded(BeanContextMembershipEvent event); - /** - * When beans are removed from a <code>BeanContext</code>, - * this method is called to fire the event. - * - * @param event the event, including which children were removed. - * @see java.beans.beancontext.BeanContext#remove(java.lang.Object) - */ - void childrenRemoved(BeanContextMembershipEvent event); + /** + * When beans are removed from a <code>BeanContext</code>, + * this method is called to fire the event. + * + * @param event the event, including which children were removed. + * @see java.beans.beancontext.BeanContext#remove(java.lang.Object) + */ + void childrenRemoved(BeanContextMembershipEvent event); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextProxy.java b/libjava/classpath/java/beans/beancontext/BeanContextProxy.java index 49dd7a77f30..53632e86be7 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextProxy.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextProxy.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -54,12 +54,12 @@ package java.beans.beancontext; */ public interface BeanContextProxy { - /** - * Return the <code>BeanContextChild</code> associated with this - * <code>Object</code>. - * - * @return the <code>BeanContextChild</code> associated with this - * <code>Object</code>. - */ - BeanContextChild getBeanContextProxy(); + /** + * Return the <code>BeanContextChild</code> associated with this + * <code>Object</code>. + * + * @return the <code>BeanContextChild</code> associated with this + * <code>Object</code>. + */ + BeanContextChild getBeanContextProxy(); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServiceAvailableEvent.java b/libjava/classpath/java/beans/beancontext/BeanContextServiceAvailableEvent.java index 6dc2c38ab39..a2bdcdde7b1 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextServiceAvailableEvent.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextServiceAvailableEvent.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -52,46 +52,46 @@ public class BeanContextServiceAvailableEvent extends BeanContextEvent { private static final long serialVersionUID = -5333985775656400778L; /** - * The <code>Class</code> representing the service which is now - * available. - */ - protected Class serviceClass; - - /** - * Create a new service available event. - * @param services the <code>BeanContextServices</code> through - * which the service is available. This is also the source - * of the event. - * @param serviceClass the service class that is now available. - */ - public BeanContextServiceAvailableEvent(BeanContextServices services, Class serviceClass) { - super(services); - this.serviceClass = serviceClass; - } - - /** - * Get the current service selectors of the service class. - * This is identical to <code>getSourceAsBeanContextServices().getCurrentServiceSelectors(getServiceClass())</code> - * @return the current service selectors of the service class. - */ - public Iterator getCurrentServiceSelectors() { - return getSourceAsBeanContextServices().getCurrentServiceSelectors(serviceClass); - } - - /** - * Get the newly available service class. - * @return the service class. - */ - public Class getServiceClass() { - return serviceClass; - } - - /** - * Get the <code>BeanContextServices</code> through which the new service is available. - * @return the <code>BeanContextServices</code> through which the - * new service is available. - */ - public BeanContextServices getSourceAsBeanContextServices() { - return (BeanContextServices)getSource(); - } + * The <code>Class</code> representing the service which is now + * available. + */ + protected Class serviceClass; + + /** + * Create a new service available event. + * @param services the <code>BeanContextServices</code> through + * which the service is available. This is also the source + * of the event. + * @param serviceClass the service class that is now available. + */ + public BeanContextServiceAvailableEvent(BeanContextServices services, Class serviceClass) { + super(services); + this.serviceClass = serviceClass; + } + + /** + * Get the current service selectors of the service class. + * This is identical to <code>getSourceAsBeanContextServices().getCurrentServiceSelectors(getServiceClass())</code> + * @return the current service selectors of the service class. + */ + public Iterator getCurrentServiceSelectors() { + return getSourceAsBeanContextServices().getCurrentServiceSelectors(serviceClass); + } + + /** + * Get the newly available service class. + * @return the service class. + */ + public Class getServiceClass() { + return serviceClass; + } + + /** + * Get the <code>BeanContextServices</code> through which the new service is available. + * @return the <code>BeanContextServices</code> through which the + * new service is available. + */ + public BeanContextServices getSourceAsBeanContextServices() { + return (BeanContextServices)getSource(); + } } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServiceProvider.java b/libjava/classpath/java/beans/beancontext/BeanContextServiceProvider.java index c09b5815fd7..7475a61bd8a 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextServiceProvider.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextServiceProvider.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -60,79 +60,79 @@ import java.util.Iterator; */ public interface BeanContextServiceProvider { - /** - * Get a service. - * Called from <code>BeanContextServices.getService()</code>. - * - * <p>If the requested service class is not available, or if this - * <code>BeanContextServiceProvider</code> chooses not honor the - * request for some reason, then this method will return - * <code>null</code>.</p> - * - * This method may throw unchecked exceptions, so watch out. - * - * @param services the <code>BeanContextServices</code> 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. - * @param 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. - * @param serviceClass the <code>Class</code> of the service being - * requested. - * @param serviceSelector a parameter to customize the service - * returned with. - * @return an instance of <code>serviceClass</code> (such that - * <code>instanceof</code> serviceClass is true), or - * <code>null</code>. - * @see java.beans.beancontext.BeanContextServices#getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener) - */ - Object getService(BeanContextServices services, Object requestor, Class serviceClass, Object serviceSelector); + /** + * Get a service. + * Called from <code>BeanContextServices.getService()</code>. + * + * <p>If the requested service class is not available, or if this + * <code>BeanContextServiceProvider</code> chooses not honor the + * request for some reason, then this method will return + * <code>null</code>.</p> + * + * This method may throw unchecked exceptions, so watch out. + * + * @param services the <code>BeanContextServices</code> 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. + * @param 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. + * @param serviceClass the <code>Class</code> of the service being + * requested. + * @param serviceSelector a parameter to customize the service + * returned with. + * @return an instance of <code>serviceClass</code> (such that + * <code>instanceof</code> serviceClass is true), or + * <code>null</code>. + * @see java.beans.beancontext.BeanContextServices#getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener) + */ + Object getService(BeanContextServices services, Object requestor, Class serviceClass, Object serviceSelector); - /** - * Release the service. - * <P> - * - * Called by <code>BeanContextServices.releaseService()</code>. - * <P> - * - * Most <code>BeanContextServiceProvider</code>s won't have to do - * anything here. - * - * @param services the <code>BeanContextServices</code> 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. - * @param requestor the original requestor of the service. - * @param service the service to relinquish - * @see java.beans.beancontext.BeanContextServices#releaseService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Object) - */ - void releaseService(BeanContextServices services, Object requestor, Object service); + /** + * Release the service. + * <P> + * + * Called by <code>BeanContextServices.releaseService()</code>. + * <P> + * + * Most <code>BeanContextServiceProvider</code>s won't have to do + * anything here. + * + * @param services the <code>BeanContextServices</code> 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. + * @param requestor the original requestor of the service. + * @param service the service to relinquish + * @see java.beans.beancontext.BeanContextServices#releaseService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Object) + */ + void releaseService(BeanContextServices services, Object requestor, Object service); - /** - * Get a list of valid service selectors for the specified service class. - * This method is called from - * <code>BeanContextServices.getCurrentServiceSelectors()</code>. - * <P> - * - * If the specified service class does not have a finite number of - * valid service selectors, it should return <code>null</code>. - * If it takes a general <code>Integer</code> parameter, for - * example, you may as well return <code>null</code> or the poor - * soul who called this method will be iterating all day. - * <P> - * - * If it has no valid service selectors, it should still return an empty - * <code>Iterator</code>. - * - * @param services the <code>BeanContextServices</code> 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. - * @param serviceClass the service class to get selectors for. - * @return a list of valid service selectors for the service - * class, or <code>null</code>. - * @see java.beans.beancontext.BeanContextServices#getCurrentServiceSelectors(java.lang.Class) - */ - Iterator getCurrentServiceSelectors(BeanContextServices services, Class serviceClass); + /** + * Get a list of valid service selectors for the specified service class. + * This method is called from + * <code>BeanContextServices.getCurrentServiceSelectors()</code>. + * <P> + * + * If the specified service class does not have a finite number of + * valid service selectors, it should return <code>null</code>. + * If it takes a general <code>Integer</code> parameter, for + * example, you may as well return <code>null</code> or the poor + * soul who called this method will be iterating all day. + * <P> + * + * If it has no valid service selectors, it should still return an empty + * <code>Iterator</code>. + * + * @param services the <code>BeanContextServices</code> 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. + * @param serviceClass the service class to get selectors for. + * @return a list of valid service selectors for the service + * class, or <code>null</code>. + * @see java.beans.beancontext.BeanContextServices#getCurrentServiceSelectors(java.lang.Class) + */ + Iterator getCurrentServiceSelectors(BeanContextServices services, Class serviceClass); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java b/libjava/classpath/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java index 690b94e2cc7..78bfc200dca 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -52,9 +52,9 @@ import java.beans.BeanInfo; * @since JDK1.2 */ public interface BeanContextServiceProviderBeanInfo extends BeanInfo { - /** - * Get <code>BeanInfo</code>s for all of the service classes of this <code>BeanInfoServiceProvider</code>. - * @return <code>BeanInfo</code>s for all provided service classes. - */ - BeanInfo[] getServicesBeanInfo(); + /** + * Get <code>BeanInfo</code>s for all of the service classes of this <code>BeanInfoServiceProvider</code>. + * @return <code>BeanInfo</code>s for all provided service classes. + */ + BeanInfo[] getServicesBeanInfo(); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServiceRevokedEvent.java b/libjava/classpath/java/beans/beancontext/BeanContextServiceRevokedEvent.java index 1f5ebd3cd83..b4f2fa8562d 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextServiceRevokedEvent.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextServiceRevokedEvent.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -50,63 +50,63 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent { private static final long serialVersionUID = -1295543154724961754L; /** - * The <code>Class</code> representing the service which is now - * available. - */ - protected Class serviceClass; - private boolean invalidateRefs; - - /** - * Create a new service revoked event. - * @param services the <code>BeanContextServices</code> through - * which the service was available. This is also the source - * of the event. - * @param serviceClass the service class that is now revoked. - * @param revokeNow whether the revocation is immediate for all - * classes or just a suggestion. - */ - public BeanContextServiceRevokedEvent(BeanContextServices services, Class serviceClass, boolean revokeNow) { - super(services); - this.serviceClass = serviceClass; - invalidateRefs = revokeNow; - } - - /** - * Get the revoked service class. - * @return the service class. - */ - public Class getServiceClass() { - return serviceClass; - } - - /** - * Tell whether the revoked service class is the same as the specified class. - * Identical to <code>getServiceClass().equals(c)</code>. - * @param c the class to compare. - * @return whether the clases are equal. - */ - public boolean isServiceClass(Class c) { - return serviceClass.equals(c); - } - - /** - * Get the <code>BeanContextServices</code> through which the service was available. - * @return the <code>BeanContextServices</code> through which the - * service was available. - */ - public BeanContextServices getSourceAsBeanContextServices() { - return (BeanContextServices)getSource(); - } - - /** - * Tell whether current instances of the revoked service are usable or not. - * This is determined by whether the service was revoked - * immediately. - * - * @return whether current instances of the revoked service are - * usable. - */ - public boolean isCurrentServiceInvalidNow() { - return invalidateRefs; - } + * The <code>Class</code> representing the service which is now + * available. + */ + protected Class serviceClass; + private boolean invalidateRefs; + + /** + * Create a new service revoked event. + * @param services the <code>BeanContextServices</code> through + * which the service was available. This is also the source + * of the event. + * @param serviceClass the service class that is now revoked. + * @param revokeNow whether the revocation is immediate for all + * classes or just a suggestion. + */ + public BeanContextServiceRevokedEvent(BeanContextServices services, Class serviceClass, boolean revokeNow) { + super(services); + this.serviceClass = serviceClass; + invalidateRefs = revokeNow; + } + + /** + * Get the revoked service class. + * @return the service class. + */ + public Class getServiceClass() { + return serviceClass; + } + + /** + * Tell whether the revoked service class is the same as the specified class. + * Identical to <code>getServiceClass().equals(c)</code>. + * @param c the class to compare. + * @return whether the clases are equal. + */ + public boolean isServiceClass(Class c) { + return serviceClass.equals(c); + } + + /** + * Get the <code>BeanContextServices</code> through which the service was available. + * @return the <code>BeanContextServices</code> through which the + * service was available. + */ + public BeanContextServices getSourceAsBeanContextServices() { + return (BeanContextServices)getSource(); + } + + /** + * Tell whether current instances of the revoked service are usable or not. + * This is determined by whether the service was revoked + * immediately. + * + * @return whether current instances of the revoked service are + * usable. + */ + public boolean isCurrentServiceInvalidNow() { + return invalidateRefs; + } } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServiceRevokedListener.java b/libjava/classpath/java/beans/beancontext/BeanContextServiceRevokedListener.java index 101e6e191b0..11b83dd65b3 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextServiceRevokedListener.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextServiceRevokedListener.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -48,15 +48,15 @@ import java.util.EventListener; */ public interface BeanContextServiceRevokedListener extends EventListener { - /** - * Called by <code>BeanContextServices.revokeService()</code> 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. - * <code>getService()</code> will no longer work on the specified - * service class after this event has been fired. - * - * @param event the service revoked event. - * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean) - */ - void serviceRevoked(BeanContextServiceRevokedEvent event); + /** + * Called by <code>BeanContextServices.revokeService()</code> 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. + * <code>getService()</code> will no longer work on the specified + * service class after this event has been fired. + * + * @param event the service revoked event. + * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean) + */ + void serviceRevoked(BeanContextServiceRevokedEvent event); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServices.java b/libjava/classpath/java/beans/beancontext/BeanContextServices.java index cb1950360af..787618ad51d 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextServices.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextServices.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServicesListener.java b/libjava/classpath/java/beans/beancontext/BeanContextServicesListener.java index becc7cdb6e4..2081080dd8f 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextServicesListener.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextServicesListener.java @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -46,11 +46,11 @@ package java.beans.beancontext; */ public interface BeanContextServicesListener extends BeanContextServiceRevokedListener { - /** - * Called by <code>BeanContextServices</code> whenever a service is made available. - * - * @param event the service revoked event, with useful information - * about the new service. - */ - void serviceAvailable(BeanContextServiceAvailableEvent event); + /** + * Called by <code>BeanContextServices</code> whenever a service is made available. + * + * @param event the service revoked event, with useful information + * about the new service. + */ + void serviceAvailable(BeanContextServiceAvailableEvent event); } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java b/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java index 725c2d46888..30b4a6fbdbd 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java @@ -66,7 +66,7 @@ public class BeanContextServicesSupport implements BeanContextServices { private static final long serialVersionUID = -8494482757288719206L; - + protected class BCSSChild extends BeanContextSupport.BCSChild { @@ -103,7 +103,7 @@ public class BeanContextServicesSupport Object serviceSelector) { return provider.getService(bcs, requestor, serviceClass, - serviceSelector); + serviceSelector); } public void releaseService (BeanContextServices bcs, @@ -116,7 +116,7 @@ public class BeanContextServicesSupport public void serviceRevoked (BeanContextServiceRevokedEvent bcsre) { if (provider instanceof BeanContextServiceRevokedListener) - ((BeanContextServiceRevokedListener) provider).serviceRevoked(bcsre); + ((BeanContextServiceRevokedListener) provider).serviceRevoked(bcsre); } } @@ -130,7 +130,7 @@ public class BeanContextServicesSupport private Class serviceClass; private BCSSServiceProvider(Class serviceClass, - BeanContextServiceProvider provider) + BeanContextServiceProvider provider) { this.serviceClass = serviceClass; serviceProvider = provider; @@ -167,10 +167,10 @@ public class BeanContextServicesSupport public boolean equals(Object obj) { if (obj instanceof Request) - { - Request req = (Request) obj; - return req.getRequestor().equals(requestor); - } + { + Request req = (Request) obj; + return req.getRequestor().equals(requestor); + } return false; } @@ -194,7 +194,7 @@ public class BeanContextServicesSupport private BeanContextServiceRevokedListener listener; public ServiceRequest(Object requestor, - BeanContextServiceRevokedListener listener) + BeanContextServiceRevokedListener listener) { super(requestor); this.listener = listener; @@ -203,11 +203,11 @@ public class BeanContextServicesSupport public boolean equals(Object obj) { if (obj instanceof ServiceRequest) - { - ServiceRequest sr = (ServiceRequest) obj; - return (super.equals(obj) && - sr.getListener().equals(listener)); - } + { + ServiceRequest sr = (ServiceRequest) obj; + return (super.equals(obj) && + sr.getListener().equals(listener)); + } return false; } @@ -238,11 +238,11 @@ public class BeanContextServicesSupport public boolean equals(Object obj) { if (obj instanceof ServiceLease) - { - ServiceLease sl = (ServiceLease) obj; - return (super.equals(obj) && - sl.getService().equals(service)); - } + { + ServiceLease sl = (ServiceLease) obj; + return (super.equals(obj) && + sl.getService().equals(service)); + } return false; } @@ -257,7 +257,7 @@ public class BeanContextServicesSupport * and revocation notifications. */ protected transient ArrayList bcsListeners; - + protected transient BCSSProxyServiceProvider proxy; /** @@ -297,7 +297,7 @@ public class BeanContextServicesSupport /** * Construct a {@link BeanContextServicesSupport} instance. - * + * * @param peer the bean context services peer (<code>null</code> permitted). */ public BeanContextServicesSupport (BeanContextServices peer) @@ -307,9 +307,9 @@ public class BeanContextServicesSupport /** * Construct a {@link BeanContextServicesSupport} instance. - * + * * @param peer the bean context peer (<code>null</code> permitted). - * @param locale the locale (<code>null</code> permitted, equivalent to + * @param locale the locale (<code>null</code> permitted, equivalent to * the default locale). */ public BeanContextServicesSupport(BeanContextServices peer, Locale locale) @@ -319,9 +319,9 @@ public class BeanContextServicesSupport /** * Construct a {@link BeanContextServicesSupport} instance. - * + * * @param peer the bean context peer (<code>null</code> permitted). - * @param locale the locale (<code>null</code> permitted, equivalent to + * @param locale the locale (<code>null</code> permitted, equivalent to * the default locale). * @param dtime a flag indicating whether or not the bean context is in * design time mode. @@ -334,9 +334,9 @@ public class BeanContextServicesSupport /** * Construct a {@link BeanContextServicesSupport} instance. - * + * * @param peer the bean context peer (<code>null</code> permitted). - * @param locale the locale (<code>null</code> permitted, equivalent to + * @param locale the locale (<code>null</code> permitted, equivalent to * the default locale). * @param dtime a flag indicating whether or not the bean context is in * design time mode. @@ -347,7 +347,7 @@ public class BeanContextServicesSupport { super(peer, locale, dtime, visible); } - + /** * Adds a new listener for service availability and * revocation events. @@ -403,21 +403,21 @@ public class BeanContextServicesSupport { synchronized (globalHierarchyLock) { - synchronized (services) - { - if (services.containsKey(serviceClass)) - return false; - services.put(serviceClass, - createBCSSServiceProvider(serviceClass, bcsp)); - if (bcsp instanceof Serializable) - ++serializable; - if (fireEvent) - fireServiceAdded(serviceClass); - return true; - } + synchronized (services) + { + if (services.containsKey(serviceClass)) + return false; + services.put(serviceClass, + createBCSSServiceProvider(serviceClass, bcsp)); + if (bcsp instanceof Serializable) + ++serializable; + if (fireEvent) + fireServiceAdded(serviceClass); + return true; + } } } - + /** * Deserializes any service providers which are serializable. This * method is called by the <code>readObject</code> method of @@ -436,8 +436,8 @@ public class BeanContextServicesSupport serializable = ois.readInt(); for (int a = 0; a < serializable; ++a) { - BCSSServiceProvider bcsssp = (BCSSServiceProvider) ois.readObject(); - addService(bcsssp.getServiceClass(), bcsssp.getServiceProvider()); + BCSSServiceProvider bcsssp = (BCSSServiceProvider) ois.readObject(); + addService(bcsssp.getServiceClass(), bcsssp.getServiceProvider()); } } @@ -451,19 +451,19 @@ public class BeanContextServicesSupport * @param oos the stream to which data is being serialized. * @throws IOException if an I/O error occurs. */ - protected void bcsPreSerializationHook (ObjectOutputStream oos) + protected void bcsPreSerializationHook (ObjectOutputStream oos) throws IOException { oos.writeInt(serializable); synchronized (services) { - Iterator i = services.values().iterator(); - while (i.hasNext()) - { - BCSSServiceProvider bcsssp = (BCSSServiceProvider) i.next(); - if (bcsssp.getServiceProvider() instanceof Serializable) - oos.writeObject(bcsssp); - } + Iterator i = services.values().iterator(); + while (i.hasNext()) + { + BCSSServiceProvider bcsssp = (BCSSServiceProvider) i.next(); + if (bcsssp.getServiceProvider() instanceof Serializable) + oos.writeObject(bcsssp); + } } } @@ -476,17 +476,17 @@ public class BeanContextServicesSupport * * @param child the child being removed. * @param bcsc the support object for the child. - */ + */ protected void childJustRemovedHook (Object child, BeanContextSupport.BCSChild bcsc) { if (child instanceof BeanContextChild) { - BeanContextChild bcchild = (BeanContextChild) child; - Iterator childServices = ((List) serviceUsers.get(bcchild)).iterator(); - while (childServices.hasNext()) - releaseService(bcchild, this, childServices.next()); - serviceUsers.remove(bcchild); + BeanContextChild bcchild = (BeanContextChild) child; + Iterator childServices = ((List) serviceUsers.get(bcchild)).iterator(); + while (childServices.hasNext()) + releaseService(bcchild, this, childServices.next()); + serviceUsers.remove(bcchild); } } @@ -570,16 +570,16 @@ public class BeanContextServicesSupport = (BeanContextServicesListener) bcsListeners.get(i); bcsl.serviceRevoked(event); } - List requests = (List) serviceRequests.get(event.getServiceClass()); - if (requests != null) - { - Iterator i = requests.iterator(); - while (i.hasNext()) - { - ServiceRequest r = (ServiceRequest) i.next(); - r.getListener().serviceRevoked(event); - } - } + List requests = (List) serviceRequests.get(event.getServiceClass()); + if (requests != null) + { + Iterator i = requests.iterator(); + while (i.hasNext()) + { + ServiceRequest r = (ServiceRequest) i.next(); + r.getListener().serviceRevoked(event); + } + } } } @@ -609,20 +609,20 @@ public class BeanContextServicesSupport } /** - * Returns <code>child</code> as an instance of - * {@link BeanContextServicesListener}, or <code>null</code> if + * Returns <code>child</code> as an instance of + * {@link BeanContextServicesListener}, or <code>null</code> if * <code>child</code> does not implement that interface. - * + * * @param child the child (<code>null</code> permitted). - * + * * @return The child cast to {@link BeanContextServicesListener}. */ protected static final BeanContextServicesListener getChildBeanContextServicesListener(Object child) { - if (child instanceof BeanContextServicesListener) + if (child instanceof BeanContextServicesListener) return (BeanContextServicesListener) child; - else + else return null; } @@ -636,10 +636,10 @@ public class BeanContextServicesSupport { synchronized (globalHierarchyLock) { - synchronized (services) - { - return services.keySet().iterator(); - } + synchronized (services) + { + return services.keySet().iterator(); + } } } @@ -660,16 +660,16 @@ public class BeanContextServicesSupport { synchronized (globalHierarchyLock) { - synchronized (services) - { - BeanContextServiceProvider bcsp - = ((BCSSServiceProvider) - services.get(serviceClass)).getServiceProvider(); - if (bcsp == null) - return null; - else - return bcsp.getCurrentServiceSelectors(this, serviceClass); - } + synchronized (services) + { + BeanContextServiceProvider bcsp + = ((BCSSServiceProvider) + services.get(serviceClass)).getServiceProvider(); + if (bcsp == null) + return null; + else + return bcsp.getCurrentServiceSelectors(this, serviceClass); + } } } @@ -699,47 +699,47 @@ public class BeanContextServicesSupport { synchronized (globalHierarchyLock) { - synchronized (services) - { - Object service; - BeanContextServiceProvider provider = ((BCSSServiceProvider) - services.get(serviceClass)).getServiceProvider(); - if (provider != null) - { - service = provider.getService(this, requestor, serviceClass, - serviceSelector); - List childServices = (List) serviceUsers.get(child); - if (childServices == null) - { - childServices = new ArrayList(); - serviceUsers.put(child, childServices); - } - childServices.add(serviceClass); - } - else - { - BeanContextServices peer = getBeanContextServicesPeer(); - if (peer != null) - service = peer.getService(child, requestor, serviceClass, - serviceSelector, bcsrl); - else - service = null; - } - if (service != null) - { - ServiceRequest request = new ServiceRequest(requestor, bcsrl); - Set requests = (Set) serviceRequests.get(serviceClass); - if (requests == null) - { - requests = new HashSet(); - serviceRequests.put(serviceClass, requests); - } - requests.add(request); - ServiceLease lease = new ServiceLease(requestor, service); - serviceLeases.put(lease, provider); - } - return service; - } + synchronized (services) + { + Object service; + BeanContextServiceProvider provider = ((BCSSServiceProvider) + services.get(serviceClass)).getServiceProvider(); + if (provider != null) + { + service = provider.getService(this, requestor, serviceClass, + serviceSelector); + List childServices = (List) serviceUsers.get(child); + if (childServices == null) + { + childServices = new ArrayList(); + serviceUsers.put(child, childServices); + } + childServices.add(serviceClass); + } + else + { + BeanContextServices peer = getBeanContextServicesPeer(); + if (peer != null) + service = peer.getService(child, requestor, serviceClass, + serviceSelector, bcsrl); + else + service = null; + } + if (service != null) + { + ServiceRequest request = new ServiceRequest(requestor, bcsrl); + Set requests = (Set) serviceRequests.get(serviceClass); + if (requests == null) + { + requests = new HashSet(); + serviceRequests.put(serviceClass, requests); + } + requests.add(request); + ServiceLease lease = new ServiceLease(requestor, service); + serviceLeases.put(lease, provider); + } + return service; + } } } @@ -753,10 +753,10 @@ public class BeanContextServicesSupport { synchronized (globalHierarchyLock) { - synchronized (services) - { - return services.containsKey(serviceClass); - } + synchronized (services) + { + return services.containsKey(serviceClass); + } } } @@ -784,7 +784,7 @@ public class BeanContextServicesSupport * Relinquishes any resources obtained from the parent context. * Specifically, those services obtained from the parent are revoked. * Subclasses may override this method to deallocate resources - * from the nesting bean context. + * from the nesting bean context. */ protected void releaseBeanContextResources() { @@ -806,21 +806,21 @@ public class BeanContextServicesSupport { synchronized (globalHierarchyLock) { - synchronized (services) - { - ServiceLease lease = new ServiceLease(requestor, service); - BeanContextServiceProvider provider = (BeanContextServiceProvider) - serviceLeases.get(lease); - if (provider != null) - provider.releaseService(this, requestor, service); - else - { - BeanContextServices peer = getBeanContextServicesPeer(); - if (peer != null) - peer.releaseService(child, requestor, service); - } - serviceLeases.remove(lease); - } + synchronized (services) + { + ServiceLease lease = new ServiceLease(requestor, service); + BeanContextServiceProvider provider = (BeanContextServiceProvider) + serviceLeases.get(lease); + if (provider != null) + provider.releaseService(this, requestor, service); + else + { + BeanContextServices peer = getBeanContextServicesPeer(); + if (peer != null) + peer.releaseService(child, requestor, service); + } + serviceLeases.remove(lease); + } } } @@ -829,7 +829,7 @@ public class BeanContextServicesSupport { synchronized (bcsListeners) { - bcsListeners.remove(listener); + bcsListeners.remove(listener); } } @@ -850,13 +850,13 @@ public class BeanContextServicesSupport { synchronized (globalHierarchyLock) { - synchronized (services) - { - fireServiceRevoked(serviceClass, revokeCurrentServicesNow); - services.remove(serviceClass); - if (bcsp instanceof Serializable) - --serializable; - } + synchronized (services) + { + fireServiceRevoked(serviceClass, revokeCurrentServicesNow); + services.remove(serviceClass); + if (bcsp instanceof Serializable) + --serializable; + } } } diff --git a/libjava/classpath/java/beans/beancontext/BeanContextSupport.java b/libjava/classpath/java/beans/beancontext/BeanContextSupport.java index 7572af3f0f9..fdae387d41c 100644 --- a/libjava/classpath/java/beans/beancontext/BeanContextSupport.java +++ b/libjava/classpath/java/beans/beancontext/BeanContextSupport.java @@ -188,7 +188,7 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Construct a BeanContextSupport instance. - * + * * @param peer the bean context peer (<code>null</code> permitted). */ public BeanContextSupport(BeanContext peer) @@ -198,9 +198,9 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Construct a BeanContextSupport instance. - * + * * @param peer the bean context peer (<code>null</code> permitted). - * @param locale the locale (<code>null</code> permitted, equivalent to + * @param locale the locale (<code>null</code> permitted, equivalent to * the default locale). */ public BeanContextSupport (BeanContext peer, Locale locale) @@ -210,9 +210,9 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Construct a BeanContextSupport instance. - * + * * @param peer the bean context peer (<code>null</code> permitted). - * @param locale the locale (<code>null</code> permitted, equivalent to + * @param locale the locale (<code>null</code> permitted, equivalent to * the default locale). * @param dtime a flag indicating whether or not the bean context is in * design time mode. @@ -224,9 +224,9 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Construct a BeanContextSupport instance. - * + * * @param peer the bean context peer (<code>null</code> permitted). - * @param locale the locale (<code>null</code> permitted, equivalent to + * @param locale the locale (<code>null</code> permitted, equivalent to * the default locale). * @param dtime a flag indicating whether or not the bean context is in * design time mode. @@ -248,7 +248,7 @@ public class BeanContextSupport extends BeanContextChildSupport * <p> * Add a child to the bean context. A child can be a simple * <code>Object</code>, a <code>BeanContextChild</code> - * or another <code>BeanContext</code>. + * or another <code>BeanContext</code>. * </p> * <p> * The children of a <code>BeanContext</code> form a set. As @@ -272,7 +272,7 @@ public class BeanContextSupport extends BeanContextChildSupport * then its ability to use a GUI is set based on that of * this context. * </p> - * <p> + * <p> * A <code>BeanContextMembershipEvent</code> is fired when the * child is successfully added to the bean context. * </p> @@ -290,55 +290,55 @@ public class BeanContextSupport extends BeanContextChildSupport { synchronized (globalHierarchyLock) { - if (targetChild == null) - throw new IllegalArgumentException(); - - BCSChild child; - synchronized (children) - { - if (children.containsKey(targetChild) - || ! validatePendingAdd(targetChild)) - return false; - child = createBCSChild(targetChild, beanContextChildPeer); - children.put(targetChild, child); - } - synchronized (targetChild) - { - BeanContextChild bcChild = null; - if (targetChild instanceof BeanContextChild) - bcChild = (BeanContextChild) targetChild; - if (targetChild instanceof BeanContextProxy) - bcChild = ((BeanContextProxy) targetChild).getBeanContextProxy(); - if (bcChild != null) - try - { - bcChild.setBeanContext(this); - bcChild.addVetoableChangeListener("beanContext", this); - bcChild.addPropertyChangeListener("beanContext", this); - } - catch (PropertyVetoException e) - { - synchronized (children) - { - children.remove(targetChild); - } - throw new IllegalStateException("The child refused to " + - "associate itself with " + - "this context.", e); - } - if (targetChild instanceof Visibility) - { - Visibility visibleChild = (Visibility) targetChild; - if (okToUseGui) - visibleChild.okToUseGui(); - else - visibleChild.dontUseGui(); - } - childJustAddedHook(targetChild, child); - } - fireChildrenAdded(new BeanContextMembershipEvent(this, - new Object[]{ targetChild })); - return true; + if (targetChild == null) + throw new IllegalArgumentException(); + + BCSChild child; + synchronized (children) + { + if (children.containsKey(targetChild) + || ! validatePendingAdd(targetChild)) + return false; + child = createBCSChild(targetChild, beanContextChildPeer); + children.put(targetChild, child); + } + synchronized (targetChild) + { + BeanContextChild bcChild = null; + if (targetChild instanceof BeanContextChild) + bcChild = (BeanContextChild) targetChild; + if (targetChild instanceof BeanContextProxy) + bcChild = ((BeanContextProxy) targetChild).getBeanContextProxy(); + if (bcChild != null) + try + { + bcChild.setBeanContext(this); + bcChild.addVetoableChangeListener("beanContext", this); + bcChild.addPropertyChangeListener("beanContext", this); + } + catch (PropertyVetoException e) + { + synchronized (children) + { + children.remove(targetChild); + } + throw new IllegalStateException("The child refused to " + + "associate itself with " + + "this context.", e); + } + if (targetChild instanceof Visibility) + { + Visibility visibleChild = (Visibility) targetChild; + if (okToUseGui) + visibleChild.okToUseGui(); + else + visibleChild.dontUseGui(); + } + childJustAddedHook(targetChild, child); + } + fireChildrenAdded(new BeanContextMembershipEvent(this, + new Object[]{ targetChild })); + return true; } } @@ -415,7 +415,7 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Called when a child is deserialized. - * + * * @param child the deserialized child. * @param bcsc the deserialized context wrapper for the child. */ @@ -489,16 +489,16 @@ public class BeanContextSupport extends BeanContextChildSupport } /** - * Deserializes objects (written by {@link #serialize(ObjectOutputStream, + * Deserializes objects (written by {@link #serialize(ObjectOutputStream, * Collection)}) and adds them to the specified collection. - * + * * @param ois the input stream (<code>null</code> not permitted). * @param coll the collection to add the objects to (<code>null</code> not * permitted). - * + * * @throws ClassNotFoundException * @throws IOException - * + * * @see #serialize(ObjectOutputStream, Collection) */ protected final void deserialize (ObjectInputStream ois, Collection coll) @@ -548,9 +548,9 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Returns the bean context peer. - * + * * @return The bean context peer. - * + * * @see BeanContextChildSupport#beanContextChildPeer */ public BeanContext getBeanContextPeer() @@ -560,11 +560,11 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Returns the {@link BeanContextChild} implementation for the given child. - * + * * @param child the child (<code>null</code> permitted). - * + * * @return The bean context child. - * + * * @throws IllegalArgumentException if <code>child</code> implements both * the {@link BeanContextChild} and {@link BeanContextProxy} interfaces. */ @@ -573,7 +573,7 @@ public class BeanContextSupport extends BeanContextChildSupport if (child == null) return null; if (child instanceof BeanContextChild && child instanceof BeanContextProxy) - throw new IllegalArgumentException("Child cannot implement " + throw new IllegalArgumentException("Child cannot implement " + "BeanContextChild and BeanContextProxy simultaneously."); if (child instanceof BeanContextChild) return (BeanContextChild) child; @@ -583,89 +583,89 @@ public class BeanContextSupport extends BeanContextChildSupport } /** - * Returns <code>child</code> as an instance of - * {@link BeanContextMembershipListener}, or <code>null</code> if + * Returns <code>child</code> as an instance of + * {@link BeanContextMembershipListener}, or <code>null</code> if * <code>child</code> does not implement that interface. - * + * * @param child the child (<code>null</code> permitted). - * + * * @return The child cast to {@link BeanContextMembershipListener}. */ - protected static final BeanContextMembershipListener + protected static final BeanContextMembershipListener getChildBeanContextMembershipListener(Object child) { - if (child instanceof BeanContextMembershipListener) + if (child instanceof BeanContextMembershipListener) return (BeanContextMembershipListener) child; - else + else return null; } /** - * Returns <code>child</code> as an instance of + * Returns <code>child</code> as an instance of * {@link PropertyChangeListener}, or <code>null</code> if <code>child</code> * does not implement that interface. - * + * * @param child the child (<code>null</code> permitted). - * + * * @return The child cast to {@link PropertyChangeListener}. */ protected static final PropertyChangeListener getChildPropertyChangeListener( Object child) { - if (child instanceof PropertyChangeListener) + if (child instanceof PropertyChangeListener) return (PropertyChangeListener) child; - else + else return null; } /** - * Returns <code>child</code> as an instance of {@link Serializable}, or - * <code>null</code> if <code>child</code> does not implement that + * Returns <code>child</code> as an instance of {@link Serializable}, or + * <code>null</code> if <code>child</code> does not implement that * interface. - * + * * @param child the child (<code>null</code> permitted). - * + * * @return The child cast to {@link Serializable}. */ protected static final Serializable getChildSerializable(Object child) { - if (child instanceof Serializable) + if (child instanceof Serializable) return (Serializable) child; - else + else return null; } /** - * Returns <code>child</code> as an instance of + * Returns <code>child</code> as an instance of * {@link VetoableChangeListener}, or <code>null</code> if <code>child</code> * does not implement that interface. - * + * * @param child the child (<code>null</code> permitted). - * + * * @return The child cast to {@link VetoableChangeListener}. */ protected static final VetoableChangeListener getChildVetoableChangeListener( Object child) { - if (child instanceof VetoableChangeListener) + if (child instanceof VetoableChangeListener) return (VetoableChangeListener) child; - else + else return null; } /** * Returns <code>child</code> as an instance of {@link Visibility}, or * <code>null</code> if <code>child</code> does not implement that interface. - * + * * @param child the child (<code>null</code> permitted). - * + * * @return The child cast to {@link Visibility}. */ protected static final Visibility getChildVisibility(Object child) { - if (child instanceof Visibility) + if (child instanceof Visibility) return (Visibility) child; - else + else return null; } @@ -715,11 +715,11 @@ public class BeanContextSupport extends BeanContextChildSupport } /** - * Returns <code>true</code> if the <code>BeanContext</code> is in + * Returns <code>true</code> if the <code>BeanContext</code> is in * design time mode, and <code>false</code> if it is in runtime mode. - * + * * @return A boolean. - * + * * @see #setDesignTime(boolean) */ public boolean isDesignTime() @@ -810,15 +810,15 @@ public class BeanContextSupport extends BeanContextChildSupport Iterator i = temp.iterator(); synchronized (globalHierarchyLock) { - synchronized (children) - { - while (i.hasNext()) - { - BCSChild bcs = (BCSChild) i.next(); - childDeserializedHook(bcs.getTargetChild(), bcs); - children.put(bcs.getTargetChild(), bcs); - } - } + synchronized (children) + { + while (i.hasNext()) + { + BCSChild bcs = (BCSChild) i.next(); + childDeserializedHook(bcs.getTargetChild(), bcs); + children.put(bcs.getTargetChild(), bcs); + } + } } } @@ -854,7 +854,7 @@ public class BeanContextSupport extends BeanContextChildSupport * <code>PropertyChangeListener</code> and * <code>VetoableChangeListener</code> for "beanContext" events. * </p> - * <p> + * <p> * A <code>BeanContextMembershipEvent</code> is fired when the * child is successfully removed from the bean context. * </p> @@ -874,47 +874,47 @@ public class BeanContextSupport extends BeanContextChildSupport { synchronized (globalHierarchyLock) { - if (targetChild == null) - throw new IllegalArgumentException(); - - BCSChild child; - synchronized (children) - { - if (!children.containsKey(targetChild) - || !validatePendingRemove(targetChild)) - return false; - child = (BCSChild) children.remove(targetChild); - } - synchronized (targetChild) - { - BeanContextChild bcChild = null; - if (targetChild instanceof BeanContextChild) - bcChild = (BeanContextChild) targetChild; - if (targetChild instanceof BeanContextProxy) - bcChild = ((BeanContextProxy) targetChild).getBeanContextProxy(); - if (bcChild != null) - try - { - if (callChildSetBC) - bcChild.setBeanContext(null); - bcChild.removeVetoableChangeListener("beanContext", this); - bcChild.removePropertyChangeListener("beanContext", this); - } - catch (PropertyVetoException e) - { - synchronized (children) - { - children.put(targetChild, child); - } - throw new IllegalStateException("The child refused to " + - "disassociate itself with " + - "this context.", e); - } - childJustRemovedHook(targetChild, child); - } - fireChildrenRemoved(new BeanContextMembershipEvent(this, - new Object[]{ targetChild })); - return true; + if (targetChild == null) + throw new IllegalArgumentException(); + + BCSChild child; + synchronized (children) + { + if (!children.containsKey(targetChild) + || !validatePendingRemove(targetChild)) + return false; + child = (BCSChild) children.remove(targetChild); + } + synchronized (targetChild) + { + BeanContextChild bcChild = null; + if (targetChild instanceof BeanContextChild) + bcChild = (BeanContextChild) targetChild; + if (targetChild instanceof BeanContextProxy) + bcChild = ((BeanContextProxy) targetChild).getBeanContextProxy(); + if (bcChild != null) + try + { + if (callChildSetBC) + bcChild.setBeanContext(null); + bcChild.removeVetoableChangeListener("beanContext", this); + bcChild.removePropertyChangeListener("beanContext", this); + } + catch (PropertyVetoException e) + { + synchronized (children) + { + children.put(targetChild, child); + } + throw new IllegalStateException("The child refused to " + + "disassociate itself with " + + "this context.", e); + } + childJustRemovedHook(targetChild, child); + } + fireChildrenRemoved(new BeanContextMembershipEvent(this, + new Object[]{ targetChild })); + return true; } } @@ -940,14 +940,14 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Writes the items in the collection to the specified output stream. Items - * in the collection that are not instances of {@link Serializable} + * in the collection that are not instances of {@link Serializable} * (this includes <code>null</code>) are simply ignored. - * + * * @param oos the output stream (<code>null</code> not permitted). * @param coll the collection (<code>null</code> not permitted). - * + * * @throws IOException - * + * * @see #deserialize(ObjectInputStream, Collection) */ protected final void serialize(ObjectOutputStream oos, Collection coll) @@ -969,15 +969,15 @@ public class BeanContextSupport extends BeanContextChildSupport } /** - * Sets the flag that indicates whether or not the + * Sets the flag that indicates whether or not the * <code>BeanContext</code> is in design mode. If the flag changes * value, a {@link PropertyChangeEvent} (with the property name 'designMode') * is sent to registered listeners. Note that the property name used here * does NOT match the specification in the {@link DesignMode} interface, we * match the reference implementation instead - see bug parade entry 4295174. - * + * * @param dtime the new value for the flag. - * + * * @see #isDesignTime() */ public void setDesignTime(boolean dtime) @@ -1011,7 +1011,7 @@ public class BeanContextSupport extends BeanContextChildSupport /** * Returns an array containing the children of this <code>BeanContext</code>. - * + * * @return An array containing the children. */ public Object[] toArray() @@ -1023,11 +1023,11 @@ public class BeanContextSupport extends BeanContextChildSupport } /** - * Populates, then returns, the supplied array with the children of this - * <code>BeanContext</code>. If the array is too short to hold the - * children, a new array is allocated and returned. If the array is too + * Populates, then returns, the supplied array with the children of this + * <code>BeanContext</code>. If the array is too short to hold the + * children, a new array is allocated and returned. If the array is too * long, it is padded with <code>null</code> items at the end. - * + * * @param array an array to populate (<code>null</code> not permitted). */ public Object[] toArray(Object[] array) @@ -1072,7 +1072,7 @@ public class BeanContextSupport extends BeanContextChildSupport { synchronized (children) { - serialize(oos, children.values()); + serialize(oos, children.values()); } } |