KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > plan > DeploymentPlan


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  * This generated bean class DeploymentPlan matches the schema element 'deployment-plan'.
21  *
22  * Generated on Wed Sep 29 16:29:52 PDT 2004
23  *
24  * This class matches the root element of the DTD,
25  * and is the root of the following bean graph:
26  *
27  * deploymentPlan <deployment-plan> : DeploymentPlan
28  * fileEntry <file-entry> : FileEntry[0,n]
29  * name <name> : String
30  * content <content> : String
31  * uri <uri> : String[0,1]
32  *
33  * @Generated
34  */

35
36 package org.netbeans.modules.j2ee.sun.share.plan;
37
38 import org.w3c.dom.*;
39 import org.netbeans.modules.schema2beans.*;
40 import java.beans.*;
41 import java.util.*;
42 import java.io.*;
43
44 // BEGIN_NOI18N
45

46 public class DeploymentPlan extends org.netbeans.modules.schema2beans.BaseBean
47 {
48
49     static Vector comparators = new Vector();
50     private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(3, 6, 1);
51
52     static public final String JavaDoc FILE_ENTRY = "FileEntry"; // NOI18N
53

54     public DeploymentPlan() throws org.netbeans.modules.schema2beans.Schema2BeansException {
55         this(null, Common.USE_DEFAULT_VALUES);
56     }
57
58     public DeploymentPlan(org.w3c.dom.Node JavaDoc doc, int options) throws org.netbeans.modules.schema2beans.Schema2BeansException {
59         this(Common.NO_DEFAULT_VALUES);
60         initFromNode(doc, options);
61     }
62     protected void initFromNode(org.w3c.dom.Node JavaDoc doc, int options) throws Schema2BeansException
63     {
64         if (doc == null)
65         {
66             doc = GraphManager.createRootElementNode("deployment-plan"); // NOI18N
67
if (doc == null)
68                 throw new Schema2BeansException(Common.getMessage(
69                     "CantCreateDOMRoot_msg", "deployment-plan"));
70         }
71         Node n = GraphManager.getElementNode("deployment-plan", doc); // NOI18N
72
if (n == null)
73             throw new Schema2BeansException(Common.getMessage(
74                 "DocRootNotInDOMGraph_msg", "deployment-plan", doc.getFirstChild().getNodeName()));
75
76         this.graphManager.setXmlDocument(doc);
77
78         // Entry point of the createBeans() recursive calls
79
this.createBean(n, this.graphManager());
80         this.initialize(options);
81     }
82     public DeploymentPlan(int options)
83     {
84         super(comparators, runtimeVersion);
85         initOptions(options);
86     }
87     protected void initOptions(int options)
88     {
89         // The graph manager is allocated in the bean root
90
this.graphManager = new GraphManager(this);
91         this.createRoot("deployment-plan", "DeploymentPlan", // NOI18N
92
Common.TYPE_1 | Common.TYPE_BEAN, DeploymentPlan.class);
93
94         // Properties (see root bean comments for the bean graph)
95
initPropertyTables(1);
96         this.createProperty("file-entry", // NOI18N
97
FILE_ENTRY,
98             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
99             FileEntry.class);
100         this.initialize(options);
101     }
102
103     // Setting the default values of the properties
104
void initialize(int options) {
105
106     }
107
108     // This attribute is an array, possibly empty
109
public void setFileEntry(int index, FileEntry value) {
110         this.setValue(FILE_ENTRY, index, value);
111     }
112
113     //
114
public FileEntry getFileEntry(int index) {
115         return (FileEntry)this.getValue(FILE_ENTRY, index);
116     }
117
118     // Return the number of properties
119
public int sizeFileEntry() {
120         return this.size(FILE_ENTRY);
121     }
122
123     // This attribute is an array, possibly empty
124
public void setFileEntry(FileEntry[] value) {
125         this.setValue(FILE_ENTRY, value);
126     }
127
128     //
129
public FileEntry[] getFileEntry() {
130         return (FileEntry[])this.getValues(FILE_ENTRY);
131     }
132
133     // Add a new element returning its index in the list
134
public int addFileEntry(org.netbeans.modules.j2ee.sun.share.plan.FileEntry value) throws java.beans.PropertyVetoException JavaDoc {
135         int positionOfNewItem = this.addValue(FILE_ENTRY, value);
136         return positionOfNewItem;
137     }
138
139     //
140
// Remove an element using its reference
141
// Returns the index the element had in the list
142
//
143
public int removeFileEntry(org.netbeans.modules.j2ee.sun.share.plan.FileEntry value) throws java.beans.PropertyVetoException JavaDoc {
144         return this.removeValue(FILE_ENTRY, value);
145     }
146
147     /**
148      * Create a new bean using it's default constructor.
149      * This does not add it to any bean graph.
150      */

151     public FileEntry newFileEntry() {
152         return new FileEntry();
153     }
154
155     //
156
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
157         comparators.add(c);
158     }
159
160     //
161
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
162         comparators.remove(c);
163     }
164     //
165
public void addVetoableChangeListener(String JavaDoc n, java.beans.VetoableChangeListener JavaDoc l) {
166         BeanProp p = this.beanProp(n);
167         if (p != null)
168             p.addVCListener(l);
169     }
170
171     //
172
public void removeVetoableChangeListener(String JavaDoc n, java.beans.VetoableChangeListener JavaDoc l) {
173         BeanProp p = this.beanProp(n);
174         if (p != null)
175             p.removeVCListener(l);
176     }
177
178     //
179
// This method returns the root of the bean graph
180
// Each call creates a new bean graph from the specified DOM graph
181
//
182
public static DeploymentPlan createGraph(org.w3c.dom.Node JavaDoc doc) throws org.netbeans.modules.schema2beans.Schema2BeansException {
183         return new DeploymentPlan(doc, Common.NO_DEFAULT_VALUES);
184     }
185
186     public static DeploymentPlan createGraph(java.io.InputStream JavaDoc in) throws org.netbeans.modules.schema2beans.Schema2BeansException {
187         return createGraph(in, false);
188     }
189
190     public static DeploymentPlan createGraph(java.io.InputStream JavaDoc in, boolean validate) throws org.netbeans.modules.schema2beans.Schema2BeansException {
191         Document doc = GraphManager.createXmlDocument(in, validate);
192         return createGraph(doc);
193     }
194
195     //
196
// This method returns the root for a new empty bean graph
197
//
198
public static DeploymentPlan createGraph() {
199         try {
200             return new DeploymentPlan();
201         }
202         catch (Schema2BeansException e) {
203             throw new RuntimeException JavaDoc(e);
204         }
205     }
206
207     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
208     }
209
210     // Special serializer: output XML as serialization
211
private void writeObject(java.io.ObjectOutputStream JavaDoc out) throws java.io.IOException JavaDoc{
212         ByteArrayOutputStream baos = new ByteArrayOutputStream();
213         write(baos);
214         String JavaDoc str = baos.toString();;
215         // System.out.println("str='"+str+"'");
216
out.writeUTF(str);
217     }
218     // Special deserializer: read XML as deserialization
219
private void readObject(java.io.ObjectInputStream JavaDoc in) throws java.io.IOException JavaDoc, ClassNotFoundException JavaDoc{
220         try{
221             init(comparators, runtimeVersion);
222             String JavaDoc strDocument = in.readUTF();
223             // System.out.println("strDocument='"+strDocument+"'");
224
ByteArrayInputStream bais = new ByteArrayInputStream(strDocument.getBytes());
225             Document doc = GraphManager.createXmlDocument(bais, false);
226             initOptions(Common.NO_DEFAULT_VALUES);
227             initFromNode(doc, Common.NO_DEFAULT_VALUES);
228         }
229         catch (Schema2BeansException e) {
230             throw new RuntimeException JavaDoc(e);
231         }
232     }
233
234     public void _setSchemaLocation(String JavaDoc location) {
235         if (beanProp().getAttrProp("xsi:schemaLocation", true) == null) {
236             createAttribute("xmlns:xsi", "xmlns:xsi", AttrProp.CDATA | AttrProp.IMPLIED, null, "http://www.w3.org/2001/XMLSchema-instance");
237             setAttributeValue("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
238             createAttribute("xsi:schemaLocation", "xsi:schemaLocation", AttrProp.CDATA | AttrProp.IMPLIED, null, location);
239         }
240         setAttributeValue("xsi:schemaLocation", location);
241     }
242
243     public String JavaDoc _getSchemaLocation() {
244         if (beanProp().getAttrProp("xsi:schemaLocation", true) == null) {
245             createAttribute("xmlns:xsi", "xmlns:xsi", AttrProp.CDATA | AttrProp.IMPLIED, null, "http://www.w3.org/2001/XMLSchema-instance");
246             setAttributeValue("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
247             createAttribute("xsi:schemaLocation", "xsi:schemaLocation", AttrProp.CDATA | AttrProp.IMPLIED, null, null);
248         }
249         return getAttributeValue("xsi:schemaLocation");
250     }
251
252     // Dump the content of this bean returning it as a String
253
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
254         String JavaDoc s;
255         Object JavaDoc o;
256         org.netbeans.modules.schema2beans.BaseBean n;
257         str.append(indent);
258         str.append("FileEntry["+this.sizeFileEntry()+"]"); // NOI18N
259
for(int i=0; i<this.sizeFileEntry(); i++)
260         {
261             str.append(indent+"\t");
262             str.append("#"+i+":");
263             n = (org.netbeans.modules.schema2beans.BaseBean) this.getFileEntry(i);
264             if (n != null)
265                 n.dump(str, indent + "\t"); // NOI18N
266
else
267                 str.append(indent+"\tnull"); // NOI18N
268
this.dumpAttributes(FILE_ENTRY, i, str, indent);
269         }
270
271     }
272     public String JavaDoc dumpBeanNode(){
273         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
274         str.append("DeploymentPlan\n"); // NOI18N
275
this.dump(str, "\n "); // NOI18N
276
return str.toString();
277     }}
278
279 // END_NOI18N
280

281
282 /*
283         The following schema file has been used for generation:
284
285 <?xml version="1.0" encoding="UTF-8"?>
286
287 <!--
288     Document : deployment-plan.dtd
289     Created on : April 7, 2003, 2:33 PM
290     Author : vkraemer
291     Description:
292         Purpose of the document follows.
293 -->
294
295 <!ELEMENT deployment-plan (file-entry*) >
296
297 <!ELEMENT file-entry (name, content, uri?) >
298
299 <!ELEMENT name (#PCDATA) >
300 <!ELEMENT content (#PCDATA) >
301 <!ELEMENT uri (#PCDATA) >
302
303 */

304
305
Popular Tags