Path: blob/master/src/java.desktop/share/classes/java/beans/beancontext/BeanContext.java
41159 views
/*1* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.beans.beancontext;2627import java.beans.DesignMode;28import java.beans.Visibility;2930import java.io.InputStream;31import java.io.IOException;3233import java.net.URL;3435import java.util.Collection;36import java.util.Locale;3738/**39* <p>40* The BeanContext acts a logical hierarchical container for JavaBeans.41* </p>42*43* @author Laurence P. G. Cable44* @since 1.245*46* @see java.beans.Beans47* @see java.beans.beancontext.BeanContextChild48* @see java.beans.beancontext.BeanContextMembershipListener49* @see java.beans.PropertyChangeEvent50* @see java.beans.DesignMode51* @see java.beans.Visibility52* @see java.util.Collection53*/5455@SuppressWarnings("rawtypes")56public interface BeanContext extends BeanContextChild, Collection, DesignMode, Visibility {5758/**59* Instantiate the javaBean named as a60* child of this {@code BeanContext}.61* The implementation of the JavaBean is62* derived from the value of the beanName parameter,63* and is defined by the64* {@code java.beans.Beans.instantiate()} method.65*66* @return a javaBean named as a child of this67* {@code BeanContext}68* @param beanName The name of the JavaBean to instantiate69* as a child of this {@code BeanContext}70* @throws IOException if an IO problem occurs71* @throws ClassNotFoundException if the class identified72* by the beanName parameter is not found73*/74Object instantiateChild(String beanName) throws IOException, ClassNotFoundException;7576/**77* Analagous to {@code java.lang.ClassLoader.getResourceAsStream()},78* this method allows a {@code BeanContext} implementation79* to interpose behavior between the child {@code Component}80* and underlying {@code ClassLoader}.81*82* @param name the resource name83* @param bcc the specified child84* @return an {@code InputStream} for reading the resource,85* or {@code null} if the resource could not86* be found.87* @throws IllegalArgumentException if88* the resource is not valid89*/90InputStream getResourceAsStream(String name, BeanContextChild bcc) throws IllegalArgumentException;9192/**93* Analagous to {@code java.lang.ClassLoader.getResource()}, this94* method allows a {@code BeanContext} implementation to interpose95* behavior between the child {@code Component}96* and underlying {@code ClassLoader}.97*98* @param name the resource name99* @param bcc the specified child100* @return a {@code URL} for the named101* resource for the specified child102* @throws IllegalArgumentException103* if the resource is not valid104*/105URL getResource(String name, BeanContextChild bcc) throws IllegalArgumentException;106107/**108* Adds the specified {@code BeanContextMembershipListener}109* to receive {@code BeanContextMembershipEvents} from110* this {@code BeanContext} whenever it adds111* or removes a child {@code Component}(s).112*113* @param bcml the BeanContextMembershipListener to be added114*/115void addBeanContextMembershipListener(BeanContextMembershipListener bcml);116117/**118* Removes the specified {@code BeanContextMembershipListener}119* so that it no longer receives {@code BeanContextMembershipEvent}s120* when the child {@code Component}(s) are added or removed.121*122* @param bcml the {@code BeanContextMembershipListener}123* to be removed124*/125void removeBeanContextMembershipListener(BeanContextMembershipListener bcml);126127/**128* This global lock is used by both {@code BeanContext}129* and {@code BeanContextServices} implementors130* to serialize changes in a {@code BeanContext}131* hierarchy and any service requests etc.132*/133public static final Object globalHierarchyLock = new Object();134}135136137