KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > dd > api > CommonDDBean


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.sun.dd.api;
21
22 import org.netbeans.modules.schema2beans.BaseBean;
23
24 /**
25  * Parent of all DD API interfaces.
26  *
27  *<p><b><font color="red"><em>Important note: Do not provide an implementation of this interface unless you are a DD API provider!</em></font></b>
28  *</p>
29  *
30  * @author Milan Kuchtiak
31  */

32 public interface CommonDDBean {
33
34     public static final int MERGE_INTERSECT = BaseBean.MERGE_INTERSECT;
35     public static final int MERGE_UNION = BaseBean.MERGE_UNION;
36     public static final int MERGE_UPDATE = BaseBean.MERGE_UPDATE;
37         
38     public void merge(CommonDDBean root, int mode);
39     
40     /**
41      * Adds property change listener to particular CommonDDBean object (WebApp object).
42      * @param pcl property change listener
43      */

44     public void addPropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl);
45     /**
46      * Removes property change listener from CommonDDBean object.
47      * @param pcl property change listener
48      */

49     public void removePropertyChangeListener(java.beans.PropertyChangeListener JavaDoc pcl);
50     /**
51      * Returns the CommonDDBean object or array of CommonDDBean object for given property.<br>
52      * E.g. for retrieving the servlet-class value on Servlet object he <b>getValue("ServletClass");</b> can be used.
53      * @param propertyName name of the property the value is looking for
54      * @return the bean/array of beans related to given property
55      */

56     public Object JavaDoc getValue(String JavaDoc propertyName);
57     
58     public Object JavaDoc[] getValues(String JavaDoc name);
59     
60     public Object JavaDoc getValue(String JavaDoc name, int index);
61     
62     public void setValue(String JavaDoc name, Object JavaDoc value);
63     
64     public void setValue(String JavaDoc name, Object JavaDoc[] value);
65     
66     public void setValue(String JavaDoc name, int index, Object JavaDoc value);
67     
68     public String JavaDoc getAttributeValue(String JavaDoc name);
69     
70     public String JavaDoc getAttributeValue(String JavaDoc propName, String JavaDoc name);
71     
72     public String JavaDoc getAttributeValue(String JavaDoc propName, int index, String JavaDoc name);
73     
74     public void setAttributeValue(String JavaDoc name, String JavaDoc value);
75     
76     public void setAttributeValue(String JavaDoc propName, int index, String JavaDoc name, String JavaDoc value);
77     
78     public void setAttributeValue(String JavaDoc propName, String JavaDoc name, String JavaDoc value);
79     
80     public String JavaDoc[] findPropertyValue(String JavaDoc propName, Object JavaDoc value);
81     
82     public int addValue(String JavaDoc name, Object JavaDoc value);
83     
84     public int removeValue(String JavaDoc name, Object JavaDoc value);
85     
86     public void removeValue(String JavaDoc name, int index);
87     
88     public int size(String JavaDoc name);
89          
90     
91     /**
92      * Writes the whole DD or its fraction (element related to CommonDDBean) to output stream.<br>
93      * For DD root object there is more convenient to use the {@link org.netbeans.modules.j2ee.dd.api.common.RootInterface#write} method.<br>
94      * The correct usage with file objects is :<pre>
95 WebApp ejb;
96 FileObject fo;
97 ...
98 // code that initializes and modifies the ejb object
99 ...
100 FileLock lock;
101 try {
102     lock=fo.lock();
103 } catch (FileAlreadyLockedException e) {
104     // handling the exception
105 }
106 if (lock!=null) {
107     try {
108         OutputStream os=fo.getOutputStream(lock);
109         try {
110             ejb.write(os);
111         } finally {
112             os.close();
113         }
114     } finally {
115         lock.releaseLock();
116     }
117 }
118 ...
119      *</pre>
120      * @param os output stream for writing
121      */

122     public void write(java.io.OutputStream JavaDoc os) throws java.io.IOException JavaDoc;
123
124     public void write(java.io.Writer JavaDoc w) throws java.io.IOException JavaDoc, org.netbeans.modules.j2ee.sun.dd.api.DDException;
125         
126     /** Clone this bean.
127      */

128     public Object JavaDoc clone();
129   
130     /** Clone this bean, but as an instance from the model tree of a different version.
131      */

132     public CommonDDBean cloneVersion(String JavaDoc version);
133         
134     /**
135      * Used to convert an graph to the corresponding XML in String form.
136      */

137     public String JavaDoc dumpBeanNode();
138     
139     public CommonDDBean getPropertyParent(String JavaDoc name);
140     
141 }
142
Popular Tags