KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > serverbeans > DiagnosticService


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 DiagnosticService matches the DTD element diagnostic-service
26  *
27  */

28
29 package com.sun.enterprise.config.serverbeans;
30
31 import org.w3c.dom.*;
32 import org.netbeans.modules.schema2beans.*;
33 import java.beans.*;
34 import java.util.*;
35 import java.io.Serializable JavaDoc;
36 import com.sun.enterprise.config.ConfigBean;
37 import com.sun.enterprise.config.ConfigException;
38 import com.sun.enterprise.config.StaleWriteConfigException;
39 import com.sun.enterprise.util.i18n.StringManager;
40
41 // BEGIN_NOI18N
42

43 public class DiagnosticService extends ConfigBean implements Serializable JavaDoc
44 {
45
46     static Vector comparators = new Vector();
47     private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0);
48
49     static public final String JavaDoc ELEMENT_PROPERTY = "ElementProperty";
50
51     public DiagnosticService() {
52         this(Common.USE_DEFAULT_VALUES);
53     }
54
55     public DiagnosticService(int options)
56     {
57         super(comparators, runtimeVersion);
58         // Properties (see root bean comments for the bean graph)
59
initPropertyTables(1);
60         this.createProperty("property", ELEMENT_PROPERTY,
61             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
62             ElementProperty.class);
63         this.createAttribute(ELEMENT_PROPERTY, "name", "Name",
64                         AttrProp.CDATA | AttrProp.REQUIRED,
65                         null, null);
66         this.createAttribute(ELEMENT_PROPERTY, "value", "Value",
67                         AttrProp.CDATA | AttrProp.REQUIRED,
68                         null, null);
69         this.initialize(options);
70     }
71
72     // Setting the default values of the properties
73
void initialize(int options) {
74
75     }
76
77     // This attribute is an array, possibly empty
78
public void setElementProperty(int index, ElementProperty value) {
79         this.setValue(ELEMENT_PROPERTY, index, value);
80     }
81
82     // Get Method
83
public ElementProperty getElementProperty(int index) {
84         return (ElementProperty)this.getValue(ELEMENT_PROPERTY, index);
85     }
86
87     // This attribute is an array, possibly empty
88
public void setElementProperty(ElementProperty[] value) {
89         this.setValue(ELEMENT_PROPERTY, value);
90     }
91
92     // Getter Method
93
public ElementProperty[] getElementProperty() {
94         return (ElementProperty[])this.getValues(ELEMENT_PROPERTY);
95     }
96
97     // Return the number of properties
98
public int sizeElementProperty() {
99         return this.size(ELEMENT_PROPERTY);
100     }
101
102     // Add a new element returning its index in the list
103
public int addElementProperty(ElementProperty value)
104             throws ConfigException{
105         return addElementProperty(value, true);
106     }
107
108     // Add a new element returning its index in the list with a boolean flag
109
public int addElementProperty(ElementProperty value, boolean overwrite)
110             throws ConfigException{
111         ElementProperty old = getElementPropertyByName(value.getName());
112         if(old != null) {
113             throw new ConfigException(StringManager.getManager(DiagnosticService.class).getString("cannotAddDuplicate", "ElementProperty"));
114         }
115         return this.addValue(ELEMENT_PROPERTY, value, overwrite);
116     }
117
118     //
119
// Remove an element using its reference
120
// Returns the index the element had in the list
121
//
122
public int removeElementProperty(ElementProperty value){
123         return this.removeValue(ELEMENT_PROPERTY, value);
124     }
125
126     //
127
// Remove an element using its reference
128
// Returns the index the element had in the list
129
// with boolean overwrite
130
//
131
public int removeElementProperty(ElementProperty value, boolean overwrite)
132             throws StaleWriteConfigException{
133         return this.removeValue(ELEMENT_PROPERTY, value, overwrite);
134     }
135
136     public ElementProperty getElementPropertyByName(String JavaDoc id) {
137      if (null != id) { id = id.trim(); }
138     ElementProperty[] o = getElementProperty();
139      if (o == null) return null;
140
141      for (int i=0; i < o.length; i++) {
142          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
143              return o[i];
144          }
145      }
146
147         return null;
148         
149     }
150     /**
151     * Getter for ComputeChecksum of the Element diagnostic-service
152     * @return the ComputeChecksum of the Element diagnostic-service
153     */

154     public boolean isComputeChecksum() {
155         return toBoolean(getAttributeValue(ServerTags.COMPUTE_CHECKSUM));
156     }
157     /**
158     * Modify the ComputeChecksum of the Element diagnostic-service
159     * @param v the new value
160     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
161     */

162     public void setComputeChecksum(boolean v, boolean overwrite) throws StaleWriteConfigException {
163         setAttributeValue(ServerTags.COMPUTE_CHECKSUM, ""+(v==true), overwrite);
164     }
165     /**
166     * Modify the ComputeChecksum of the Element diagnostic-service
167     * @param v the new value
168     */

169     public void setComputeChecksum(boolean v) {
170         setAttributeValue(ServerTags.COMPUTE_CHECKSUM, ""+(v==true));
171     }
172     /**
173     * Get the default value of ComputeChecksum from dtd
174     */

175     public static String JavaDoc getDefaultComputeChecksum() {
176         return "true".trim();
177     }
178     /**
179     * Getter for VerifyConfig of the Element diagnostic-service
180     * @return the VerifyConfig of the Element diagnostic-service
181     */

182     public boolean isVerifyConfig() {
183         return toBoolean(getAttributeValue(ServerTags.VERIFY_CONFIG));
184     }
185     /**
186     * Modify the VerifyConfig of the Element diagnostic-service
187     * @param v the new value
188     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
189     */

190     public void setVerifyConfig(boolean v, boolean overwrite) throws StaleWriteConfigException {
191         setAttributeValue(ServerTags.VERIFY_CONFIG, ""+(v==true), overwrite);
192     }
193     /**
194     * Modify the VerifyConfig of the Element diagnostic-service
195     * @param v the new value
196     */

197     public void setVerifyConfig(boolean v) {
198         setAttributeValue(ServerTags.VERIFY_CONFIG, ""+(v==true));
199     }
200     /**
201     * Get the default value of VerifyConfig from dtd
202     */

203     public static String JavaDoc getDefaultVerifyConfig() {
204         return "true".trim();
205     }
206     /**
207     * Getter for CaptureInstallLog of the Element diagnostic-service
208     * @return the CaptureInstallLog of the Element diagnostic-service
209     */

210     public boolean isCaptureInstallLog() {
211         return toBoolean(getAttributeValue(ServerTags.CAPTURE_INSTALL_LOG));
212     }
213     /**
214     * Modify the CaptureInstallLog of the Element diagnostic-service
215     * @param v the new value
216     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
217     */

218     public void setCaptureInstallLog(boolean v, boolean overwrite) throws StaleWriteConfigException {
219         setAttributeValue(ServerTags.CAPTURE_INSTALL_LOG, ""+(v==true), overwrite);
220     }
221     /**
222     * Modify the CaptureInstallLog of the Element diagnostic-service
223     * @param v the new value
224     */

225     public void setCaptureInstallLog(boolean v) {
226         setAttributeValue(ServerTags.CAPTURE_INSTALL_LOG, ""+(v==true));
227     }
228     /**
229     * Get the default value of CaptureInstallLog from dtd
230     */

231     public static String JavaDoc getDefaultCaptureInstallLog() {
232         return "true".trim();
233     }
234     /**
235     * Getter for CaptureSystemInfo of the Element diagnostic-service
236     * @return the CaptureSystemInfo of the Element diagnostic-service
237     */

238     public boolean isCaptureSystemInfo() {
239         return toBoolean(getAttributeValue(ServerTags.CAPTURE_SYSTEM_INFO));
240     }
241     /**
242     * Modify the CaptureSystemInfo of the Element diagnostic-service
243     * @param v the new value
244     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
245     */

246     public void setCaptureSystemInfo(boolean v, boolean overwrite) throws StaleWriteConfigException {
247         setAttributeValue(ServerTags.CAPTURE_SYSTEM_INFO, ""+(v==true), overwrite);
248     }
249     /**
250     * Modify the CaptureSystemInfo of the Element diagnostic-service
251     * @param v the new value
252     */

253     public void setCaptureSystemInfo(boolean v) {
254         setAttributeValue(ServerTags.CAPTURE_SYSTEM_INFO, ""+(v==true));
255     }
256     /**
257     * Get the default value of CaptureSystemInfo from dtd
258     */

259     public static String JavaDoc getDefaultCaptureSystemInfo() {
260         return "true".trim();
261     }
262     /**
263     * Getter for CaptureHadbInfo of the Element diagnostic-service
264     * @return the CaptureHadbInfo of the Element diagnostic-service
265     */

266     public boolean isCaptureHadbInfo() {
267         return toBoolean(getAttributeValue(ServerTags.CAPTURE_HADB_INFO));
268     }
269     /**
270     * Modify the CaptureHadbInfo of the Element diagnostic-service
271     * @param v the new value
272     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
273     */

274     public void setCaptureHadbInfo(boolean v, boolean overwrite) throws StaleWriteConfigException {
275         setAttributeValue(ServerTags.CAPTURE_HADB_INFO, ""+(v==true), overwrite);
276     }
277     /**
278     * Modify the CaptureHadbInfo of the Element diagnostic-service
279     * @param v the new value
280     */

281     public void setCaptureHadbInfo(boolean v) {
282         setAttributeValue(ServerTags.CAPTURE_HADB_INFO, ""+(v==true));
283     }
284     /**
285     * Get the default value of CaptureHadbInfo from dtd
286     */

287     public static String JavaDoc getDefaultCaptureHadbInfo() {
288         return "true".trim();
289     }
290     /**
291     * Getter for CaptureAppDd of the Element diagnostic-service
292     * @return the CaptureAppDd of the Element diagnostic-service
293     */

294     public boolean isCaptureAppDd() {
295         return toBoolean(getAttributeValue(ServerTags.CAPTURE_APP_DD));
296     }
297     /**
298     * Modify the CaptureAppDd of the Element diagnostic-service
299     * @param v the new value
300     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
301     */

302     public void setCaptureAppDd(boolean v, boolean overwrite) throws StaleWriteConfigException {
303         setAttributeValue(ServerTags.CAPTURE_APP_DD, ""+(v==true), overwrite);
304     }
305     /**
306     * Modify the CaptureAppDd of the Element diagnostic-service
307     * @param v the new value
308     */

309     public void setCaptureAppDd(boolean v) {
310         setAttributeValue(ServerTags.CAPTURE_APP_DD, ""+(v==true));
311     }
312     /**
313     * Get the default value of CaptureAppDd from dtd
314     */

315     public static String JavaDoc getDefaultCaptureAppDd() {
316         return "true".trim();
317     }
318     /**
319     * Getter for MinLogLevel of the Element diagnostic-service
320     * @return the MinLogLevel of the Element diagnostic-service
321     */

322     public String JavaDoc getMinLogLevel() {
323         return getAttributeValue(ServerTags.MIN_LOG_LEVEL);
324     }
325     /**
326     * Modify the MinLogLevel of the Element diagnostic-service
327     * @param v the new value
328     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
329     */

330     public void setMinLogLevel(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
331         setAttributeValue(ServerTags.MIN_LOG_LEVEL, v, overwrite);
332     }
333     /**
334     * Modify the MinLogLevel of the Element diagnostic-service
335     * @param v the new value
336     */

337     public void setMinLogLevel(String JavaDoc v) {
338         setAttributeValue(ServerTags.MIN_LOG_LEVEL, v);
339     }
340     /**
341     * Get the default value of MinLogLevel from dtd
342     */

343     public static String JavaDoc getDefaultMinLogLevel() {
344         return "INFO".trim();
345     }
346     /**
347     * Getter for MaxLogEntries of the Element diagnostic-service
348     * @return the MaxLogEntries of the Element diagnostic-service
349     */

350     public String JavaDoc getMaxLogEntries() {
351         return getAttributeValue(ServerTags.MAX_LOG_ENTRIES);
352     }
353     /**
354     * Modify the MaxLogEntries of the Element diagnostic-service
355     * @param v the new value
356     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
357     */

358     public void setMaxLogEntries(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
359         setAttributeValue(ServerTags.MAX_LOG_ENTRIES, v, overwrite);
360     }
361     /**
362     * Modify the MaxLogEntries of the Element diagnostic-service
363     * @param v the new value
364     */

365     public void setMaxLogEntries(String JavaDoc v) {
366         setAttributeValue(ServerTags.MAX_LOG_ENTRIES, v);
367     }
368     /**
369     * Get the default value of MaxLogEntries from dtd
370     */

371     public static String JavaDoc getDefaultMaxLogEntries() {
372         return "500".trim();
373     }
374     /**
375      * Create a new bean using it's default constructor.
376      * This does not add it to any bean graph.
377      */

378     public ElementProperty newElementProperty() {
379         return new ElementProperty();
380     }
381
382     /**
383     * get the xpath representation for this element
384     * returns something like abc[@name='value'] or abc
385     * depending on the type of the bean
386     */

387     protected String JavaDoc getRelativeXPath() {
388         String JavaDoc ret = null;
389         ret = "diagnostic-service";
390         return (null != ret ? ret.trim() : null);
391     }
392
393     /*
394     * generic method to get default value from dtd
395     */

396     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
397         if(attr == null) return null;
398         attr = attr.trim();
399         if(attr.equals(ServerTags.COMPUTE_CHECKSUM)) return "true".trim();
400         if(attr.equals(ServerTags.VERIFY_CONFIG)) return "true".trim();
401         if(attr.equals(ServerTags.CAPTURE_INSTALL_LOG)) return "true".trim();
402         if(attr.equals(ServerTags.CAPTURE_SYSTEM_INFO)) return "true".trim();
403         if(attr.equals(ServerTags.CAPTURE_HADB_INFO)) return "true".trim();
404         if(attr.equals(ServerTags.CAPTURE_APP_DD)) return "true".trim();
405         if(attr.equals(ServerTags.MIN_LOG_LEVEL)) return "INFO".trim();
406         if(attr.equals(ServerTags.MAX_LOG_ENTRIES)) return "500".trim();
407     return null;
408     }
409     //
410
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
411         comparators.add(c);
412     }
413
414     //
415
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
416         comparators.remove(c);
417     }
418     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
419     }
420
421     // Dump the content of this bean returning it as a String
422
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
423         String JavaDoc s;
424         Object JavaDoc o;
425         org.netbeans.modules.schema2beans.BaseBean n;
426         str.append(indent);
427         str.append("ElementProperty["+this.sizeElementProperty()+"]"); // NOI18N
428
for(int i=0; i<this.sizeElementProperty(); i++)
429         {
430             str.append(indent+"\t");
431             str.append("#"+i+":");
432             n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i);
433             if (n != null)
434                 n.dump(str, indent + "\t"); // NOI18N
435
else
436                 str.append(indent+"\tnull"); // NOI18N
437
this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent);
438         }
439
440     }
441     public String JavaDoc dumpBeanNode(){
442         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
443         str.append("DiagnosticService\n"); // NOI18N
444
this.dump(str, "\n "); // NOI18N
445
return str.toString();
446     }}
447
448 // END_NOI18N
449

450
Popular Tags