KickJava   Java API By Example, From Geeks To Geeks.

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


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 ModuleMonitoringLevels matches the DTD element module-monitoring-levels
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 ModuleMonitoringLevels 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 ModuleMonitoringLevels() {
52         this(Common.USE_DEFAULT_VALUES);
53     }
54
55     public ModuleMonitoringLevels(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(ModuleMonitoringLevels.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 ThreadPool of the Element module-monitoring-levels
152     * @return the ThreadPool of the Element module-monitoring-levels
153     */

154     public String JavaDoc getThreadPool() {
155         return getAttributeValue(ServerTags.THREAD_POOL);
156     }
157     /**
158     * Modify the ThreadPool of the Element module-monitoring-levels
159     * @param v the new value
160     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
161     */

162     public void setThreadPool(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
163         setAttributeValue(ServerTags.THREAD_POOL, v, overwrite);
164     }
165     /**
166     * Modify the ThreadPool of the Element module-monitoring-levels
167     * @param v the new value
168     */

169     public void setThreadPool(String JavaDoc v) {
170         setAttributeValue(ServerTags.THREAD_POOL, v);
171     }
172     /**
173     * Get the default value of ThreadPool from dtd
174     */

175     public static String JavaDoc getDefaultThreadPool() {
176         return "OFF".trim();
177     }
178     /**
179     * Getter for Orb of the Element module-monitoring-levels
180     * @return the Orb of the Element module-monitoring-levels
181     */

182     public String JavaDoc getOrb() {
183         return getAttributeValue(ServerTags.ORB);
184     }
185     /**
186     * Modify the Orb of the Element module-monitoring-levels
187     * @param v the new value
188     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
189     */

190     public void setOrb(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
191         setAttributeValue(ServerTags.ORB, v, overwrite);
192     }
193     /**
194     * Modify the Orb of the Element module-monitoring-levels
195     * @param v the new value
196     */

197     public void setOrb(String JavaDoc v) {
198         setAttributeValue(ServerTags.ORB, v);
199     }
200     /**
201     * Get the default value of Orb from dtd
202     */

203     public static String JavaDoc getDefaultOrb() {
204         return "OFF".trim();
205     }
206     /**
207     * Getter for EjbContainer of the Element module-monitoring-levels
208     * @return the EjbContainer of the Element module-monitoring-levels
209     */

210     public String JavaDoc getEjbContainer() {
211         return getAttributeValue(ServerTags.EJB_CONTAINER);
212     }
213     /**
214     * Modify the EjbContainer of the Element module-monitoring-levels
215     * @param v the new value
216     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
217     */

218     public void setEjbContainer(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
219         setAttributeValue(ServerTags.EJB_CONTAINER, v, overwrite);
220     }
221     /**
222     * Modify the EjbContainer of the Element module-monitoring-levels
223     * @param v the new value
224     */

225     public void setEjbContainer(String JavaDoc v) {
226         setAttributeValue(ServerTags.EJB_CONTAINER, v);
227     }
228     /**
229     * Get the default value of EjbContainer from dtd
230     */

231     public static String JavaDoc getDefaultEjbContainer() {
232         return "OFF".trim();
233     }
234     /**
235     * Getter for WebContainer of the Element module-monitoring-levels
236     * @return the WebContainer of the Element module-monitoring-levels
237     */

238     public String JavaDoc getWebContainer() {
239         return getAttributeValue(ServerTags.WEB_CONTAINER);
240     }
241     /**
242     * Modify the WebContainer of the Element module-monitoring-levels
243     * @param v the new value
244     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
245     */

246     public void setWebContainer(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
247         setAttributeValue(ServerTags.WEB_CONTAINER, v, overwrite);
248     }
249     /**
250     * Modify the WebContainer of the Element module-monitoring-levels
251     * @param v the new value
252     */

253     public void setWebContainer(String JavaDoc v) {
254         setAttributeValue(ServerTags.WEB_CONTAINER, v);
255     }
256     /**
257     * Get the default value of WebContainer from dtd
258     */

259     public static String JavaDoc getDefaultWebContainer() {
260         return "OFF".trim();
261     }
262     /**
263     * Getter for TransactionService of the Element module-monitoring-levels
264     * @return the TransactionService of the Element module-monitoring-levels
265     */

266     public String JavaDoc getTransactionService() {
267         return getAttributeValue(ServerTags.TRANSACTION_SERVICE);
268     }
269     /**
270     * Modify the TransactionService of the Element module-monitoring-levels
271     * @param v the new value
272     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
273     */

274     public void setTransactionService(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
275         setAttributeValue(ServerTags.TRANSACTION_SERVICE, v, overwrite);
276     }
277     /**
278     * Modify the TransactionService of the Element module-monitoring-levels
279     * @param v the new value
280     */

281     public void setTransactionService(String JavaDoc v) {
282         setAttributeValue(ServerTags.TRANSACTION_SERVICE, v);
283     }
284     /**
285     * Get the default value of TransactionService from dtd
286     */

287     public static String JavaDoc getDefaultTransactionService() {
288         return "OFF".trim();
289     }
290     /**
291     * Getter for HttpService of the Element module-monitoring-levels
292     * @return the HttpService of the Element module-monitoring-levels
293     */

294     public String JavaDoc getHttpService() {
295         return getAttributeValue(ServerTags.HTTP_SERVICE);
296     }
297     /**
298     * Modify the HttpService of the Element module-monitoring-levels
299     * @param v the new value
300     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
301     */

302     public void setHttpService(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
303         setAttributeValue(ServerTags.HTTP_SERVICE, v, overwrite);
304     }
305     /**
306     * Modify the HttpService of the Element module-monitoring-levels
307     * @param v the new value
308     */

309     public void setHttpService(String JavaDoc v) {
310         setAttributeValue(ServerTags.HTTP_SERVICE, v);
311     }
312     /**
313     * Get the default value of HttpService from dtd
314     */

315     public static String JavaDoc getDefaultHttpService() {
316         return "OFF".trim();
317     }
318     /**
319     * Getter for JdbcConnectionPool of the Element module-monitoring-levels
320     * @return the JdbcConnectionPool of the Element module-monitoring-levels
321     */

322     public String JavaDoc getJdbcConnectionPool() {
323         return getAttributeValue(ServerTags.JDBC_CONNECTION_POOL);
324     }
325     /**
326     * Modify the JdbcConnectionPool of the Element module-monitoring-levels
327     * @param v the new value
328     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
329     */

330     public void setJdbcConnectionPool(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
331         setAttributeValue(ServerTags.JDBC_CONNECTION_POOL, v, overwrite);
332     }
333     /**
334     * Modify the JdbcConnectionPool of the Element module-monitoring-levels
335     * @param v the new value
336     */

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

343     public static String JavaDoc getDefaultJdbcConnectionPool() {
344         return "OFF".trim();
345     }
346     /**
347     * Getter for ConnectorConnectionPool of the Element module-monitoring-levels
348     * @return the ConnectorConnectionPool of the Element module-monitoring-levels
349     */

350     public String JavaDoc getConnectorConnectionPool() {
351         return getAttributeValue(ServerTags.CONNECTOR_CONNECTION_POOL);
352     }
353     /**
354     * Modify the ConnectorConnectionPool of the Element module-monitoring-levels
355     * @param v the new value
356     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
357     */

358     public void setConnectorConnectionPool(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
359         setAttributeValue(ServerTags.CONNECTOR_CONNECTION_POOL, v, overwrite);
360     }
361     /**
362     * Modify the ConnectorConnectionPool of the Element module-monitoring-levels
363     * @param v the new value
364     */

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

371     public static String JavaDoc getDefaultConnectorConnectionPool() {
372         return "OFF".trim();
373     }
374     /**
375     * Getter for ConnectorService of the Element module-monitoring-levels
376     * @return the ConnectorService of the Element module-monitoring-levels
377     */

378     public String JavaDoc getConnectorService() {
379         return getAttributeValue(ServerTags.CONNECTOR_SERVICE);
380     }
381     /**
382     * Modify the ConnectorService of the Element module-monitoring-levels
383     * @param v the new value
384     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
385     */

386     public void setConnectorService(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
387         setAttributeValue(ServerTags.CONNECTOR_SERVICE, v, overwrite);
388     }
389     /**
390     * Modify the ConnectorService of the Element module-monitoring-levels
391     * @param v the new value
392     */

393     public void setConnectorService(String JavaDoc v) {
394         setAttributeValue(ServerTags.CONNECTOR_SERVICE, v);
395     }
396     /**
397     * Get the default value of ConnectorService from dtd
398     */

399     public static String JavaDoc getDefaultConnectorService() {
400         return "OFF".trim();
401     }
402     /**
403     * Getter for JmsService of the Element module-monitoring-levels
404     * @return the JmsService of the Element module-monitoring-levels
405     */

406     public String JavaDoc getJmsService() {
407         return getAttributeValue(ServerTags.JMS_SERVICE);
408     }
409     /**
410     * Modify the JmsService of the Element module-monitoring-levels
411     * @param v the new value
412     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
413     */

414     public void setJmsService(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
415         setAttributeValue(ServerTags.JMS_SERVICE, v, overwrite);
416     }
417     /**
418     * Modify the JmsService of the Element module-monitoring-levels
419     * @param v the new value
420     */

421     public void setJmsService(String JavaDoc v) {
422         setAttributeValue(ServerTags.JMS_SERVICE, v);
423     }
424     /**
425     * Get the default value of JmsService from dtd
426     */

427     public static String JavaDoc getDefaultJmsService() {
428         return "OFF".trim();
429     }
430     /**
431     * Getter for Jvm of the Element module-monitoring-levels
432     * @return the Jvm of the Element module-monitoring-levels
433     */

434     public String JavaDoc getJvm() {
435         return getAttributeValue(ServerTags.JVM);
436     }
437     /**
438     * Modify the Jvm of the Element module-monitoring-levels
439     * @param v the new value
440     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
441     */

442     public void setJvm(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
443         setAttributeValue(ServerTags.JVM, v, overwrite);
444     }
445     /**
446     * Modify the Jvm of the Element module-monitoring-levels
447     * @param v the new value
448     */

449     public void setJvm(String JavaDoc v) {
450         setAttributeValue(ServerTags.JVM, v);
451     }
452     /**
453     * Get the default value of Jvm from dtd
454     */

455     public static String JavaDoc getDefaultJvm() {
456         return "OFF".trim();
457     }
458     /**
459      * Create a new bean using it's default constructor.
460      * This does not add it to any bean graph.
461      */

462     public ElementProperty newElementProperty() {
463         return new ElementProperty();
464     }
465
466     /**
467     * get the xpath representation for this element
468     * returns something like abc[@name='value'] or abc
469     * depending on the type of the bean
470     */

471     protected String JavaDoc getRelativeXPath() {
472         String JavaDoc ret = null;
473         ret = "module-monitoring-levels";
474         return (null != ret ? ret.trim() : null);
475     }
476
477     /*
478     * generic method to get default value from dtd
479     */

480     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
481         if(attr == null) return null;
482         attr = attr.trim();
483         if(attr.equals(ServerTags.THREAD_POOL)) return "OFF".trim();
484         if(attr.equals(ServerTags.ORB)) return "OFF".trim();
485         if(attr.equals(ServerTags.EJB_CONTAINER)) return "OFF".trim();
486         if(attr.equals(ServerTags.WEB_CONTAINER)) return "OFF".trim();
487         if(attr.equals(ServerTags.TRANSACTION_SERVICE)) return "OFF".trim();
488         if(attr.equals(ServerTags.HTTP_SERVICE)) return "OFF".trim();
489         if(attr.equals(ServerTags.JDBC_CONNECTION_POOL)) return "OFF".trim();
490         if(attr.equals(ServerTags.CONNECTOR_CONNECTION_POOL)) return "OFF".trim();
491         if(attr.equals(ServerTags.CONNECTOR_SERVICE)) return "OFF".trim();
492         if(attr.equals(ServerTags.JMS_SERVICE)) return "OFF".trim();
493         if(attr.equals(ServerTags.JVM)) return "OFF".trim();
494     return null;
495     }
496     //
497
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
498         comparators.add(c);
499     }
500
501     //
502
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
503         comparators.remove(c);
504     }
505     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
506     }
507
508     // Dump the content of this bean returning it as a String
509
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
510         String JavaDoc s;
511         Object JavaDoc o;
512         org.netbeans.modules.schema2beans.BaseBean n;
513         str.append(indent);
514         str.append("ElementProperty["+this.sizeElementProperty()+"]"); // NOI18N
515
for(int i=0; i<this.sizeElementProperty(); i++)
516         {
517             str.append(indent+"\t");
518             str.append("#"+i+":");
519             n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i);
520             if (n != null)
521                 n.dump(str, indent + "\t"); // NOI18N
522
else
523                 str.append(indent+"\tnull"); // NOI18N
524
this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent);
525         }
526
527     }
528     public String JavaDoc dumpBeanNode(){
529         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
530         str.append("ModuleMonitoringLevels\n"); // NOI18N
531
this.dump(str, "\n "); // NOI18N
532
return str.toString();
533     }}
534
535 // END_NOI18N
536

537
Popular Tags