KickJava   Java API By Example, From Geeks To Geeks.

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


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 Check matches the schema element check
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 Check extends org.netbeans.modules.schema2beans.BaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc NAME = "Name"; // NOI18N
45
static public final String JavaDoc PARAMETERS = "Parameters"; // NOI18N
46

47     public Check() {
48         this(Common.USE_DEFAULT_VALUES);
49     }
50
51     public Check(int options)
52     {
53         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
54         // Properties (see root bean comments for the bean graph)
55
this.createProperty("name", // NOI18N
56
NAME,
57             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
58             String JavaDoc.class);
59         this.createProperty("parameters", // NOI18N
60
PARAMETERS,
61             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
62             Parameters.class);
63         this.initialize(options);
64     }
65
66     // Setting the default values of the properties
67
void initialize(int options)
68     {
69     
70     }
71
72     // This attribute is mandatory
73
public void setName(String JavaDoc value) {
74         this.setValue(NAME, value);
75     }
76
77     //
78
public String JavaDoc getName() {
79         return (String JavaDoc)this.getValue(NAME);
80     }
81
82     // This attribute is optional
83
public void setParameters(Parameters value) {
84         this.setValue(PARAMETERS, value);
85     }
86
87     //
88
public Parameters getParameters() {
89         return (Parameters)this.getValue(PARAMETERS);
90     }
91
92     //
93
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
94         comparators.add(c);
95     }
96
97     //
98
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
99         comparators.remove(c);
100     }
101     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
102         boolean restrictionFailure = false;
103         // Validating property name
104
if (getName() == null) {
105             throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); // NOI18N
106
}
107         // Validating property parameters
108
if (getParameters() != null) {
109             getParameters().validate();
110         }
111     }
112
113     // Dump the content of this bean returning it as a String
114
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
115         String JavaDoc s;
116         Object JavaDoc o;
117         org.netbeans.modules.schema2beans.BaseBean n;
118         str.append(indent);
119         str.append("Name"); // NOI18N
120
str.append(indent+"\t"); // NOI18N
121
str.append("<"); // NOI18N
122
s = this.getName();
123         str.append((s==null?"null":s.trim())); // NOI18N
124
str.append(">\n"); // NOI18N
125
this.dumpAttributes(NAME, 0, str, indent);
126
127         str.append(indent);
128         str.append("Parameters"); // NOI18N
129
n = (org.netbeans.modules.schema2beans.BaseBean) this.getParameters();
130         if (n != null)
131             n.dump(str, indent + "\t"); // NOI18N
132
else
133             str.append(indent+"\tnull"); // NOI18N
134
this.dumpAttributes(PARAMETERS, 0, str, indent);
135
136     }
137     public String JavaDoc dumpBeanNode(){
138         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
139         str.append("Check\n"); // NOI18N
140
this.dump(str, "\n "); // NOI18N
141
return str.toString();
142     }}
143
144 // END_NOI18N
145

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

224
Popular Tags