KickJava   Java API By Example, From Geeks To Geeks.

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


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 CheckInfo matches the schema element check-info
26  *
27  * Generated on Wed Aug 20 17:20:08 PDT 2003
28  */

29
30 package com.sun.enterprise.tools.common.validation.constraints.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 CheckInfo 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 CLASSNAME = "Classname"; // NOI18N
46
static public final String JavaDoc ARGUMENTS = "Arguments"; // NOI18N
47

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

174
175 /*
176         The following schema file has been used for generation:
177
178 <!--
179   XML DTD for for constraints xml.
180   constraints.xml is used to specify provide information of the
181   Constraints to the Validation framework.
182  
183   $Revision: 1.3 $
184 -->
185
186
187 <!--
188 This is the root element.
189 -->
190 <!ELEMENT constraints (check-info*)>
191
192
193 <!--
194 This represents an information, about a particular Constraint.
195 Provides information of a Constraint represented by corresponding
196 <check> element in validation.xml.
197 Sub element <name> is used to link this element with the
198 corresponding <check> element in validation.xml.
199 -->
200 <!ELEMENT check-info (name, classname, arguments?)>
201
202
203 <!--
204 This element represents information of a Constraint class arguments.
205 Number of sub elements, <argument> should match with the number
206 of <parameter> sub elements, of corresponding <arguments> element
207 in validation.xml
208 -->
209 <!ELEMENT arguments (argument+)>
210
211
212 <!--
213 This element represents information of a single Constraint class
214 argument.
215 Sub elements <name> should match with the <name> sub element of
216 corresponding <parameter> element in constraints.xml
217 -->
218 <!ELEMENT argument (name, type?)>
219
220
221 <!--
222 Used in two elements <check-info> and <argument>
223 In <check-info>, it represents a Constraint name and is the linking
224 element between <check> element in validation.xml and <check-info>
225 element in constraints.xml.
226 In <argument>, it represents argument name and is the linking element
227 between <parameter> element in validation.xml and <argument> element
228 in constraints.xml.
229 -->
230 <!ELEMENT name (#PCDATA)>
231
232
233 <!--
234 This element represents Constraint class name.
235 Constraint class should provide the constructor with no arguments.
236 Constraint class should also provide the set* methods for all the
237 required arguments.
238 Constraint class is always created using default constructor and
239 then the arguments are set using set* methods.
240 -->
241 <!ELEMENT classname (#PCDATA)>
242
243
244 <!--
245 This element represents the type of an argument.
246 If not specified, it defaults to java.lang.String
247 -->
248 <!ELEMENT type (#PCDATA)>
249
250 */

251
Popular Tags