feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
135
jdkSrc/jdk8/java/beans/beancontext/BeanContext.java
Normal file
135
jdkSrc/jdk8/java/beans/beancontext/BeanContext.java
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.DesignMode;
|
||||
import java.beans.Visibility;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The BeanContext acts a logical hierarchical container for JavaBeans.
|
||||
* </p>
|
||||
*
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
*
|
||||
* @see java.beans.Beans
|
||||
* @see java.beans.beancontext.BeanContextChild
|
||||
* @see java.beans.beancontext.BeanContextMembershipListener
|
||||
* @see java.beans.PropertyChangeEvent
|
||||
* @see java.beans.DesignMode
|
||||
* @see java.beans.Visibility
|
||||
* @see java.util.Collection
|
||||
*/
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public interface BeanContext extends BeanContextChild, Collection, DesignMode, Visibility {
|
||||
|
||||
/**
|
||||
* Instantiate the javaBean named as a
|
||||
* child of this <code>BeanContext</code>.
|
||||
* The implementation of the JavaBean is
|
||||
* derived from the value of the beanName parameter,
|
||||
* and is defined by the
|
||||
* <code>java.beans.Beans.instantiate()</code> method.
|
||||
*
|
||||
* @return a javaBean named as a child of this
|
||||
* <code>BeanContext</code>
|
||||
* @param beanName The name of the JavaBean to instantiate
|
||||
* as a child of this <code>BeanContext</code>
|
||||
* @throws IOException if an IO problem occurs
|
||||
* @throws ClassNotFoundException if the class identified
|
||||
* by the beanName parameter is not found
|
||||
*/
|
||||
Object instantiateChild(String beanName) throws IOException, ClassNotFoundException;
|
||||
|
||||
/**
|
||||
* Analagous to <code>java.lang.ClassLoader.getResourceAsStream()</code>,
|
||||
* this method allows a <code>BeanContext</code> implementation
|
||||
* to interpose behavior between the child <code>Component</code>
|
||||
* and underlying <code>ClassLoader</code>.
|
||||
*
|
||||
* @param name the resource name
|
||||
* @param bcc the specified child
|
||||
* @return an <code>InputStream</code> for reading the resource,
|
||||
* or <code>null</code> if the resource could not
|
||||
* be found.
|
||||
* @throws IllegalArgumentException if
|
||||
* the resource is not valid
|
||||
*/
|
||||
InputStream getResourceAsStream(String name, BeanContextChild bcc) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Analagous to <code>java.lang.ClassLoader.getResource()</code>, this
|
||||
* method allows a <code>BeanContext</code> implementation to interpose
|
||||
* behavior between the child <code>Component</code>
|
||||
* and underlying <code>ClassLoader</code>.
|
||||
*
|
||||
* @param name the resource name
|
||||
* @param bcc the specified child
|
||||
* @return a <code>URL</code> for the named
|
||||
* resource for the specified child
|
||||
* @throws IllegalArgumentException
|
||||
* if the resource is not valid
|
||||
*/
|
||||
URL getResource(String name, BeanContextChild bcc) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Adds the specified <code>BeanContextMembershipListener</code>
|
||||
* to receive <code>BeanContextMembershipEvents</code> from
|
||||
* this <code>BeanContext</code> whenever it adds
|
||||
* or removes a child <code>Component</code>(s).
|
||||
*
|
||||
* @param bcml the BeanContextMembershipListener to be added
|
||||
*/
|
||||
void addBeanContextMembershipListener(BeanContextMembershipListener bcml);
|
||||
|
||||
/**
|
||||
* Removes the specified <code>BeanContextMembershipListener</code>
|
||||
* so that it no longer receives <code>BeanContextMembershipEvent</code>s
|
||||
* when the child <code>Component</code>(s) are added or removed.
|
||||
*
|
||||
* @param bcml the <code>BeanContextMembershipListener</code>
|
||||
* to be removed
|
||||
*/
|
||||
void removeBeanContextMembershipListener(BeanContextMembershipListener bcml);
|
||||
|
||||
/**
|
||||
* This global lock is used by both <code>BeanContext</code>
|
||||
* and <code>BeanContextServices</code> implementors
|
||||
* to serialize changes in a <code>BeanContext</code>
|
||||
* hierarchy and any service requests etc.
|
||||
*/
|
||||
public static final Object globalHierarchyLock = new Object();
|
||||
}
|
||||
137
jdkSrc/jdk8/java/beans/beancontext/BeanContextChild.java
Normal file
137
jdkSrc/jdk8/java/beans/beancontext/BeanContextChild.java
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.VetoableChangeListener;
|
||||
import java.beans.PropertyVetoException;
|
||||
|
||||
import java.beans.beancontext.BeanContext;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* JavaBeans wishing to be nested within, and obtain a reference to their
|
||||
* execution environment, or context, as defined by the BeanContext
|
||||
* sub-interface shall implement this interface.
|
||||
* </p>
|
||||
* <p>
|
||||
* Conformant BeanContexts shall as a side effect of adding a BeanContextChild
|
||||
* object shall pass a reference to itself via the setBeanContext() method of
|
||||
* this interface.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that a BeanContextChild may refuse a change in state by throwing
|
||||
* PropertyVetoedException in response.
|
||||
* </p>
|
||||
* <p>
|
||||
* In order for persistence mechanisms to function properly on BeanContextChild
|
||||
* instances across a broad variety of scenarios, implementing classes of this
|
||||
* interface are required to define as transient, any or all fields, or
|
||||
* instance variables, that may contain, or represent, references to the
|
||||
* nesting BeanContext instance or other resources obtained
|
||||
* from the BeanContext via any unspecified mechanisms.
|
||||
* </p>
|
||||
*
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
*
|
||||
* @see java.beans.beancontext.BeanContext
|
||||
* @see java.beans.PropertyChangeEvent
|
||||
* @see java.beans.PropertyChangeListener
|
||||
* @see java.beans.PropertyVetoException
|
||||
* @see java.beans.VetoableChangeListener
|
||||
*/
|
||||
|
||||
public interface BeanContextChild {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Objects that implement this interface,
|
||||
* shall fire a java.beans.PropertyChangeEvent, with parameters:
|
||||
*
|
||||
* propertyName "beanContext", oldValue (the previous nesting
|
||||
* <code>BeanContext</code> instance, or <code>null</code>),
|
||||
* newValue (the current nesting
|
||||
* <code>BeanContext</code> instance, or <code>null</code>).
|
||||
* <p>
|
||||
* A change in the value of the nesting BeanContext property of this
|
||||
* BeanContextChild may be vetoed by throwing the appropriate exception.
|
||||
* </p>
|
||||
* @param bc The <code>BeanContext</code> with which
|
||||
* to associate this <code>BeanContextChild</code>.
|
||||
* @throws PropertyVetoException if the
|
||||
* addition of the specified <code>BeanContext</code> is refused.
|
||||
*/
|
||||
void setBeanContext(BeanContext bc) throws PropertyVetoException;
|
||||
|
||||
/**
|
||||
* Gets the <code>BeanContext</code> associated
|
||||
* with this <code>BeanContextChild</code>.
|
||||
* @return the <code>BeanContext</code> associated
|
||||
* with this <code>BeanContextChild</code>.
|
||||
*/
|
||||
BeanContext getBeanContext();
|
||||
|
||||
/**
|
||||
* Adds a <code>PropertyChangeListener</code>
|
||||
* to this <code>BeanContextChild</code>
|
||||
* in order to receive a <code>PropertyChangeEvent</code>
|
||||
* whenever the specified property has changed.
|
||||
* @param name the name of the property to listen on
|
||||
* @param pcl the <code>PropertyChangeListener</code> to add
|
||||
*/
|
||||
void addPropertyChangeListener(String name, PropertyChangeListener pcl);
|
||||
|
||||
/**
|
||||
* Removes a <code>PropertyChangeListener</code> from this
|
||||
* <code>BeanContextChild</code> so that it no longer
|
||||
* receives <code>PropertyChangeEvents</code> when the
|
||||
* specified property is changed.
|
||||
*
|
||||
* @param name the name of the property that was listened on
|
||||
* @param pcl the <code>PropertyChangeListener</code> to remove
|
||||
*/
|
||||
void removePropertyChangeListener(String name, PropertyChangeListener pcl);
|
||||
|
||||
/**
|
||||
* Adds a <code>VetoableChangeListener</code> to
|
||||
* this <code>BeanContextChild</code>
|
||||
* to receive events whenever the specified property changes.
|
||||
* @param name the name of the property to listen on
|
||||
* @param vcl the <code>VetoableChangeListener</code> to add
|
||||
*/
|
||||
void addVetoableChangeListener(String name, VetoableChangeListener vcl);
|
||||
|
||||
/**
|
||||
* Removes a <code>VetoableChangeListener</code> from this
|
||||
* <code>BeanContextChild</code> so that it no longer receives
|
||||
* events when the specified property changes.
|
||||
* @param name the name of the property that was listened on.
|
||||
* @param vcl the <code>VetoableChangeListener</code> to remove.
|
||||
*/
|
||||
void removeVetoableChangeListener(String name, VetoableChangeListener vcl);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This interface is implemented by
|
||||
* <code>BeanContextChildren</code> that have an AWT <code>Component</code>
|
||||
* associated with them.
|
||||
* </p>
|
||||
*
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
*
|
||||
* @see java.beans.beancontext.BeanContext
|
||||
* @see java.beans.beancontext.BeanContextSupport
|
||||
*/
|
||||
|
||||
public interface BeanContextChildComponentProxy {
|
||||
|
||||
/**
|
||||
* Gets the <code>java.awt.Component</code> associated with
|
||||
* this <code>BeanContextChild</code>.
|
||||
* @return the AWT <code>Component</code> associated with
|
||||
* this <code>BeanContextChild</code>
|
||||
*/
|
||||
|
||||
Component getComponent();
|
||||
}
|
||||
377
jdkSrc/jdk8/java/beans/beancontext/BeanContextChildSupport.java
Normal file
377
jdkSrc/jdk8/java/beans/beancontext/BeanContextChildSupport.java
Normal file
@@ -0,0 +1,377 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
|
||||
import java.beans.VetoableChangeListener;
|
||||
import java.beans.VetoableChangeSupport;
|
||||
|
||||
import java.beans.PropertyVetoException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This is a general support class to provide support for implementing the
|
||||
* BeanContextChild protocol.
|
||||
*
|
||||
* This class may either be directly subclassed, or encapsulated and delegated
|
||||
* to in order to implement this interface for a given component.
|
||||
* </p>
|
||||
*
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
*
|
||||
* @see java.beans.beancontext.BeanContext
|
||||
* @see java.beans.beancontext.BeanContextServices
|
||||
* @see java.beans.beancontext.BeanContextChild
|
||||
*/
|
||||
|
||||
public class BeanContextChildSupport implements BeanContextChild, BeanContextServicesListener, Serializable {
|
||||
|
||||
static final long serialVersionUID = 6328947014421475877L;
|
||||
|
||||
/**
|
||||
* construct a BeanContextChildSupport where this class has been
|
||||
* subclassed in order to implement the JavaBean component itself.
|
||||
*/
|
||||
|
||||
public BeanContextChildSupport() {
|
||||
super();
|
||||
|
||||
beanContextChildPeer = this;
|
||||
|
||||
pcSupport = new PropertyChangeSupport(beanContextChildPeer);
|
||||
vcSupport = new VetoableChangeSupport(beanContextChildPeer);
|
||||
}
|
||||
|
||||
/**
|
||||
* construct a BeanContextChildSupport where the JavaBean component
|
||||
* itself implements BeanContextChild, and encapsulates this, delegating
|
||||
* that interface to this implementation
|
||||
* @param bcc the underlying bean context child
|
||||
*/
|
||||
|
||||
public BeanContextChildSupport(BeanContextChild bcc) {
|
||||
super();
|
||||
|
||||
beanContextChildPeer = (bcc != null) ? bcc : this;
|
||||
|
||||
pcSupport = new PropertyChangeSupport(beanContextChildPeer);
|
||||
vcSupport = new VetoableChangeSupport(beanContextChildPeer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <code>BeanContext</code> for
|
||||
* this <code>BeanContextChildSupport</code>.
|
||||
* @param bc the new value to be assigned to the <code>BeanContext</code>
|
||||
* property
|
||||
* @throws PropertyVetoException if the change is rejected
|
||||
*/
|
||||
public synchronized void setBeanContext(BeanContext bc) throws PropertyVetoException {
|
||||
if (bc == beanContext) return;
|
||||
|
||||
BeanContext oldValue = beanContext;
|
||||
BeanContext newValue = bc;
|
||||
|
||||
if (!rejectedSetBCOnce) {
|
||||
if (rejectedSetBCOnce = !validatePendingSetBeanContext(bc)) {
|
||||
throw new PropertyVetoException(
|
||||
"setBeanContext() change rejected:",
|
||||
new PropertyChangeEvent(beanContextChildPeer, "beanContext", oldValue, newValue)
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
fireVetoableChange("beanContext",
|
||||
oldValue,
|
||||
newValue
|
||||
);
|
||||
} catch (PropertyVetoException pve) {
|
||||
rejectedSetBCOnce = true;
|
||||
|
||||
throw pve; // re-throw
|
||||
}
|
||||
}
|
||||
|
||||
if (beanContext != null) releaseBeanContextResources();
|
||||
|
||||
beanContext = newValue;
|
||||
rejectedSetBCOnce = false;
|
||||
|
||||
firePropertyChange("beanContext",
|
||||
oldValue,
|
||||
newValue
|
||||
);
|
||||
|
||||
if (beanContext != null) initializeBeanContextResources();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nesting <code>BeanContext</code>
|
||||
* for this <code>BeanContextChildSupport</code>.
|
||||
* @return the nesting <code>BeanContext</code> for
|
||||
* this <code>BeanContextChildSupport</code>.
|
||||
*/
|
||||
public synchronized BeanContext getBeanContext() { return beanContext; }
|
||||
|
||||
/**
|
||||
* Add a PropertyChangeListener for a specific property.
|
||||
* The same listener object may be added more than once. For each
|
||||
* property, the listener will be invoked the number of times it was added
|
||||
* for that property.
|
||||
* If <code>name</code> or <code>pcl</code> is null, no exception is thrown
|
||||
* and no action is taken.
|
||||
*
|
||||
* @param name The name of the property to listen on
|
||||
* @param pcl The <code>PropertyChangeListener</code> to be added
|
||||
*/
|
||||
public void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
|
||||
pcSupport.addPropertyChangeListener(name, pcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a PropertyChangeListener for a specific property.
|
||||
* If <code>pcl</code> was added more than once to the same event
|
||||
* source for the specified property, it will be notified one less time
|
||||
* after being removed.
|
||||
* If <code>name</code> is null, no exception is thrown
|
||||
* and no action is taken.
|
||||
* If <code>pcl</code> is null, or was never added for the specified
|
||||
* property, no exception is thrown and no action is taken.
|
||||
*
|
||||
* @param name The name of the property that was listened on
|
||||
* @param pcl The PropertyChangeListener to be removed
|
||||
*/
|
||||
public void removePropertyChangeListener(String name, PropertyChangeListener pcl) {
|
||||
pcSupport.removePropertyChangeListener(name, pcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a VetoableChangeListener for a specific property.
|
||||
* The same listener object may be added more than once. For each
|
||||
* property, the listener will be invoked the number of times it was added
|
||||
* for that property.
|
||||
* If <code>name</code> or <code>vcl</code> is null, no exception is thrown
|
||||
* and no action is taken.
|
||||
*
|
||||
* @param name The name of the property to listen on
|
||||
* @param vcl The <code>VetoableChangeListener</code> to be added
|
||||
*/
|
||||
public void addVetoableChangeListener(String name, VetoableChangeListener vcl) {
|
||||
vcSupport.addVetoableChangeListener(name, vcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a <code>VetoableChangeListener</code>.
|
||||
* If <code>pcl</code> was added more than once to the same event
|
||||
* source for the specified property, it will be notified one less time
|
||||
* after being removed.
|
||||
* If <code>name</code> is null, no exception is thrown
|
||||
* and no action is taken.
|
||||
* If <code>vcl</code> is null, or was never added for the specified
|
||||
* property, no exception is thrown and no action is taken.
|
||||
*
|
||||
* @param name The name of the property that was listened on
|
||||
* @param vcl The <code>VetoableChangeListener</code> to be removed
|
||||
*/
|
||||
public void removeVetoableChangeListener(String name, VetoableChangeListener vcl) {
|
||||
vcSupport.removeVetoableChangeListener(name, vcl);
|
||||
}
|
||||
|
||||
/**
|
||||
* A service provided by the nesting BeanContext has been revoked.
|
||||
*
|
||||
* Subclasses may override this method in order to implement their own
|
||||
* behaviors.
|
||||
* @param bcsre The <code>BeanContextServiceRevokedEvent</code> fired as a
|
||||
* result of a service being revoked
|
||||
*/
|
||||
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { }
|
||||
|
||||
/**
|
||||
* A new service is available from the nesting BeanContext.
|
||||
*
|
||||
* Subclasses may override this method in order to implement their own
|
||||
* behaviors
|
||||
* @param bcsae The BeanContextServiceAvailableEvent fired as a
|
||||
* result of a service becoming available
|
||||
*
|
||||
*/
|
||||
public void serviceAvailable(BeanContextServiceAvailableEvent bcsae) { }
|
||||
|
||||
/**
|
||||
* Gets the <tt>BeanContextChild</tt> associated with this
|
||||
* <tt>BeanContextChildSupport</tt>.
|
||||
*
|
||||
* @return the <tt>BeanContextChild</tt> peer of this class
|
||||
*/
|
||||
public BeanContextChild getBeanContextChildPeer() { return beanContextChildPeer; }
|
||||
|
||||
/**
|
||||
* Reports whether or not this class is a delegate of another.
|
||||
*
|
||||
* @return true if this class is a delegate of another
|
||||
*/
|
||||
public boolean isDelegated() { return !this.equals(beanContextChildPeer); }
|
||||
|
||||
/**
|
||||
* Report a bound property update to any registered listeners. No event is
|
||||
* fired if old and new are equal and non-null.
|
||||
* @param name The programmatic name of the property that was changed
|
||||
* @param oldValue The old value of the property
|
||||
* @param newValue The new value of the property
|
||||
*/
|
||||
public void firePropertyChange(String name, Object oldValue, Object newValue) {
|
||||
pcSupport.firePropertyChange(name, oldValue, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report a vetoable property update to any registered listeners.
|
||||
* If anyone vetos the change, then fire a new event
|
||||
* reverting everyone to the old value and then rethrow
|
||||
* the PropertyVetoException. <P>
|
||||
*
|
||||
* No event is fired if old and new are equal and non-null.
|
||||
* <P>
|
||||
* @param name The programmatic name of the property that is about to
|
||||
* change
|
||||
*
|
||||
* @param oldValue The old value of the property
|
||||
* @param newValue - The new value of the property
|
||||
*
|
||||
* @throws PropertyVetoException if the recipient wishes the property
|
||||
* change to be rolled back.
|
||||
*/
|
||||
public void fireVetoableChange(String name, Object oldValue, Object newValue) throws PropertyVetoException {
|
||||
vcSupport.fireVetoableChange(name, oldValue, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from setBeanContext to validate (or otherwise) the
|
||||
* pending change in the nesting BeanContext property value.
|
||||
* Returning false will cause setBeanContext to throw
|
||||
* PropertyVetoException.
|
||||
* @param newValue the new value that has been requested for
|
||||
* the BeanContext property
|
||||
* @return <code>true</code> if the change operation is to be vetoed
|
||||
*/
|
||||
public boolean validatePendingSetBeanContext(BeanContext newValue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method may be overridden by subclasses to provide their own
|
||||
* release behaviors. When invoked any resources held by this instance
|
||||
* obtained from its current BeanContext property should be released
|
||||
* since the object is no longer nested within that BeanContext.
|
||||
*/
|
||||
|
||||
protected void releaseBeanContextResources() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* This method may be overridden by subclasses to provide their own
|
||||
* initialization behaviors. When invoked any resources required by the
|
||||
* BeanContextChild should be obtained from the current BeanContext.
|
||||
*/
|
||||
|
||||
protected void initializeBeanContextResources() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the persistence state of the object.
|
||||
*/
|
||||
|
||||
private void writeObject(ObjectOutputStream oos) throws IOException {
|
||||
|
||||
/*
|
||||
* don't serialize if we are delegated and the delegator is not also
|
||||
* serializable.
|
||||
*/
|
||||
|
||||
if (!equals(beanContextChildPeer) && !(beanContextChildPeer instanceof Serializable))
|
||||
throw new IOException("BeanContextChildSupport beanContextChildPeer not Serializable");
|
||||
|
||||
else
|
||||
oos.defaultWriteObject();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restore a persistent object, must wait for subsequent setBeanContext()
|
||||
* to fully restore any resources obtained from the new nesting
|
||||
* BeanContext
|
||||
*/
|
||||
|
||||
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
|
||||
ois.defaultReadObject();
|
||||
}
|
||||
|
||||
/*
|
||||
* fields
|
||||
*/
|
||||
|
||||
/**
|
||||
* The <code>BeanContext</code> in which
|
||||
* this <code>BeanContextChild</code> is nested.
|
||||
*/
|
||||
public BeanContextChild beanContextChildPeer;
|
||||
|
||||
/**
|
||||
* The <tt>PropertyChangeSupport</tt> associated with this
|
||||
* <tt>BeanContextChildSupport</tt>.
|
||||
*/
|
||||
protected PropertyChangeSupport pcSupport;
|
||||
|
||||
/**
|
||||
* The <tt>VetoableChangeSupport</tt> associated with this
|
||||
* <tt>BeanContextChildSupport</tt>.
|
||||
*/
|
||||
protected VetoableChangeSupport vcSupport;
|
||||
|
||||
/**
|
||||
* The bean context.
|
||||
*/
|
||||
protected transient BeanContext beanContext;
|
||||
|
||||
/**
|
||||
* A flag indicating that there has been
|
||||
* at least one <code>PropertyChangeVetoException</code>
|
||||
* thrown for the attempted setBeanContext operation.
|
||||
*/
|
||||
protected transient boolean rejectedSetBCOnce;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.awt.Container;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This interface is implemented by BeanContexts' that have an AWT Container
|
||||
* associated with them.
|
||||
* </p>
|
||||
*
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
*
|
||||
* @see java.beans.beancontext.BeanContext
|
||||
* @see java.beans.beancontext.BeanContextSupport
|
||||
*/
|
||||
|
||||
public interface BeanContextContainerProxy {
|
||||
|
||||
/**
|
||||
* Gets the <code>java.awt.Container</code> associated
|
||||
* with this <code>BeanContext</code>.
|
||||
* @return the <code>java.awt.Container</code> associated
|
||||
* with this <code>BeanContext</code>.
|
||||
*/
|
||||
Container getContainer();
|
||||
}
|
||||
104
jdkSrc/jdk8/java/beans/beancontext/BeanContextEvent.java
Normal file
104
jdkSrc/jdk8/java/beans/beancontext/BeanContextEvent.java
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
import java.beans.beancontext.BeanContext;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* <code>BeanContextEvent</code> is the abstract root event class
|
||||
* for all events emitted
|
||||
* from, and pertaining to the semantics of, a <code>BeanContext</code>.
|
||||
* This class introduces a mechanism to allow the propagation of
|
||||
* <code>BeanContextEvent</code> subclasses through a hierarchy of
|
||||
* <code>BeanContext</code>s. The <code>setPropagatedFrom()</code>
|
||||
* and <code>getPropagatedFrom()</code> methods allow a
|
||||
* <code>BeanContext</code> to identify itself as the source
|
||||
* of a propagated event.
|
||||
* </p>
|
||||
*
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
* @see java.beans.beancontext.BeanContext
|
||||
*/
|
||||
|
||||
public abstract class BeanContextEvent extends EventObject {
|
||||
private static final long serialVersionUID = 7267998073569045052L;
|
||||
|
||||
/**
|
||||
* Contruct a BeanContextEvent
|
||||
*
|
||||
* @param bc The BeanContext source
|
||||
*/
|
||||
protected BeanContextEvent(BeanContext bc) {
|
||||
super(bc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the <code>BeanContext</code> associated with this event.
|
||||
* @return the <code>BeanContext</code> associated with this event.
|
||||
*/
|
||||
public BeanContext getBeanContext() { return (BeanContext)getSource(); }
|
||||
|
||||
/**
|
||||
* Sets the <code>BeanContext</code> from which this event was propagated.
|
||||
* @param bc the <code>BeanContext</code> from which this event
|
||||
* was propagated
|
||||
*/
|
||||
public synchronized void setPropagatedFrom(BeanContext bc) {
|
||||
propagatedFrom = bc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the <code>BeanContext</code> from which this event was propagated.
|
||||
* @return the <code>BeanContext</code> from which this
|
||||
* event was propagated
|
||||
*/
|
||||
public synchronized BeanContext getPropagatedFrom() {
|
||||
return propagatedFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports whether or not this event is
|
||||
* propagated from some other <code>BeanContext</code>.
|
||||
* @return <code>true</code> if propagated, <code>false</code>
|
||||
* if not
|
||||
*/
|
||||
public synchronized boolean isPropagated() {
|
||||
return propagatedFrom != null;
|
||||
}
|
||||
|
||||
/*
|
||||
* fields
|
||||
*/
|
||||
|
||||
/**
|
||||
* The <code>BeanContext</code> from which this event was propagated
|
||||
*/
|
||||
protected BeanContext propagatedFrom;
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
import java.beans.beancontext.BeanContext;
|
||||
import java.beans.beancontext.BeanContextEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* A <code>BeanContextMembershipEvent</code> encapsulates
|
||||
* the list of children added to, or removed from,
|
||||
* the membership of a particular <code>BeanContext</code>.
|
||||
* An instance of this event is fired whenever a successful
|
||||
* add(), remove(), retainAll(), removeAll(), or clear() is
|
||||
* invoked on a given <code>BeanContext</code> instance.
|
||||
* Objects interested in receiving events of this type must
|
||||
* implement the <code>BeanContextMembershipListener</code>
|
||||
* interface, and must register their intent via the
|
||||
* <code>BeanContext</code>'s
|
||||
* <code>addBeanContextMembershipListener(BeanContextMembershipListener bcml)
|
||||
* </code> method.
|
||||
*
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
* @see java.beans.beancontext.BeanContext
|
||||
* @see java.beans.beancontext.BeanContextEvent
|
||||
* @see java.beans.beancontext.BeanContextMembershipListener
|
||||
*/
|
||||
public class BeanContextMembershipEvent extends BeanContextEvent {
|
||||
private static final long serialVersionUID = 3499346510334590959L;
|
||||
|
||||
/**
|
||||
* Contruct a BeanContextMembershipEvent
|
||||
*
|
||||
* @param bc The BeanContext source
|
||||
* @param changes The Children affected
|
||||
* @throws NullPointerException if <CODE>changes</CODE> is <CODE>null</CODE>
|
||||
*/
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
|
||||
super(bc);
|
||||
|
||||
if (changes == null) throw new NullPointerException(
|
||||
"BeanContextMembershipEvent constructor: changes is null.");
|
||||
|
||||
children = changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contruct a BeanContextMembershipEvent
|
||||
*
|
||||
* @param bc The BeanContext source
|
||||
* @param changes The Children effected
|
||||
* @exception NullPointerException if changes associated with this
|
||||
* event are null.
|
||||
*/
|
||||
|
||||
public BeanContextMembershipEvent(BeanContext bc, Object[] changes) {
|
||||
super(bc);
|
||||
|
||||
if (changes == null) throw new NullPointerException(
|
||||
"BeanContextMembershipEvent: changes is null.");
|
||||
|
||||
children = Arrays.asList(changes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of children affected by the notification.
|
||||
* @return the number of children affected by the notification
|
||||
*/
|
||||
public int size() { return children.size(); }
|
||||
|
||||
/**
|
||||
* Is the child specified affected by the event?
|
||||
* @return <code>true</code> if affected, <code>false</code>
|
||||
* if not
|
||||
* @param child the object to check for being affected
|
||||
*/
|
||||
public boolean contains(Object child) {
|
||||
return children.contains(child);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the array of children affected by this event.
|
||||
* @return the array of children affected
|
||||
*/
|
||||
public Object[] toArray() { return children.toArray(); }
|
||||
|
||||
/**
|
||||
* Gets the array of children affected by this event.
|
||||
* @return the array of children effected
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Iterator iterator() { return children.iterator(); }
|
||||
|
||||
/*
|
||||
* fields
|
||||
*/
|
||||
|
||||
/**
|
||||
* The list of children affected by this
|
||||
* event notification.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected Collection children;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.beancontext.BeanContextMembershipEvent;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Compliant BeanContexts fire events on this interface when the state of
|
||||
* the membership of the BeanContext changes.
|
||||
* </p>
|
||||
*
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
* @see java.beans.beancontext.BeanContext
|
||||
*/
|
||||
|
||||
public interface BeanContextMembershipListener extends EventListener {
|
||||
|
||||
/**
|
||||
* Called when a child or list of children is added to a
|
||||
* <code>BeanContext</code> that this listener is registered with.
|
||||
* @param bcme The <code>BeanContextMembershipEvent</code>
|
||||
* describing the change that occurred.
|
||||
*/
|
||||
void childrenAdded(BeanContextMembershipEvent bcme);
|
||||
|
||||
/**
|
||||
* Called when a child or list of children is removed
|
||||
* from a <code>BeanContext</code> that this listener
|
||||
* is registered with.
|
||||
* @param bcme The <code>BeanContextMembershipEvent</code>
|
||||
* describing the change that occurred.
|
||||
*/
|
||||
void childrenRemoved(BeanContextMembershipEvent bcme);
|
||||
}
|
||||
85
jdkSrc/jdk8/java/beans/beancontext/BeanContextProxy.java
Normal file
85
jdkSrc/jdk8/java/beans/beancontext/BeanContextProxy.java
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This interface is implemented by a JavaBean that does
|
||||
* not directly have a BeanContext(Child) associated with
|
||||
* it (via implementing that interface or a subinterface thereof),
|
||||
* but has a public BeanContext(Child) delegated from it.
|
||||
* For example, a subclass of java.awt.Container may have a BeanContext
|
||||
* associated with it that all Component children of that Container shall
|
||||
* be contained within.
|
||||
* </p>
|
||||
* <p>
|
||||
* An Object may not implement this interface and the
|
||||
* BeanContextChild interface
|
||||
* (or any subinterfaces thereof) they are mutually exclusive.
|
||||
* </p>
|
||||
* <p>
|
||||
* Callers of this interface shall examine the return type in order to
|
||||
* obtain a particular subinterface of BeanContextChild as follows:
|
||||
* <code>
|
||||
* BeanContextChild bcc = o.getBeanContextProxy();
|
||||
*
|
||||
* if (bcc instanceof BeanContext) {
|
||||
* // ...
|
||||
* }
|
||||
* </code>
|
||||
* or
|
||||
* <code>
|
||||
* BeanContextChild bcc = o.getBeanContextProxy();
|
||||
* BeanContext bc = null;
|
||||
*
|
||||
* try {
|
||||
* bc = (BeanContext)bcc;
|
||||
* } catch (ClassCastException cce) {
|
||||
* // cast failed, bcc is not an instanceof BeanContext
|
||||
* }
|
||||
* </code>
|
||||
* </p>
|
||||
* <p>
|
||||
* The return value is a constant for the lifetime of the implementing
|
||||
* instance
|
||||
* </p>
|
||||
* @author Laurence P. G. Cable
|
||||
* @since 1.2
|
||||
*
|
||||
* @see java.beans.beancontext.BeanContextChild
|
||||
* @see java.beans.beancontext.BeanContextChildSupport
|
||||
*/
|
||||
|
||||
public interface BeanContextProxy {
|
||||
|
||||
/**
|
||||
* Gets the <code>BeanContextChild</code> (or subinterface)
|
||||
* associated with this object.
|
||||
* @return the <code>BeanContextChild</code> (or subinterface)
|
||||
* associated with this object
|
||||
*/
|
||||
BeanContextChild getBeanContextProxy();
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.beancontext.BeanContextChild;
|
||||
import java.beans.beancontext.BeanContextEvent;
|
||||
|
||||
import java.beans.beancontext.BeanContextServices;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This event type is used by the BeanContextServicesListener in order to
|
||||
* identify the service being registered.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
public class BeanContextServiceAvailableEvent extends BeanContextEvent {
|
||||
private static final long serialVersionUID = -5333985775656400778L;
|
||||
|
||||
/**
|
||||
* Construct a <code>BeanContextAvailableServiceEvent</code>.
|
||||
* @param bcs The context in which the service has become available
|
||||
* @param sc A <code>Class</code> reference to the newly available service
|
||||
*/
|
||||
public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class sc) {
|
||||
super((BeanContext)bcs);
|
||||
|
||||
serviceClass = sc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source as a reference of type <code>BeanContextServices</code>.
|
||||
* @return The context in which the service has become available
|
||||
*/
|
||||
public BeanContextServices getSourceAsBeanContextServices() {
|
||||
return (BeanContextServices)getBeanContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the service class that is the subject of this notification.
|
||||
* @return A <code>Class</code> reference to the newly available service
|
||||
*/
|
||||
public Class getServiceClass() { return serviceClass; }
|
||||
|
||||
/**
|
||||
* Gets the list of service dependent selectors.
|
||||
* @return the current selectors available from the service
|
||||
*/
|
||||
public Iterator getCurrentServiceSelectors() {
|
||||
return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);
|
||||
}
|
||||
|
||||
/*
|
||||
* fields
|
||||
*/
|
||||
|
||||
/**
|
||||
* A <code>Class</code> reference to the newly available service
|
||||
*/
|
||||
protected Class serviceClass;
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* One of the primary functions of a BeanContext is to act a as rendezvous
|
||||
* between JavaBeans, and BeanContextServiceProviders.
|
||||
* </p>
|
||||
* <p>
|
||||
* A JavaBean nested within a BeanContext, may ask that BeanContext to
|
||||
* provide an instance of a "service", based upon a reference to a Java
|
||||
* Class object that represents that service.
|
||||
* </p>
|
||||
* <p>
|
||||
* If such a service has been registered with the context, or one of its
|
||||
* nesting context's, in the case where a context delegate to its context
|
||||
* to satisfy a service request, then the BeanContextServiceProvider associated with
|
||||
* the service is asked to provide an instance of that service.
|
||||
* </p>
|
||||
* <p>
|
||||
* The ServcieProvider may always return the same instance, or it may
|
||||
* construct a new instance for each request.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
public interface BeanContextServiceProvider {
|
||||
|
||||
/**
|
||||
* Invoked by <code>BeanContextServices</code>, this method
|
||||
* requests an instance of a
|
||||
* service from this <code>BeanContextServiceProvider</code>.
|
||||
*
|
||||
* @param bcs The <code>BeanContextServices</code> associated with this
|
||||
* particular request. This parameter enables the
|
||||
* <code>BeanContextServiceProvider</code> to distinguish service
|
||||
* requests from multiple sources.
|
||||
*
|
||||
* @param requestor The object requesting the service
|
||||
*
|
||||
* @param serviceClass The service requested
|
||||
*
|
||||
* @param serviceSelector the service dependent parameter
|
||||
* for a particular service, or <code>null</code> if not applicable.
|
||||
*
|
||||
* @return a reference to the requested service
|
||||
*/
|
||||
Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector);
|
||||
|
||||
/**
|
||||
* Invoked by <code>BeanContextServices</code>,
|
||||
* this method releases a nested <code>BeanContextChild</code>'s
|
||||
* (or any arbitrary object associated with a
|
||||
* <code>BeanContextChild</code>) reference to the specified service.
|
||||
*
|
||||
* @param bcs the <code>BeanContextServices</code> associated with this
|
||||
* particular release request
|
||||
*
|
||||
* @param requestor the object requesting the service to be released
|
||||
*
|
||||
* @param service the service that is to be released
|
||||
*/
|
||||
public void releaseService(BeanContextServices bcs, Object requestor, Object service);
|
||||
|
||||
/**
|
||||
* Invoked by <code>BeanContextServices</code>, this method
|
||||
* gets the current service selectors for the specified service.
|
||||
* A service selector is a service specific parameter,
|
||||
* typical examples of which could include: a
|
||||
* parameter to a constructor for the service implementation class,
|
||||
* a value for a particular service's property, or a key into a
|
||||
* map of existing implementations.
|
||||
*
|
||||
* @param bcs the <code>BeanContextServices</code> for this request
|
||||
* @param serviceClass the specified service
|
||||
* @return the current service selectors for the specified serviceClass
|
||||
*/
|
||||
Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
|
||||
/**
|
||||
* A BeanContextServiceProvider implementor who wishes to provide explicit
|
||||
* information about the services their bean may provide shall implement a
|
||||
* BeanInfo class that implements this BeanInfo subinterface and provides
|
||||
* explicit information about the methods, properties, events, etc, of their
|
||||
* services.
|
||||
*/
|
||||
|
||||
public interface BeanContextServiceProviderBeanInfo extends BeanInfo {
|
||||
|
||||
/**
|
||||
* Gets a <code>BeanInfo</code> array, one for each
|
||||
* service class or interface statically available
|
||||
* from this ServiceProvider.
|
||||
* @return the <code>BeanInfo</code> array
|
||||
*/
|
||||
BeanInfo[] getServicesBeanInfo();
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.beancontext.BeanContextEvent;
|
||||
|
||||
import java.beans.beancontext.BeanContextServices;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This event type is used by the
|
||||
* <code>BeanContextServiceRevokedListener</code> in order to
|
||||
* identify the service being revoked.
|
||||
* </p>
|
||||
*/
|
||||
public class BeanContextServiceRevokedEvent extends BeanContextEvent {
|
||||
private static final long serialVersionUID = -1295543154724961754L;
|
||||
|
||||
/**
|
||||
* Construct a <code>BeanContextServiceEvent</code>.
|
||||
* @param bcs the <code>BeanContextServices</code>
|
||||
* from which this service is being revoked
|
||||
* @param sc the service that is being revoked
|
||||
* @param invalidate <code>true</code> for immediate revocation
|
||||
*/
|
||||
public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class sc, boolean invalidate) {
|
||||
super((BeanContext)bcs);
|
||||
|
||||
serviceClass = sc;
|
||||
invalidateRefs = invalidate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source as a reference of type <code>BeanContextServices</code>
|
||||
* @return the <code>BeanContextServices</code> from which
|
||||
* this service is being revoked
|
||||
*/
|
||||
public BeanContextServices getSourceAsBeanContextServices() {
|
||||
return (BeanContextServices)getBeanContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the service class that is the subject of this notification
|
||||
* @return A <code>Class</code> reference to the
|
||||
* service that is being revoked
|
||||
*/
|
||||
public Class getServiceClass() { return serviceClass; }
|
||||
|
||||
/**
|
||||
* Checks this event to determine whether or not
|
||||
* the service being revoked is of a particular class.
|
||||
* @param service the service of interest (should be non-null)
|
||||
* @return <code>true</code> if the service being revoked is of the
|
||||
* same class as the specified service
|
||||
*/
|
||||
public boolean isServiceClass(Class service) {
|
||||
return serviceClass.equals(service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports if the current service is being forcibly revoked,
|
||||
* in which case the references are now invalidated and unusable.
|
||||
* @return <code>true</code> if current service is being forcibly revoked
|
||||
*/
|
||||
public boolean isCurrentServiceInvalidNow() { return invalidateRefs; }
|
||||
|
||||
/**
|
||||
* fields
|
||||
*/
|
||||
|
||||
/**
|
||||
* A <code>Class</code> reference to the service that is being revoked.
|
||||
*/
|
||||
protected Class serviceClass;
|
||||
private boolean invalidateRefs;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.beancontext.BeanContextServiceRevokedEvent;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* The listener interface for receiving
|
||||
* <code>BeanContextServiceRevokedEvent</code> objects. A class that is
|
||||
* interested in processing a <code>BeanContextServiceRevokedEvent</code>
|
||||
* implements this interface.
|
||||
*/
|
||||
public interface BeanContextServiceRevokedListener extends EventListener {
|
||||
|
||||
/**
|
||||
* The service named has been revoked. getService requests for
|
||||
* this service will no longer be satisfied.
|
||||
* @param bcsre the <code>BeanContextServiceRevokedEvent</code> received
|
||||
* by this listener.
|
||||
*/
|
||||
void serviceRevoked(BeanContextServiceRevokedEvent bcsre);
|
||||
}
|
||||
160
jdkSrc/jdk8/java/beans/beancontext/BeanContextServices.java
Normal file
160
jdkSrc/jdk8/java/beans/beancontext/BeanContextServices.java
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import java.util.TooManyListenersException;
|
||||
|
||||
import java.beans.beancontext.BeanContext;
|
||||
|
||||
import java.beans.beancontext.BeanContextServiceProvider;
|
||||
|
||||
import java.beans.beancontext.BeanContextServicesListener;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The BeanContextServices interface provides a mechanism for a BeanContext
|
||||
* to expose generic "services" to the BeanContextChild objects within.
|
||||
* </p>
|
||||
*/
|
||||
public interface BeanContextServices extends BeanContext, BeanContextServicesListener {
|
||||
|
||||
/**
|
||||
* Adds a service to this BeanContext.
|
||||
* <code>BeanContextServiceProvider</code>s call this method
|
||||
* to register a particular service with this context.
|
||||
* If the service has not previously been added, the
|
||||
* <code>BeanContextServices</code> associates
|
||||
* the service with the <code>BeanContextServiceProvider</code> and
|
||||
* fires a <code>BeanContextServiceAvailableEvent</code> to all
|
||||
* currently registered <code>BeanContextServicesListeners</code>.
|
||||
* The method then returns <code>true</code>, indicating that
|
||||
* the addition of the service was successful.
|
||||
* If the given service has already been added, this method
|
||||
* simply returns <code>false</code>.
|
||||
* @param serviceClass the service to add
|
||||
* @param serviceProvider the <code>BeanContextServiceProvider</code>
|
||||
* associated with the service
|
||||
* @return true if the service was successful added, false otherwise
|
||||
*/
|
||||
boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider);
|
||||
|
||||
/**
|
||||
* BeanContextServiceProviders wishing to remove
|
||||
* a currently registered service from this context
|
||||
* may do so via invocation of this method. Upon revocation of
|
||||
* the service, the <code>BeanContextServices</code> fires a
|
||||
* <code>BeanContextServiceRevokedEvent</code> to its
|
||||
* list of currently registered
|
||||
* <code>BeanContextServiceRevokedListeners</code> and
|
||||
* <code>BeanContextServicesListeners</code>.
|
||||
* @param serviceClass the service to revoke from this BeanContextServices
|
||||
* @param serviceProvider the BeanContextServiceProvider associated with
|
||||
* this particular service that is being revoked
|
||||
* @param revokeCurrentServicesNow a value of <code>true</code>
|
||||
* indicates an exceptional circumstance where the
|
||||
* <code>BeanContextServiceProvider</code> or
|
||||
* <code>BeanContextServices</code> wishes to immediately
|
||||
* terminate service to all currently outstanding references
|
||||
* to the specified service.
|
||||
*/
|
||||
void revokeService(Class serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow);
|
||||
|
||||
/**
|
||||
* Reports whether or not a given service is
|
||||
* currently available from this context.
|
||||
* @param serviceClass the service in question
|
||||
* @return true if the service is available
|
||||
*/
|
||||
boolean hasService(Class serviceClass);
|
||||
|
||||
/**
|
||||
* A <code>BeanContextChild</code>, or any arbitrary object
|
||||
* associated with a <code>BeanContextChild</code>, may obtain
|
||||
* a reference to a currently registered service from its
|
||||
* nesting <code>BeanContextServices</code>
|
||||
* via invocation of this method. When invoked, this method
|
||||
* gets the service by calling the getService() method on the
|
||||
* underlying <code>BeanContextServiceProvider</code>.
|
||||
* @param child the <code>BeanContextChild</code>
|
||||
* associated with this request
|
||||
* @param requestor the object requesting the service
|
||||
* @param serviceClass class of the requested service
|
||||
* @param serviceSelector the service dependent parameter
|
||||
* @param bcsrl the
|
||||
* <code>BeanContextServiceRevokedListener</code> to notify
|
||||
* if the service should later become revoked
|
||||
* @throws TooManyListenersException if there are too many listeners
|
||||
* @return a reference to this context's named
|
||||
* Service as requested or <code>null</code>
|
||||
*/
|
||||
Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException;
|
||||
|
||||
/**
|
||||
* Releases a <code>BeanContextChild</code>'s
|
||||
* (or any arbitrary object associated with a BeanContextChild)
|
||||
* reference to the specified service by calling releaseService()
|
||||
* on the underlying <code>BeanContextServiceProvider</code>.
|
||||
* @param child the <code>BeanContextChild</code>
|
||||
* @param requestor the requestor
|
||||
* @param service the service
|
||||
*/
|
||||
void releaseService(BeanContextChild child, Object requestor, Object service);
|
||||
|
||||
/**
|
||||
* Gets the currently available services for this context.
|
||||
* @return an <code>Iterator</code> consisting of the
|
||||
* currently available services
|
||||
*/
|
||||
Iterator getCurrentServiceClasses();
|
||||
|
||||
/**
|
||||
* Gets the list of service dependent service parameters
|
||||
* (Service Selectors) for the specified service, by
|
||||
* calling getCurrentServiceSelectors() on the
|
||||
* underlying BeanContextServiceProvider.
|
||||
* @param serviceClass the specified service
|
||||
* @return the currently available service selectors
|
||||
* for the named serviceClass
|
||||
*/
|
||||
Iterator getCurrentServiceSelectors(Class serviceClass);
|
||||
|
||||
/**
|
||||
* Adds a <code>BeanContextServicesListener</code> to this BeanContext
|
||||
* @param bcsl the <code>BeanContextServicesListener</code> to add
|
||||
*/
|
||||
void addBeanContextServicesListener(BeanContextServicesListener bcsl);
|
||||
|
||||
/**
|
||||
* Removes a <code>BeanContextServicesListener</code>
|
||||
* from this <code>BeanContext</code>
|
||||
* @param bcsl the <code>BeanContextServicesListener</code>
|
||||
* to remove from this context
|
||||
*/
|
||||
void removeBeanContextServicesListener(BeanContextServicesListener bcsl);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code 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 General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package java.beans.beancontext;
|
||||
|
||||
import java.beans.beancontext.BeanContextServiceAvailableEvent;
|
||||
import java.beans.beancontext.BeanContextServiceRevokedEvent;
|
||||
import java.beans.beancontext.BeanContextServiceRevokedListener;
|
||||
|
||||
/**
|
||||
* The listener interface for receiving
|
||||
* <code>BeanContextServiceAvailableEvent</code> objects.
|
||||
* A class that is interested in processing a
|
||||
* <code>BeanContextServiceAvailableEvent</code> implements this interface.
|
||||
*/
|
||||
public interface BeanContextServicesListener extends BeanContextServiceRevokedListener {
|
||||
|
||||
/**
|
||||
* The service named has been registered. getService requests for
|
||||
* this service may now be made.
|
||||
* @param bcsae the <code>BeanContextServiceAvailableEvent</code>
|
||||
*/
|
||||
void serviceAvailable(BeanContextServiceAvailableEvent bcsae);
|
||||
}
|
||||
1257
jdkSrc/jdk8/java/beans/beancontext/BeanContextServicesSupport.java
Normal file
1257
jdkSrc/jdk8/java/beans/beancontext/BeanContextServicesSupport.java
Normal file
File diff suppressed because it is too large
Load Diff
1404
jdkSrc/jdk8/java/beans/beancontext/BeanContextSupport.java
Normal file
1404
jdkSrc/jdk8/java/beans/beancontext/BeanContextSupport.java
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user