KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > common > validation > data > Parameters


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /**
25  * This generated bean class Parameters matches the schema element parameters
26  *
27  * Generated on Wed Aug 20 17:21:25 PDT 2003
28  */

29
30 package com.sun.enterprise.tools.common.validation.data;
31
32 import org.w3c.dom.*;
33 import org.netbeans.modules.schema2beans.*;
34 import java.beans.*;
35 import java.util.*;
36
37 // BEGIN_NOI18N
38

39 public class Parameters extends org.netbeans.modules.schema2beans.BaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc PARAMETER = "Parameter"; // NOI18N
45

46     public Parameters() {
47         this(Common.USE_DEFAULT_VALUES);
48     }
49
50     public Parameters(int options)
51     {
52         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
53         // Properties (see root bean comments for the bean graph)
54
this.createProperty("parameter", // NOI18N
55
PARAMETER,
56             Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY,
57             Parameter.class);
58         this.initialize(options);
59     }
60
61     // Setting the default values of the properties
62
void initialize(int options)
63     {
64
65     }
66
67     // This attribute is an array containing at least one element
68
public void setParameter(int index, Parameter value) {
69         this.setValue(PARAMETER, index, value);
70     }
71
72     //
73
public Parameter getParameter(int index) {
74         return (Parameter)this.getValue(PARAMETER, index);
75     }
76
77     // This attribute is an array containing at least one element
78
public void setParameter(Parameter[] value) {
79         this.setValue(PARAMETER, value);
80     }
81
82     //
83
public Parameter[] getParameter() {
84         return (Parameter[])this.getValues(PARAMETER);
85     }
86
87     // Return the number of properties
88
public int sizeParameter() {
89         return this.size(PARAMETER);
90     }
91
92     // Add a new element returning its index in the list
93
public int addParameter(com.sun.enterprise.tools.common.validation.data.Parameter value) {
94         return this.addValue(PARAMETER, value);
95     }
96
97     //
98
// Remove an element using its reference
99
// Returns the index the element had in the list
100
//
101
public int removeParameter(com.sun.enterprise.tools.common.validation.data.Parameter value) {
102         return this.removeValue(PARAMETER, value);
103     }
104
105     //
106
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
107         comparators.add(c);
108     }
109
110     //
111
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
112         comparators.remove(c);
113     }
114     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
115         boolean restrictionFailure = false;
116         // Validating property parameter
117
if (sizeParameter() == 0) {
118             throw new org.netbeans.modules.schema2beans.ValidateException("sizeParameter() == 0", "parameter", this); // NOI18N
119
}
120         for (int _index = 0; _index < sizeParameter(); ++_index) {
121             com.sun.enterprise.tools.common.validation.data.Parameter element = getParameter(_index);
122             if (element != null) {
123                 element.validate();
124             }
125         }
126     }
127
128     // Dump the content of this bean returning it as a String
129
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
130         String JavaDoc s;
131         Object JavaDoc o;
132         org.netbeans.modules.schema2beans.BaseBean n;
133         str.append(indent);
134         str.append("Parameter["+this.sizeParameter()+"]"); // NOI18N
135
for(int i=0; i<this.sizeParameter(); i++)
136         {
137             str.append(indent+"\t");
138             str.append("#"+i+":");
139             n = (org.netbeans.modules.schema2beans.BaseBean) this.getParameter(i);
140             if (n != null)
141                 n.dump(str, indent + "\t"); // NOI18N
142
else
143                 str.append(indent+"\tnull"); // NOI18N
144
this.dumpAttributes(PARAMETER, i, str, indent);
145         }
146
147     }
148     public String JavaDoc dumpBeanNode(){
149         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
150         str.append("Parameters\n"); // NOI18N
151
this.dump(str, "\n "); // NOI18N
152
return str.toString();
153     }}
154
155 // END_NOI18N
156

157
158 /*
159         The following schema file has been used for generation:
160
161 <!--
162   XML DTD for for validation xml.
163   validation.xml is used to specify Constraints to be applied to
164   elements.
165  
166   $Revision: 1.3 $
167 -->
168
169
170 <!--
171 This is the root element
172 -->
173 <!ELEMENT validation (element*) >
174 <!ATTLIST validation
175         validate CDATA (true | false) "true">
176
177
178 <!--
179 This element represents, the set of Constraints to be applied to
180 the given element.
181 -->
182 <!ELEMENT element (name, check*)>
183
184
185 <!--
186 This element represents, a particular Constraint.
187 Note : Information about this Constraint must be provided through
188 corresponding <check-info> object in constraints.xml Sub element
189 <name> should match with <name> of corresponding <check-info>
190 element defined in constraints.xml.
191 -->
192 <!ELEMENT check (name, parameters?)>
193
194
195 <!--
196 This element represent, Constraint parameters.
197 Number of sub elements, <parameter> should match with the number
198 of <argument> sub elements, of corresponding <arguments> element
199 in constraints.xml
200 -->
201 <!ELEMENT parameters (parameter+)>
202
203
204 <!--
205 This element represents, a Constraint parameter.
206 Sub elements <name> should match with the <name> sub element of
207 corresponding <argument> element in constraints.xml
208 <value> could be one or more. In case of an variable array
209 argument, multiple <value> elements will be used.
210 Example : InConstraint
211 -->
212 <!ELEMENT parameter (name, value+)>
213
214
215 <!--
216 Used in elements : <element>, <check> and <parameter>
217 In <element> , it represents the name(xpath - complete absolute
218 name of an element(leaf).
219 In <check> , it represents name of a Constraint. This is the
220 linking element for <check> element in validation.xml and
221 <check-info> element in constraints.xml.
222 In <parameter>, it represents name of parameter. This is the
223 linking element for <parameter> element in validation.xml and
224 <argument> element in constraints.xml.
225 -->
226 <!ELEMENT name (#PCDATA)>
227
228
229 <!--
230 This element represents the value of a parameter.
231 -->
232 <!ELEMENT value (#PCDATA)>
233
234 */

235
Popular Tags