KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > customizers > data > DynamicProperties


1 /**
2  * This generated bean class DynamicProperties
3  * matches the schema element 'dynamic-properties'.
4  *
5  * Generated on Wed Sep 29 16:29:53 PDT 2004
6  *
7  * This class matches the root element of the DTD,
8  * and is the root of the bean graph.
9  *
10  * dynamicProperties <dynamic-properties> : DynamicProperties
11  * propertyList <property-list> : PropertyList[0,n]
12  * [attr: editable CDATA false]
13  * [attr: description CDATA true]
14  * [attr: bundle-path CDATA #IMPLIED ]
15  * propertyName <property-name> : String
16  * propertyParam <property-param> : PropertyParam[1,n]
17  * paramName <param-name> : String
18  * paramType <param-type> : ParamType
19  * [attr: type CDATA text]
20  * [attr: editable CDATA false]
21  * [attr: required CDATA true]
22  * | paramValue <param-value> : String[0,n]
23  * | paramLocale <param-locale> : boolean
24  * | EMPTY : String
25  * | paramCharset <param-charset> : boolean
26  * | EMPTY : String
27  * paramMin <param-min> : String[0,1]
28  * paramMax <param-max> : String[0,1]
29  * paramLabel <param-label> : String[0,1]
30  * paramValidator <param-validator> : String[0,1]
31  * defaultValue <default-value> : String[0,1]
32  * helpId <help-id> : String[0,1]
33  * paramDescription <param-description> : String[0,1]
34  * helpId <help-id> : String[0,1]
35  * validator <validator> : Validator[0,n]
36  * validatorName <validator-name> : String
37  * validatorPattern <validator-pattern> : String
38  *
39  * @Generated
40  */

41
42 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.data;
43
44 public class DynamicProperties {
45     public static final String JavaDoc PROPERTY_LIST = "PropertyList"; // NOI18N
46
public static final String JavaDoc VALIDATOR = "Validator"; // NOI18N
47

48     private java.util.List JavaDoc _PropertyList = new java.util.ArrayList JavaDoc(); // List<PropertyList>
49
private java.util.List JavaDoc _Validator = new java.util.ArrayList JavaDoc(); // List<Validator>
50
private java.lang.String JavaDoc schemaLocation;
51
52     /**
53      * Normal starting point constructor.
54      */

55     public DynamicProperties() {
56     }
57
58     /**
59      * Deep copy
60 */

61     public DynamicProperties(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties source) {
62         this(source, false);
63     }
64
65     /**
66      * Deep copy
67      * @param justData just copy the XML relevant data
68      */

69     public DynamicProperties(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties source, boolean justData) {
70         for (java.util.Iterator JavaDoc it = source._PropertyList.iterator();
71             it.hasNext(); ) {
72             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList srcElement = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList)it.next();
73             _PropertyList.add((srcElement == null) ? null : newPropertyList(srcElement, justData));
74         }
75         for (java.util.Iterator JavaDoc it = source._Validator.iterator();
76             it.hasNext(); ) {
77             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator srcElement = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator)it.next();
78             _Validator.add((srcElement == null) ? null : newValidator(srcElement, justData));
79         }
80         schemaLocation = source.schemaLocation;
81     }
82
83     // This attribute is an array, possibly empty
84
public void setPropertyList(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList[] value) {
85         if (value == null)
86             value = new PropertyList[0];
87         _PropertyList.clear();
88         ((java.util.ArrayList JavaDoc) _PropertyList).ensureCapacity(value.length);
89         for (int i = 0; i < value.length; ++i) {
90             _PropertyList.add(value[i]);
91         }
92     }
93
94     public void setPropertyList(int index, org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList value) {
95         _PropertyList.set(index, value);
96     }
97
98     public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList[] getPropertyList() {
99         PropertyList[] arr = new PropertyList[_PropertyList.size()];
100         return (PropertyList[]) _PropertyList.toArray(arr);
101     }
102
103     public java.util.List JavaDoc fetchPropertyListList() {
104         return _PropertyList;
105     }
106
107     public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList getPropertyList(int index) {
108         return (PropertyList)_PropertyList.get(index);
109     }
110
111     // Return the number of propertyList
112
public int sizePropertyList() {
113         return _PropertyList.size();
114     }
115
116     public int addPropertyList(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList value) {
117         _PropertyList.add(value);
118         int positionOfNewItem = _PropertyList.size()-1;
119         return positionOfNewItem;
120     }
121
122     /**
123      * Search from the end looking for @param value, and then remove it.
124      */

125     public int removePropertyList(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList value) {
126         int pos = _PropertyList.indexOf(value);
127         if (pos >= 0) {
128             _PropertyList.remove(pos);
129         }
130         return pos;
131     }
132
133     // This attribute is an array, possibly empty
134
public void setValidator(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator[] value) {
135         if (value == null)
136             value = new Validator[0];
137         _Validator.clear();
138         ((java.util.ArrayList JavaDoc) _Validator).ensureCapacity(value.length);
139         for (int i = 0; i < value.length; ++i) {
140             _Validator.add(value[i]);
141         }
142     }
143
144     public void setValidator(int index, org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator value) {
145         _Validator.set(index, value);
146     }
147
148     public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator[] getValidator() {
149         Validator[] arr = new Validator[_Validator.size()];
150         return (Validator[]) _Validator.toArray(arr);
151     }
152
153     public java.util.List JavaDoc fetchValidatorList() {
154         return _Validator;
155     }
156
157     public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator getValidator(int index) {
158         return (Validator)_Validator.get(index);
159     }
160
161     // Return the number of validator
162
public int sizeValidator() {
163         return _Validator.size();
164     }
165
166     public int addValidator(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator value) {
167         _Validator.add(value);
168         int positionOfNewItem = _Validator.size()-1;
169         return positionOfNewItem;
170     }
171
172     /**
173      * Search from the end looking for @param value, and then remove it.
174      */

175     public int removeValidator(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator value) {
176         int pos = _Validator.indexOf(value);
177         if (pos >= 0) {
178             _Validator.remove(pos);
179         }
180         return pos;
181     }
182
183     public void _setSchemaLocation(String JavaDoc location) {
184         schemaLocation = location;
185     }
186
187     public String JavaDoc _getSchemaLocation() {
188         return schemaLocation;
189     }
190
191     /**
192      * Create a new bean using it's default constructor.
193      * This does not add it to any bean graph.
194      */

195     public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList newPropertyList() {
196         return new org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList();
197     }
198
199     /**
200      * Create a new bean, copying from another one.
201      * This does not add it to any bean graph.
202      */

203     public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList newPropertyList(PropertyList source, boolean justData) {
204         return new org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList(source, justData);
205     }
206
207     /**
208      * Create a new bean using it's default constructor.
209      * This does not add it to any bean graph.
210      */

211     public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator newValidator() {
212         return new org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator();
213     }
214
215     /**
216      * Create a new bean, copying from another one.
217      * This does not add it to any bean graph.
218      */

219     public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator newValidator(Validator source, boolean justData) {
220         return new org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator(source, justData);
221     }
222
223     public void write(org.openide.filesystems.FileObject fo) throws java.io.IOException JavaDoc {
224         org.openide.filesystems.FileLock lock = fo.lock();
225         try {
226             java.io.OutputStream JavaDoc out = fo.getOutputStream(lock);
227             write(out);
228             out.close();
229         } finally {
230             lock.releaseLock();
231         }
232     }
233
234     public void write(org.openide.filesystems.FileObject dir, String JavaDoc filename) throws java.io.IOException JavaDoc {
235         org.openide.filesystems.FileObject file = dir.getFileObject(filename);
236         if (file == null) {
237             file = dir.createData(filename);
238         }
239         write(file);
240     }
241
242     public void write(java.io.File JavaDoc f) throws java.io.IOException JavaDoc {
243         java.io.OutputStream JavaDoc out = new java.io.FileOutputStream JavaDoc(f);
244         try {
245             write(out);
246         } finally {
247             out.close();
248         }
249     }
250
251     public void write(java.io.OutputStream JavaDoc out) throws java.io.IOException JavaDoc {
252         write(out, null);
253     }
254
255     public void write(java.io.OutputStream JavaDoc out, String JavaDoc encoding) throws java.io.IOException JavaDoc {
256         java.io.Writer JavaDoc w;
257         if (encoding == null) {
258             encoding = "UTF-8"; // NOI18N
259
}
260         w = new java.io.BufferedWriter JavaDoc(new java.io.OutputStreamWriter JavaDoc(out, encoding));
261         write(w, encoding);
262         w.flush();
263     }
264
265     /**
266      * Print this Java Bean to @param out including an XML header.
267      * @param encoding is the encoding style that @param out was opened with.
268      */

269     public void write(java.io.Writer JavaDoc out, String JavaDoc encoding) throws java.io.IOException JavaDoc {
270         out.write("<?xml version='1.0'"); // NOI18N
271
if (encoding != null)
272             out.write(" encoding='"+encoding+"'"); // NOI18N
273
out.write(" ?>\n"); // NOI18N
274
writeNode(out, "dynamic-properties", ""); // NOI18N
275
}
276
277     public void writeNode(java.io.Writer JavaDoc out) throws java.io.IOException JavaDoc {
278         String JavaDoc myName;
279         myName = "dynamic-properties";
280         writeNode(out, myName, ""); // NOI18N
281
}
282
283     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc indent) throws java.io.IOException JavaDoc {
284         writeNode(out, nodeName, null, indent, new java.util.HashMap JavaDoc());
285     }
286
287     /**
288      * It's not recommended to call this method directly.
289      */

290     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc namespace, String JavaDoc indent, java.util.Map JavaDoc namespaceMap) throws java.io.IOException JavaDoc {
291         out.write(indent);
292         out.write("<");
293         if (namespace != null) {
294             out.write((String JavaDoc)namespaceMap.get(namespace));
295             out.write(":");
296         }
297         out.write(nodeName);
298         if (schemaLocation != null) {
299             namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
300             out.write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='");
301             out.write(schemaLocation);
302             out.write("'"); // NOI18N
303
}
304         out.write(">\n");
305         String JavaDoc nextIndent = indent + " ";
306         for (java.util.Iterator JavaDoc it = _PropertyList.iterator();
307             it.hasNext(); ) {
308             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList)it.next();
309             if (element != null) {
310                 element.writeNode(out, "property-list", null, nextIndent, namespaceMap);
311             }
312         }
313         for (java.util.Iterator JavaDoc it = _Validator.iterator(); it.hasNext();
314             ) {
315             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator)it.next();
316             if (element != null) {
317                 element.writeNode(out, "validator", null, nextIndent, namespaceMap);
318             }
319         }
320         out.write(indent);
321         out.write("</");
322         if (namespace != null) {
323             out.write((String JavaDoc)namespaceMap.get(namespace));
324             out.write(":");
325         }
326         out.write(nodeName);
327         out.write(">\n");
328     }
329
330     public static DynamicProperties read(org.openide.filesystems.FileObject fo) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
331         java.io.InputStream JavaDoc in = fo.getInputStream();
332         try {
333             return read(in);
334         } finally {
335             in.close();
336         }
337     }
338
339     public static DynamicProperties read(java.io.File JavaDoc f) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
340         java.io.InputStream JavaDoc in = new java.io.FileInputStream JavaDoc(f);
341         try {
342             return read(in);
343         } finally {
344             in.close();
345         }
346     }
347
348     public static DynamicProperties read(java.io.InputStream JavaDoc in) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
349         return read(new org.xml.sax.InputSource JavaDoc(in), false, null, null);
350     }
351
352     /**
353      * Warning: in readNoEntityResolver character and entity references will
354      * not be read from any DTD in the XML source.
355      * However, this way is faster since no DTDs are looked up
356      * (possibly skipping network access) or parsed.
357 */

358     public static DynamicProperties readNoEntityResolver(java.io.InputStream JavaDoc in) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
359         return read(new org.xml.sax.InputSource JavaDoc(in), false,
360             new org.xml.sax.EntityResolver JavaDoc() {
361             public org.xml.sax.InputSource JavaDoc resolveEntity(String JavaDoc publicId, String JavaDoc systemId) {
362                 java.io.ByteArrayInputStream JavaDoc bin = new java.io.ByteArrayInputStream JavaDoc(new byte[0]);
363                 return new org.xml.sax.InputSource JavaDoc(bin);
364             }
365         }
366             , null);
367     }
368
369     public static DynamicProperties read(org.xml.sax.InputSource JavaDoc in, boolean validate, org.xml.sax.EntityResolver JavaDoc er, org.xml.sax.ErrorHandler JavaDoc eh) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
370         javax.xml.parsers.DocumentBuilderFactory JavaDoc dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
371         dbf.setValidating(validate);
372         dbf.setNamespaceAware(true);
373         javax.xml.parsers.DocumentBuilder JavaDoc db = dbf.newDocumentBuilder();
374         if (er != null) db.setEntityResolver(er);
375         if (eh != null) db.setErrorHandler(eh);
376         org.w3c.dom.Document JavaDoc doc = db.parse(in);
377         return read(doc);
378     }
379
380     public static DynamicProperties read(org.w3c.dom.Document JavaDoc document) {
381         DynamicProperties aDynamicProperties = new DynamicProperties();
382         aDynamicProperties.readFromDocument(document);
383         return aDynamicProperties;
384     }
385
386     protected void readFromDocument(org.w3c.dom.Document JavaDoc document) {
387         readNode(document.getDocumentElement());
388     }
389
390     public void readNode(org.w3c.dom.Node JavaDoc node) {
391         readNode(node, new java.util.HashMap JavaDoc());
392     }
393
394     public void readNode(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes) {
395         if (node.hasAttributes()) {
396             org.w3c.dom.NamedNodeMap JavaDoc attrs = node.getAttributes();
397             org.w3c.dom.Attr JavaDoc attr;
398             java.lang.String JavaDoc attrValue;
399             boolean firstNamespaceDef = true;
400             for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
401                 attr = (org.w3c.dom.Attr JavaDoc) attrs.item(attrNum);
402                 String JavaDoc attrName = attr.getName();
403                 if (attrName.startsWith("xmlns:")) {
404                     if (firstNamespaceDef) {
405                         firstNamespaceDef = false;
406                         // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
407
namespacePrefixes = new java.util.HashMap JavaDoc(namespacePrefixes);
408                     }
409                     String JavaDoc attrNSPrefix = attrName.substring(6, attrName.length());
410                     namespacePrefixes.put(attrNSPrefix, attr.getValue());
411                 }
412             }
413             String JavaDoc xsiPrefix = "xsi";
414             for (java.util.Iterator JavaDoc it = namespacePrefixes.keySet().iterator();
415                 it.hasNext(); ) {
416                 String JavaDoc prefix = (String JavaDoc) it.next();
417                 String JavaDoc ns = (String JavaDoc) namespacePrefixes.get(prefix);
418                 if ("http://www.w3.org/2001/XMLSchema-instance".equals(ns)) {
419                     xsiPrefix = prefix;
420                     break;
421                 }
422             }
423             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem(""+xsiPrefix+":schemaLocation");
424             if (attr != null) {
425                 attrValue = attr.getValue();
426                 schemaLocation = attrValue;
427             }
428         }
429         org.w3c.dom.NodeList JavaDoc children = node.getChildNodes();
430         for (int i = 0, size = children.getLength(); i < size; ++i) {
431             org.w3c.dom.Node JavaDoc childNode = children.item(i);
432             String JavaDoc childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern());
433             String JavaDoc childNodeValue = "";
434             if (childNode.getFirstChild() != null) {
435                 childNodeValue = childNode.getFirstChild().getNodeValue();
436             }
437             if (childNodeName == "property-list") {
438                 PropertyList aPropertyList = newPropertyList();
439                 aPropertyList.readNode(childNode, namespacePrefixes);
440                 _PropertyList.add(aPropertyList);
441             }
442             else if (childNodeName == "validator") {
443                 Validator aValidator = newValidator();
444                 aValidator.readNode(childNode, namespacePrefixes);
445                 _Validator.add(aValidator);
446             }
447             else {
448                 // Found extra unrecognized childNode
449
}
450         }
451     }
452
453     /**
454      * Takes some text to be printed into an XML stream and escapes any
455      * characters that might make it invalid XML (like '<').
456      */

457     public static void writeXML(java.io.Writer JavaDoc out, String JavaDoc msg) throws java.io.IOException JavaDoc {
458         writeXML(out, msg, true);
459     }
460
461     public static void writeXML(java.io.Writer JavaDoc out, String JavaDoc msg, boolean attribute) throws java.io.IOException JavaDoc {
462         if (msg == null)
463             return;
464         int msgLength = msg.length();
465         for (int i = 0; i < msgLength; ++i) {
466             char c = msg.charAt(i);
467             writeXML(out, c, attribute);
468         }
469     }
470
471     public static void writeXML(java.io.Writer JavaDoc out, char msg, boolean attribute) throws java.io.IOException JavaDoc {
472         if (msg == '&')
473             out.write("&amp;");
474         else if (msg == '<')
475             out.write("&lt;");
476         else if (msg == '>')
477             out.write("&gt;");
478         else if (attribute) {
479             if (msg == '"')
480                 out.write("&quot;");
481             else if (msg == '\'')
482                 out.write("&apos;");
483             else if (msg == '\n')
484                 out.write("&#xA;");
485             else if (msg == '\t')
486                 out.write("&#x9;");
487             else
488                 out.write(msg);
489         }
490         else
491             out.write(msg);
492     }
493
494     public void changePropertyByName(String JavaDoc name, Object JavaDoc value) {
495         if (name == null) return;
496         name = name.intern();
497         if (name == "propertyList")
498             addPropertyList((PropertyList)value);
499         else if (name == "propertyList[]")
500             setPropertyList((PropertyList[]) value);
501         else if (name == "validator")
502             addValidator((Validator)value);
503         else if (name == "validator[]")
504             setValidator((Validator[]) value);
505         else
506             throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for DynamicProperties");
507     }
508
509     public Object JavaDoc fetchPropertyByName(String JavaDoc name) {
510         if (name == "propertyList[]")
511             return getPropertyList();
512         if (name == "validator[]")
513             return getValidator();
514         throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for DynamicProperties");
515     }
516
517     public String JavaDoc nameSelf() {
518         return "/DynamicProperties";
519     }
520
521     public String JavaDoc nameChild(Object JavaDoc childObj) {
522         return nameChild(childObj, false, false);
523     }
524
525     /**
526      * @param childObj The child object to search for
527      * @param returnSchemaName Whether or not the schema name should be returned or the property name
528      * @return null if not found
529      */

530     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName) {
531         return nameChild(childObj, returnConstName, returnSchemaName, false);
532     }
533
534     /**
535      * @param childObj The child object to search for
536      * @param returnSchemaName Whether or not the schema name should be returned or the property name
537      * @return null if not found
538      */

539     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) {
540         if (childObj instanceof PropertyList) {
541             PropertyList child = (PropertyList) childObj;
542             int index = 0;
543             for (java.util.Iterator JavaDoc it = _PropertyList.iterator();
544                 it.hasNext(); ) {
545                 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList)it.next();
546                 if (child == element) {
547                     if (returnConstName) {
548                         return PROPERTY_LIST;
549                     } else if (returnSchemaName) {
550                         return "property-list";
551                     } else if (returnXPathName) {
552                         return "property-list[position()="+index+"]";
553                     } else {
554                         return "PropertyList."+Integer.toHexString(index);
555                     }
556                 }
557                 ++index;
558             }
559         }
560         if (childObj instanceof Validator) {
561             Validator child = (Validator) childObj;
562             int index = 0;
563             for (java.util.Iterator JavaDoc it = _Validator.iterator();
564                 it.hasNext(); ) {
565                 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator)it.next();
566                 if (child == element) {
567                     if (returnConstName) {
568                         return VALIDATOR;
569                     } else if (returnSchemaName) {
570                         return "validator";
571                     } else if (returnXPathName) {
572                         return "validator[position()="+index+"]";
573                     } else {
574                         return "Validator."+Integer.toHexString(index);
575                     }
576                 }
577                 ++index;
578             }
579         }
580         return null;
581     }
582
583     /**
584      * Return an array of all of the properties that are beans and are set.
585      */

586     public java.lang.Object JavaDoc[] childBeans(boolean recursive) {
587         java.util.List JavaDoc children = new java.util.LinkedList JavaDoc();
588         childBeans(recursive, children);
589         java.lang.Object JavaDoc[] result = new java.lang.Object JavaDoc[children.size()];
590         return (java.lang.Object JavaDoc[]) children.toArray(result);
591     }
592
593     /**
594      * Put all child beans into the beans list.
595      */

596     public void childBeans(boolean recursive, java.util.List JavaDoc beans) {
597         for (java.util.Iterator JavaDoc it = _PropertyList.iterator();
598             it.hasNext(); ) {
599             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList)it.next();
600             if (element != null) {
601                 if (recursive) {
602                     element.childBeans(true, beans);
603                 }
604                 beans.add(element);
605             }
606         }
607         for (java.util.Iterator JavaDoc it = _Validator.iterator(); it.hasNext();
608             ) {
609             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator)it.next();
610             if (element != null) {
611                 if (recursive) {
612                     element.childBeans(true, beans);
613                 }
614                 beans.add(element);
615             }
616         }
617     }
618
619     public boolean equals(Object JavaDoc o) {
620         return o instanceof org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties && equals((org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties) o);
621     }
622
623     public boolean equals(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties inst) {
624         if (inst == this) {
625             return true;
626         }
627         if (inst == null) {
628             return false;
629         }
630         if (sizePropertyList() != inst.sizePropertyList())
631             return false;
632         // Compare every element.
633
for (java.util.Iterator JavaDoc it = _PropertyList.iterator(), it2 = inst._PropertyList.iterator();
634             it.hasNext() && it2.hasNext(); ) {
635             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList)it.next();
636             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList element2 = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList)it2.next();
637             if (!(element == null ? element2 == null : element.equals(element2))) {
638                 return false;
639             }
640         }
641         if (sizeValidator() != inst.sizeValidator())
642             return false;
643         // Compare every element.
644
for (java.util.Iterator JavaDoc it = _Validator.iterator(), it2 = inst._Validator.iterator();
645             it.hasNext() && it2.hasNext(); ) {
646             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator)it.next();
647             org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator element2 = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.Validator)it2.next();
648             if (!(element == null ? element2 == null : element.equals(element2))) {
649                 return false;
650             }
651         }
652         return true;
653     }
654
655     public int hashCode() {
656         int result = 17;
657         result = 37*result + (_PropertyList == null ? 0 : _PropertyList.hashCode());
658         result = 37*result + (_Validator == null ? 0 : _Validator.hashCode());
659         return result;
660     }
661
662 }
663
664
665 /*
666         The following schema file has been used for generation:
667
668 <?xml version="1.0" encoding="UTF-8"?>
669
670 <!--
671     Document : dynamic-properties.dtd
672     Created on : January 28, 2004, 8:48 PM
673     Author : Peter Williams
674     Description:
675         Purpose of the document follows.
676         
677     DTD for definition of properties, their editors and validators to allow for
678     name/value pair property editing to be handled nicely in the plugin.
679 -->
680
681 <!-- The file is a list of property lists -->
682 <!ELEMENT dynamic-properties (property-list*, validator*)>
683
684 <!-- Each property list can be fixed or editable and has a name -->
685 <!ELEMENT property-list (property-name, property-param+, help-id?)>
686 <!ATTLIST property-list editable CDATA "false"
687                         description CDATA "true"
688                         bundle-path CDATA #IMPLIED>
689
690 <!ELEMENT property-name (#PCDATA)>
691
692 <!--
693     Each element in a property list has a name. It may also have a type, a
694     validator, and possibly a min and/or max if the type is 'number'. Lastly,
695     it could have a helpId
696 -->
697 <!ELEMENT property-param (param-name, param-type, param-label?, param-validator?, default-value?,
698                           help-id?, param-description?)>
699
700 <!ELEMENT param-name (#PCDATA)>
701
702 <!--
703     There are four allowed types: boolean, text, number, and list. The editable
704     attribute is ignored for all types except the list type.
705     
706     For boolean properties, default value should be string using the boolean
707       'ENTITY' definitions in the sun-xxx dtd's, preferably true/false.
708     For text properties, you should provide a validator (or none to allow
709       arbitrary text) and a default value if desired.
710     For number properties, the number is assumed to be a signed long integer.
711       Use the min & max params to specify a range if required.
712     For list properties, use as many param-value entries as necessary to represent
713       the list. If the list is editable, set the editable attribute on the type.
714       One exception here is if the list is the list of charsets or locales, use
715       param-locale or param-charset to specify this. These lists are provided by
716       the Locale and Charset classes in the JVM.
717
718     (I'm not actually defining ENTITY's here because Schema2Beans does not support them.)
719 -->
720 <!ELEMENT param-type ((param-value* | param-locale | param-charset), param-min?, param-max?)>
721 <!ATTLIST param-type type CDATA "text"
722                      editable CDATA "false"
723                      required CDATA "true">
724
725 <!ELEMENT param-value (#PCDATA)>
726 <!ELEMENT param-locale EMPTY>
727 <!ELEMENT param-charset EMPTY>
728 <!ELEMENT param-min (#PCDATA)>
729 <!ELEMENT param-max (#PCDATA)>
730
731 <!--
732     The text label (actually, will become bundle string id) to be used for the
733     value field instead of the word 'Value'
734 -->
735 <!ELEMENT param-label (#PCDATA)>
736
737 <!--
738     Validators are used to ensure the text in a text field matches a specific
739     pattern. The following validators are supported: (Can I support java
740     regular expression patterns here? It would make it lots easier!!!)
741     
742         directory: A directory path specification
743         javaid: A legal java identifier (allows java keywords though)
744         url: A URL string
745         domain: A domain. This is probably similar to javaid + represents a server domain
746         package: A legal java package name, e.g. javaid's separated by periods.
747         memorysize: A number followed by kb or mb (case insensitive)
748         classid: A windows classid (GUID)
749 -->
750 <!ELEMENT param-validator (#PCDATA)>
751
752 <!--
753     String that will become the default value for the property. If the property
754     value must fit a specific pattern, the default-value must qualify.
755 -->
756 <!ELEMENT default-value (#PCDATA)>
757
758 <!--
759     The help id for this field (or panel if specified at the property level,
760     which is likely what we'll do.
761 -->
762 <!ELEMENT help-id (#PCDATA)>
763
764
765 <!--
766     ID of string in bundle (see property-list attributes) to use for default
767     description.
768 -->
769 <!ELEMENT param-description (#PCDATA)>
770
771 <!-- !PW this would be used by property-param once it's done
772
773     Version of the appserver this property-param belongs to. Not present means
774     the property is applicable to all versions.
775     
776     Allowable Strings: major[.minor][pe|se|ee]
777         Major version is require.
778         Minor is optional (not present matches all)
779         Type is optional (not present matches all)
780         
781     For range attribute, valid values are:
782         ending, only, starting
783 <!ELEMENT appserver-version (#PCDATA)>
784 <!ATTLIST appserver-version range CDATA #IMPLIED>
785 -->
786
787 <!--
788     Validator definition. These are referred to by name from the <param-validator>
789     entry in <property-param>, above.
790 -->
791 <!ELEMENT validator (validator-name, validator-pattern)>
792
793 <!ELEMENT validator-name (#PCDATA)>
794
795 <!ELEMENT validator-pattern (#PCDATA)>
796
797
798
799 */

800
Popular Tags