KickJava   Java API By Example, From Geeks To Geeks.

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


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 JmxConnector matches the DTD element jmx-connector
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 JmxConnector 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 SSL = "Ssl";
50     static public final String JavaDoc ELEMENT_PROPERTY = "ElementProperty";
51
52     public JmxConnector() {
53         this(Common.USE_DEFAULT_VALUES);
54     }
55
56     public JmxConnector(int options)
57     {
58         super(comparators, runtimeVersion);
59         // Properties (see root bean comments for the bean graph)
60
initPropertyTables(2);
61         this.createProperty("ssl", SSL,
62             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
63             Ssl.class);
64         this.createAttribute(SSL, "cert-nickname", "CertNickname",
65                         AttrProp.CDATA | AttrProp.REQUIRED,
66                         null, null);
67         this.createAttribute(SSL, "ssl2-enabled", "Ssl2Enabled",
68                         AttrProp.CDATA,
69                         null, "false");
70         this.createAttribute(SSL, "ssl2-ciphers", "Ssl2Ciphers",
71                         AttrProp.CDATA | AttrProp.IMPLIED,
72                         null, null);
73         this.createAttribute(SSL, "ssl3-enabled", "Ssl3Enabled",
74                         AttrProp.CDATA,
75                         null, "true");
76         this.createAttribute(SSL, "ssl3-tls-ciphers", "Ssl3TlsCiphers",
77                         AttrProp.CDATA | AttrProp.IMPLIED,
78                         null, null);
79         this.createAttribute(SSL, "tls-enabled", "TlsEnabled",
80                         AttrProp.CDATA,
81                         null, "true");
82         this.createAttribute(SSL, "tls-rollback-enabled", "TlsRollbackEnabled",
83                         AttrProp.CDATA,
84                         null, "true");
85         this.createAttribute(SSL, "client-auth-enabled", "ClientAuthEnabled",
86                         AttrProp.CDATA,
87                         null, "false");
88         this.createProperty("property", ELEMENT_PROPERTY,
89             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
90             ElementProperty.class);
91         this.createAttribute(ELEMENT_PROPERTY, "name", "Name",
92                         AttrProp.CDATA | AttrProp.REQUIRED,
93                         null, null);
94         this.createAttribute(ELEMENT_PROPERTY, "value", "Value",
95                         AttrProp.CDATA | AttrProp.REQUIRED,
96                         null, null);
97         this.initialize(options);
98     }
99
100     // Setting the default values of the properties
101
void initialize(int options) {
102
103     }
104
105     // This attribute is optional
106
public void setSsl(Ssl value) {
107         this.setValue(SSL, value);
108     }
109
110     // Get Method
111
public Ssl getSsl() {
112         return (Ssl)this.getValue(SSL);
113     }
114
115     // This attribute is an array, possibly empty
116
public void setElementProperty(int index, ElementProperty value) {
117         this.setValue(ELEMENT_PROPERTY, index, value);
118     }
119
120     // Get Method
121
public ElementProperty getElementProperty(int index) {
122         return (ElementProperty)this.getValue(ELEMENT_PROPERTY, index);
123     }
124
125     // This attribute is an array, possibly empty
126
public void setElementProperty(ElementProperty[] value) {
127         this.setValue(ELEMENT_PROPERTY, value);
128     }
129
130     // Getter Method
131
public ElementProperty[] getElementProperty() {
132         return (ElementProperty[])this.getValues(ELEMENT_PROPERTY);
133     }
134
135     // Return the number of properties
136
public int sizeElementProperty() {
137         return this.size(ELEMENT_PROPERTY);
138     }
139
140     // Add a new element returning its index in the list
141
public int addElementProperty(ElementProperty value)
142             throws ConfigException{
143         return addElementProperty(value, true);
144     }
145
146     // Add a new element returning its index in the list with a boolean flag
147
public int addElementProperty(ElementProperty value, boolean overwrite)
148             throws ConfigException{
149         ElementProperty old = getElementPropertyByName(value.getName());
150         if(old != null) {
151             throw new ConfigException(StringManager.getManager(JmxConnector.class).getString("cannotAddDuplicate", "ElementProperty"));
152         }
153         return this.addValue(ELEMENT_PROPERTY, value, overwrite);
154     }
155
156     //
157
// Remove an element using its reference
158
// Returns the index the element had in the list
159
//
160
public int removeElementProperty(ElementProperty value){
161         return this.removeValue(ELEMENT_PROPERTY, value);
162     }
163
164     //
165
// Remove an element using its reference
166
// Returns the index the element had in the list
167
// with boolean overwrite
168
//
169
public int removeElementProperty(ElementProperty value, boolean overwrite)
170             throws StaleWriteConfigException{
171         return this.removeValue(ELEMENT_PROPERTY, value, overwrite);
172     }
173
174     public ElementProperty getElementPropertyByName(String JavaDoc id) {
175      if (null != id) { id = id.trim(); }
176     ElementProperty[] o = getElementProperty();
177      if (o == null) return null;
178
179      for (int i=0; i < o.length; i++) {
180          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
181              return o[i];
182          }
183      }
184
185         return null;
186         
187     }
188     /**
189     * Getter for Name of the Element jmx-connector
190     * @return the Name of the Element jmx-connector
191     */

192     public String JavaDoc getName() {
193         return getAttributeValue(ServerTags.NAME);
194     }
195     /**
196     * Modify the Name of the Element jmx-connector
197     * @param v the new value
198     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
199     */

200     public void setName(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
201         setAttributeValue(ServerTags.NAME, v, overwrite);
202     }
203     /**
204     * Modify the Name of the Element jmx-connector
205     * @param v the new value
206     */

207     public void setName(String JavaDoc v) {
208         setAttributeValue(ServerTags.NAME, v);
209     }
210     /**
211     * Getter for Enabled of the Element jmx-connector
212     * @return the Enabled of the Element jmx-connector
213     */

214     public boolean isEnabled() {
215         return toBoolean(getAttributeValue(ServerTags.ENABLED));
216     }
217     /**
218     * Modify the Enabled of the Element jmx-connector
219     * @param v the new value
220     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
221     */

222     public void setEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
223         setAttributeValue(ServerTags.ENABLED, ""+(v==true), overwrite);
224     }
225     /**
226     * Modify the Enabled of the Element jmx-connector
227     * @param v the new value
228     */

229     public void setEnabled(boolean v) {
230         setAttributeValue(ServerTags.ENABLED, ""+(v==true));
231     }
232     /**
233     * Get the default value of Enabled from dtd
234     */

235     public static String JavaDoc getDefaultEnabled() {
236         return "true".trim();
237     }
238     /**
239     * Getter for Protocol of the Element jmx-connector
240     * @return the Protocol of the Element jmx-connector
241     */

242     public String JavaDoc getProtocol() {
243         return getAttributeValue(ServerTags.PROTOCOL);
244     }
245     /**
246     * Modify the Protocol of the Element jmx-connector
247     * @param v the new value
248     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
249     */

250     public void setProtocol(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
251         setAttributeValue(ServerTags.PROTOCOL, v, overwrite);
252     }
253     /**
254     * Modify the Protocol of the Element jmx-connector
255     * @param v the new value
256     */

257     public void setProtocol(String JavaDoc v) {
258         setAttributeValue(ServerTags.PROTOCOL, v);
259     }
260     /**
261     * Get the default value of Protocol from dtd
262     */

263     public static String JavaDoc getDefaultProtocol() {
264         return "rmi_jrmp".trim();
265     }
266     /**
267     * Getter for Address of the Element jmx-connector
268     * @return the Address of the Element jmx-connector
269     */

270     public String JavaDoc getAddress() {
271         return getAttributeValue(ServerTags.ADDRESS);
272     }
273     /**
274     * Modify the Address of the Element jmx-connector
275     * @param v the new value
276     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
277     */

278     public void setAddress(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
279         setAttributeValue(ServerTags.ADDRESS, v, overwrite);
280     }
281     /**
282     * Modify the Address of the Element jmx-connector
283     * @param v the new value
284     */

285     public void setAddress(String JavaDoc v) {
286         setAttributeValue(ServerTags.ADDRESS, v);
287     }
288     /**
289     * Getter for Port of the Element jmx-connector
290     * @return the Port of the Element jmx-connector
291     */

292     public String JavaDoc getPort() {
293         return getAttributeValue(ServerTags.PORT);
294     }
295     /**
296     * Modify the Port of the Element jmx-connector
297     * @param v the new value
298     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
299     */

300     public void setPort(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
301         setAttributeValue(ServerTags.PORT, v, overwrite);
302     }
303     /**
304     * Modify the Port of the Element jmx-connector
305     * @param v the new value
306     */

307     public void setPort(String JavaDoc v) {
308         setAttributeValue(ServerTags.PORT, v);
309     }
310     /**
311     * Getter for AcceptAll of the Element jmx-connector
312     * @return the AcceptAll of the Element jmx-connector
313     */

314     public boolean isAcceptAll() {
315         return toBoolean(getAttributeValue(ServerTags.ACCEPT_ALL));
316     }
317     /**
318     * Modify the AcceptAll of the Element jmx-connector
319     * @param v the new value
320     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
321     */

322     public void setAcceptAll(boolean v, boolean overwrite) throws StaleWriteConfigException {
323         setAttributeValue(ServerTags.ACCEPT_ALL, ""+(v==true), overwrite);
324     }
325     /**
326     * Modify the AcceptAll of the Element jmx-connector
327     * @param v the new value
328     */

329     public void setAcceptAll(boolean v) {
330         setAttributeValue(ServerTags.ACCEPT_ALL, ""+(v==true));
331     }
332     /**
333     * Get the default value of AcceptAll from dtd
334     */

335     public static String JavaDoc getDefaultAcceptAll() {
336         return "false".trim();
337     }
338     /**
339     * Getter for AuthRealmName of the Element jmx-connector
340     * @return the AuthRealmName of the Element jmx-connector
341     */

342     public String JavaDoc getAuthRealmName() {
343         return getAttributeValue(ServerTags.AUTH_REALM_NAME);
344     }
345     /**
346     * Modify the AuthRealmName of the Element jmx-connector
347     * @param v the new value
348     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
349     */

350     public void setAuthRealmName(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
351         setAttributeValue(ServerTags.AUTH_REALM_NAME, v, overwrite);
352     }
353     /**
354     * Modify the AuthRealmName of the Element jmx-connector
355     * @param v the new value
356     */

357     public void setAuthRealmName(String JavaDoc v) {
358         setAttributeValue(ServerTags.AUTH_REALM_NAME, v);
359     }
360     /**
361     * Getter for SecurityEnabled of the Element jmx-connector
362     * @return the SecurityEnabled of the Element jmx-connector
363     */

364     public boolean isSecurityEnabled() {
365         return toBoolean(getAttributeValue(ServerTags.SECURITY_ENABLED));
366     }
367     /**
368     * Modify the SecurityEnabled of the Element jmx-connector
369     * @param v the new value
370     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
371     */

372     public void setSecurityEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
373         setAttributeValue(ServerTags.SECURITY_ENABLED, ""+(v==true), overwrite);
374     }
375     /**
376     * Modify the SecurityEnabled of the Element jmx-connector
377     * @param v the new value
378     */

379     public void setSecurityEnabled(boolean v) {
380         setAttributeValue(ServerTags.SECURITY_ENABLED, ""+(v==true));
381     }
382     /**
383     * Get the default value of SecurityEnabled from dtd
384     */

385     public static String JavaDoc getDefaultSecurityEnabled() {
386         return "true".trim();
387     }
388     /**
389      * Create a new bean using it's default constructor.
390      * This does not add it to any bean graph.
391      */

392     public Ssl newSsl() {
393         return new Ssl();
394     }
395
396     /**
397      * Create a new bean using it's default constructor.
398      * This does not add it to any bean graph.
399      */

400     public ElementProperty newElementProperty() {
401         return new ElementProperty();
402     }
403
404     /**
405     * get the xpath representation for this element
406     * returns something like abc[@name='value'] or abc
407     * depending on the type of the bean
408     */

409     protected String JavaDoc getRelativeXPath() {
410         String JavaDoc ret = null;
411         ret = "jmx-connector" + (canHaveSiblings() ? "[@name='" + getAttributeValue("name") +"']" : "") ;
412         return (null != ret ? ret.trim() : null);
413     }
414
415     /*
416     * generic method to get default value from dtd
417     */

418     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
419         if(attr == null) return null;
420         attr = attr.trim();
421         if(attr.equals(ServerTags.ENABLED)) return "true".trim();
422         if(attr.equals(ServerTags.PROTOCOL)) return "rmi_jrmp".trim();
423         if(attr.equals(ServerTags.ACCEPT_ALL)) return "false".trim();
424         if(attr.equals(ServerTags.SECURITY_ENABLED)) return "true".trim();
425     return null;
426     }
427     //
428
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
429         comparators.add(c);
430     }
431
432     //
433
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
434         comparators.remove(c);
435     }
436     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
437     }
438
439     // Dump the content of this bean returning it as a String
440
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
441         String JavaDoc s;
442         Object JavaDoc o;
443         org.netbeans.modules.schema2beans.BaseBean n;
444         str.append(indent);
445         str.append("Ssl"); // NOI18N
446
n = (org.netbeans.modules.schema2beans.BaseBean) this.getSsl();
447         if (n != null)
448             n.dump(str, indent + "\t"); // NOI18N
449
else
450             str.append(indent+"\tnull"); // NOI18N
451
this.dumpAttributes(SSL, 0, str, indent);
452
453         str.append(indent);
454         str.append("ElementProperty["+this.sizeElementProperty()+"]"); // NOI18N
455
for(int i=0; i<this.sizeElementProperty(); i++)
456         {
457             str.append(indent+"\t");
458             str.append("#"+i+":");
459             n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i);
460             if (n != null)
461                 n.dump(str, indent + "\t"); // NOI18N
462
else
463                 str.append(indent+"\tnull"); // NOI18N
464
this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent);
465         }
466
467     }
468     public String JavaDoc dumpBeanNode(){
469         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
470         str.append("JmxConnector\n"); // NOI18N
471
this.dump(str, "\n "); // NOI18N
472
return str.toString();
473     }}
474
475 // END_NOI18N
476

477
Popular Tags