KickJava   Java API By Example, From Geeks To Geeks.

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


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 MonitoringService matches the DTD element monitoring-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 MonitoringService 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 MODULE_MONITORING_LEVELS = "ModuleMonitoringLevels";
50     static public final String JavaDoc ELEMENT_PROPERTY = "ElementProperty";
51
52     public MonitoringService() {
53         this(Common.USE_DEFAULT_VALUES);
54     }
55
56     public MonitoringService(int options)
57     {
58         super(comparators, runtimeVersion);
59         // Properties (see root bean comments for the bean graph)
60
initPropertyTables(2);
61         this.createProperty("module-monitoring-levels", MODULE_MONITORING_LEVELS,
62             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
63             ModuleMonitoringLevels.class);
64         this.createAttribute(MODULE_MONITORING_LEVELS, "thread-pool", "ThreadPool",
65                         AttrProp.CDATA,
66                         null, "OFF");
67         this.createAttribute(MODULE_MONITORING_LEVELS, "orb", "Orb",
68                         AttrProp.CDATA,
69                         null, "OFF");
70         this.createAttribute(MODULE_MONITORING_LEVELS, "ejb-container", "EjbContainer",
71                         AttrProp.CDATA,
72                         null, "OFF");
73         this.createAttribute(MODULE_MONITORING_LEVELS, "web-container", "WebContainer",
74                         AttrProp.CDATA,
75                         null, "OFF");
76         this.createAttribute(MODULE_MONITORING_LEVELS, "transaction-service", "TransactionService",
77                         AttrProp.CDATA,
78                         null, "OFF");
79         this.createAttribute(MODULE_MONITORING_LEVELS, "http-service", "HttpService",
80                         AttrProp.CDATA,
81                         null, "OFF");
82         this.createAttribute(MODULE_MONITORING_LEVELS, "jdbc-connection-pool", "JdbcConnectionPool",
83                         AttrProp.CDATA,
84                         null, "OFF");
85         this.createAttribute(MODULE_MONITORING_LEVELS, "connector-connection-pool", "ConnectorConnectionPool",
86                         AttrProp.CDATA,
87                         null, "OFF");
88         this.createAttribute(MODULE_MONITORING_LEVELS, "connector-service", "ConnectorService",
89                         AttrProp.CDATA,
90                         null, "OFF");
91         this.createAttribute(MODULE_MONITORING_LEVELS, "jms-service", "JmsService",
92                         AttrProp.CDATA,
93                         null, "OFF");
94         this.createAttribute(MODULE_MONITORING_LEVELS, "jvm", "Jvm",
95                         AttrProp.CDATA,
96                         null, "OFF");
97         this.createProperty("property", ELEMENT_PROPERTY,
98             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
99             ElementProperty.class);
100         this.createAttribute(ELEMENT_PROPERTY, "name", "Name",
101                         AttrProp.CDATA | AttrProp.REQUIRED,
102                         null, null);
103         this.createAttribute(ELEMENT_PROPERTY, "value", "Value",
104                         AttrProp.CDATA | AttrProp.REQUIRED,
105                         null, null);
106         this.initialize(options);
107     }
108
109     // Setting the default values of the properties
110
void initialize(int options) {
111
112     }
113
114     // This attribute is optional
115
public void setModuleMonitoringLevels(ModuleMonitoringLevels value) {
116         this.setValue(MODULE_MONITORING_LEVELS, value);
117     }
118
119     // Get Method
120
public ModuleMonitoringLevels getModuleMonitoringLevels() {
121         return (ModuleMonitoringLevels)this.getValue(MODULE_MONITORING_LEVELS);
122     }
123
124     // This attribute is an array, possibly empty
125
public void setElementProperty(int index, ElementProperty value) {
126         this.setValue(ELEMENT_PROPERTY, index, value);
127     }
128
129     // Get Method
130
public ElementProperty getElementProperty(int index) {
131         return (ElementProperty)this.getValue(ELEMENT_PROPERTY, index);
132     }
133
134     // This attribute is an array, possibly empty
135
public void setElementProperty(ElementProperty[] value) {
136         this.setValue(ELEMENT_PROPERTY, value);
137     }
138
139     // Getter Method
140
public ElementProperty[] getElementProperty() {
141         return (ElementProperty[])this.getValues(ELEMENT_PROPERTY);
142     }
143
144     // Return the number of properties
145
public int sizeElementProperty() {
146         return this.size(ELEMENT_PROPERTY);
147     }
148
149     // Add a new element returning its index in the list
150
public int addElementProperty(ElementProperty value)
151             throws ConfigException{
152         return addElementProperty(value, true);
153     }
154
155     // Add a new element returning its index in the list with a boolean flag
156
public int addElementProperty(ElementProperty value, boolean overwrite)
157             throws ConfigException{
158         ElementProperty old = getElementPropertyByName(value.getName());
159         if(old != null) {
160             throw new ConfigException(StringManager.getManager(MonitoringService.class).getString("cannotAddDuplicate", "ElementProperty"));
161         }
162         return this.addValue(ELEMENT_PROPERTY, value, overwrite);
163     }
164
165     //
166
// Remove an element using its reference
167
// Returns the index the element had in the list
168
//
169
public int removeElementProperty(ElementProperty value){
170         return this.removeValue(ELEMENT_PROPERTY, value);
171     }
172
173     //
174
// Remove an element using its reference
175
// Returns the index the element had in the list
176
// with boolean overwrite
177
//
178
public int removeElementProperty(ElementProperty value, boolean overwrite)
179             throws StaleWriteConfigException{
180         return this.removeValue(ELEMENT_PROPERTY, value, overwrite);
181     }
182
183     public ElementProperty getElementPropertyByName(String JavaDoc id) {
184      if (null != id) { id = id.trim(); }
185     ElementProperty[] o = getElementProperty();
186      if (o == null) return null;
187
188      for (int i=0; i < o.length; i++) {
189          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
190              return o[i];
191          }
192      }
193
194         return null;
195         
196     }
197     /**
198      * Create a new bean using it's default constructor.
199      * This does not add it to any bean graph.
200      */

201     public ModuleMonitoringLevels newModuleMonitoringLevels() {
202         return new ModuleMonitoringLevels();
203     }
204
205     /**
206      * Create a new bean using it's default constructor.
207      * This does not add it to any bean graph.
208      */

209     public ElementProperty newElementProperty() {
210         return new ElementProperty();
211     }
212
213     /**
214     * get the xpath representation for this element
215     * returns something like abc[@name='value'] or abc
216     * depending on the type of the bean
217     */

218     protected String JavaDoc getRelativeXPath() {
219         String JavaDoc ret = null;
220         ret = "monitoring-service";
221         return (null != ret ? ret.trim() : null);
222     }
223
224     /*
225     * generic method to get default value from dtd
226     */

227     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
228         if(attr == null) return null;
229         attr = attr.trim();
230     return null;
231     }
232     //
233
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
234         comparators.add(c);
235     }
236
237     //
238
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
239         comparators.remove(c);
240     }
241     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
242     }
243
244     // Dump the content of this bean returning it as a String
245
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
246         String JavaDoc s;
247         Object JavaDoc o;
248         org.netbeans.modules.schema2beans.BaseBean n;
249         str.append(indent);
250         str.append("ModuleMonitoringLevels"); // NOI18N
251
n = (org.netbeans.modules.schema2beans.BaseBean) this.getModuleMonitoringLevels();
252         if (n != null)
253             n.dump(str, indent + "\t"); // NOI18N
254
else
255             str.append(indent+"\tnull"); // NOI18N
256
this.dumpAttributes(MODULE_MONITORING_LEVELS, 0, str, indent);
257
258         str.append(indent);
259         str.append("ElementProperty["+this.sizeElementProperty()+"]"); // NOI18N
260
for(int i=0; i<this.sizeElementProperty(); i++)
261         {
262             str.append(indent+"\t");
263             str.append("#"+i+":");
264             n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i);
265             if (n != null)
266                 n.dump(str, indent + "\t"); // NOI18N
267
else
268                 str.append(indent+"\tnull"); // NOI18N
269
this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent);
270         }
271
272     }
273     public String JavaDoc dumpBeanNode(){
274         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
275         str.append("MonitoringService\n"); // NOI18N
276
this.dump(str, "\n "); // NOI18N
277
return str.toString();
278     }}
279
280 // END_NOI18N
281

282
Popular Tags