KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > beans > beancontext > BeanContext


1 /*
2  * @(#)BeanContext.java 1.23 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.beans.beancontext;
9
10 import java.beans.DesignMode JavaDoc;
11 import java.beans.Visibility JavaDoc;
12
13 import java.io.InputStream JavaDoc;
14 import java.io.IOException JavaDoc;
15
16 import java.net.URL JavaDoc;
17
18 import java.util.Collection JavaDoc;
19 import java.util.Locale JavaDoc;
20
21 /**
22  * <p>
23  * The BeanContext acts a logical hierarchical container for JavaBeans.
24  * </p>
25  *
26  * @author Laurence P. G. Cable
27  * @version 1.23, 12/19/03
28  * @since 1.2
29  *
30  * @see java.beans.Beans
31  * @see java.beans.beancontext.BeanContextChild
32  * @see java.beans.beancontext.BeanContextMembershipListener
33  * @see java.beans.PropertyChangeEvent
34  * @see java.beans.VetoableChangeEvent
35  * @see java.beans.DesignMode
36  * @see java.beans.Visibility
37  * @see java.util.Collection
38  */

39
40 public interface BeanContext extends BeanContextChild JavaDoc, Collection JavaDoc, DesignMode JavaDoc, Visibility JavaDoc {
41
42     /**
43      * Instantiate the javaBean named as a
44      * child of this <code>BeanContext</code>.
45      * The implementation of the JavaBean is
46      * derived from the value of the beanName parameter,
47      * and is defined by the
48      * <code>java.beans.Beans.instantiate()</code> method.
49      *
50      * @param beanName The name of the JavaBean to instantiate
51      * as a child of this <code>BeanContext</code>
52      * @throws <code>IOException</code>
53      * @throws <code>ClassNotFoundException</code> if the class identified
54      * by the beanName parameter is not found
55      */

56     Object JavaDoc instantiateChild(String JavaDoc beanName) throws IOException JavaDoc, ClassNotFoundException JavaDoc;
57
58     /**
59      * Analagous to <code>java.lang.ClassLoader.getResourceAsStream()</code>,
60      * this method allows a <code>BeanContext</code> implementation
61      * to interpose behavior between the child <code>Component</code>
62      * and underlying <code>ClassLoader</code>.
63      *
64      * @param name the resource name
65      * @param bcc the specified child
66      * @return an <code>InputStream</code> for reading the resource,
67      * or <code>null</code> if the resource could not
68      * be found.
69      * @throws <code>IllegalArgumentException</code> if
70      * the resource is not valid
71      */

72     InputStream JavaDoc getResourceAsStream(String JavaDoc name, BeanContextChild JavaDoc bcc) throws IllegalArgumentException JavaDoc;
73
74     /**
75      * Analagous to <code>java.lang.ClassLoader.getResource()</code>, this
76      * method allows a <code>BeanContext</code> implementation to interpose
77      * behavior between the child <code>Component</code>
78      * and underlying <code>ClassLoader</code>.
79      *
80      * @param name the resource name
81      * @param bcc the specified child
82      * @return a <code>URL</code> for the named
83      * resource for the specified child
84      * @throws <code>IllegalArgumentException</code>
85      * if the resource is not valid
86      */

87     URL JavaDoc getResource(String JavaDoc name, BeanContextChild JavaDoc bcc) throws IllegalArgumentException JavaDoc;
88
89      /**
90       * Adds the specified <code>BeanContextMembershipListener</code>
91       * to receive <code>BeanContextMembershipEvents</code> from
92       * this <code>BeanContext</code> whenever it adds
93       * or removes a child <code>Component</code>(s).
94       *
95       * @param bcml the <code>BeanContextMembershipListener</code> to be added
96       */

97     void addBeanContextMembershipListener(BeanContextMembershipListener JavaDoc bcml);
98
99      /**
100       * Removes the specified <code>BeanContextMembershipListener</code>
101       * so that it no longer receives <code>BeanContextMembershipEvent</code>s
102       * when the child <code>Component</code>(s) are added or removed.
103       *
104       * @param bcml the <code>BeanContextMembershipListener</code>
105       * to be removed
106       */

107     void removeBeanContextMembershipListener(BeanContextMembershipListener JavaDoc bcml);
108
109     /**
110      * This global lock is used by both <code>BeanContext</code>
111      * and <code>BeanContextServices</code> implementors
112      * to serialize changes in a <code>BeanContext</code>
113      * hierarchy and any service requests etc.
114      */

115     public static final Object JavaDoc globalHierarchyLock = new Object JavaDoc();
116 }
117
Popular Tags