KickJava   Java API By Example, From Geeks To Geeks.

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


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 IiopListener matches the DTD element iiop-listener
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 IiopListener 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 IiopListener() {
53         this(Common.USE_DEFAULT_VALUES);
54     }
55
56     public IiopListener(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(IiopListener.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 Id of the Element iiop-listener
190     * @return the Id of the Element iiop-listener
191     */

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

200     public void setId(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
201         setAttributeValue(ServerTags.ID, v, overwrite);
202     }
203     /**
204     * Modify the Id of the Element iiop-listener
205     * @param v the new value
206     */

207     public void setId(String JavaDoc v) {
208         setAttributeValue(ServerTags.ID, v);
209     }
210     /**
211     * Getter for Address of the Element iiop-listener
212     * @return the Address of the Element iiop-listener
213     */

214     public String JavaDoc getAddress() {
215         return getAttributeValue(ServerTags.ADDRESS);
216     }
217     /**
218     * Modify the Address of the Element iiop-listener
219     * @param v the new value
220     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
221     */

222     public void setAddress(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
223         setAttributeValue(ServerTags.ADDRESS, v, overwrite);
224     }
225     /**
226     * Modify the Address of the Element iiop-listener
227     * @param v the new value
228     */

229     public void setAddress(String JavaDoc v) {
230         setAttributeValue(ServerTags.ADDRESS, v);
231     }
232     /**
233     * Getter for Port of the Element iiop-listener
234     * @return the Port of the Element iiop-listener
235     */

236     public String JavaDoc getPort() {
237         return getAttributeValue(ServerTags.PORT);
238     }
239     /**
240     * Modify the Port of the Element iiop-listener
241     * @param v the new value
242     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
243     */

244     public void setPort(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
245         setAttributeValue(ServerTags.PORT, v, overwrite);
246     }
247     /**
248     * Modify the Port of the Element iiop-listener
249     * @param v the new value
250     */

251     public void setPort(String JavaDoc v) {
252         setAttributeValue(ServerTags.PORT, v);
253     }
254     /**
255     * Get the default value of Port from dtd
256     */

257     public static String JavaDoc getDefaultPort() {
258         return "1072".trim();
259     }
260     /**
261     * Getter for SecurityEnabled of the Element iiop-listener
262     * @return the SecurityEnabled of the Element iiop-listener
263     */

264     public boolean isSecurityEnabled() {
265         return toBoolean(getAttributeValue(ServerTags.SECURITY_ENABLED));
266     }
267     /**
268     * Modify the SecurityEnabled of the Element iiop-listener
269     * @param v the new value
270     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
271     */

272     public void setSecurityEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
273         setAttributeValue(ServerTags.SECURITY_ENABLED, ""+(v==true), overwrite);
274     }
275     /**
276     * Modify the SecurityEnabled of the Element iiop-listener
277     * @param v the new value
278     */

279     public void setSecurityEnabled(boolean v) {
280         setAttributeValue(ServerTags.SECURITY_ENABLED, ""+(v==true));
281     }
282     /**
283     * Get the default value of SecurityEnabled from dtd
284     */

285     public static String JavaDoc getDefaultSecurityEnabled() {
286         return "false".trim();
287     }
288     /**
289     * Getter for Enabled of the Element iiop-listener
290     * @return the Enabled of the Element iiop-listener
291     */

292     public boolean isEnabled() {
293         return toBoolean(getAttributeValue(ServerTags.ENABLED));
294     }
295     /**
296     * Modify the Enabled of the Element iiop-listener
297     * @param v the new value
298     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
299     */

300     public void setEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
301         setAttributeValue(ServerTags.ENABLED, ""+(v==true), overwrite);
302     }
303     /**
304     * Modify the Enabled of the Element iiop-listener
305     * @param v the new value
306     */

307     public void setEnabled(boolean v) {
308         setAttributeValue(ServerTags.ENABLED, ""+(v==true));
309     }
310     /**
311     * Get the default value of Enabled from dtd
312     */

313     public static String JavaDoc getDefaultEnabled() {
314         return "true".trim();
315     }
316     /**
317      * Create a new bean using it's default constructor.
318      * This does not add it to any bean graph.
319      */

320     public Ssl newSsl() {
321         return new Ssl();
322     }
323
324     /**
325      * Create a new bean using it's default constructor.
326      * This does not add it to any bean graph.
327      */

328     public ElementProperty newElementProperty() {
329         return new ElementProperty();
330     }
331
332     /**
333     * get the xpath representation for this element
334     * returns something like abc[@name='value'] or abc
335     * depending on the type of the bean
336     */

337     protected String JavaDoc getRelativeXPath() {
338         String JavaDoc ret = null;
339         ret = "iiop-listener" + (canHaveSiblings() ? "[@id='" + getAttributeValue("id") +"']" : "") ;
340         return (null != ret ? ret.trim() : null);
341     }
342
343     /*
344     * generic method to get default value from dtd
345     */

346     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
347         if(attr == null) return null;
348         attr = attr.trim();
349         if(attr.equals(ServerTags.PORT)) return "1072".trim();
350         if(attr.equals(ServerTags.SECURITY_ENABLED)) return "false".trim();
351         if(attr.equals(ServerTags.ENABLED)) return "true".trim();
352     return null;
353     }
354     //
355
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
356         comparators.add(c);
357     }
358
359     //
360
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
361         comparators.remove(c);
362     }
363     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
364     }
365
366     // Dump the content of this bean returning it as a String
367
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
368         String JavaDoc s;
369         Object JavaDoc o;
370         org.netbeans.modules.schema2beans.BaseBean n;
371         str.append(indent);
372         str.append("Ssl"); // NOI18N
373
n = (org.netbeans.modules.schema2beans.BaseBean) this.getSsl();
374         if (n != null)
375             n.dump(str, indent + "\t"); // NOI18N
376
else
377             str.append(indent+"\tnull"); // NOI18N
378
this.dumpAttributes(SSL, 0, str, indent);
379
380         str.append(indent);
381         str.append("ElementProperty["+this.sizeElementProperty()+"]"); // NOI18N
382
for(int i=0; i<this.sizeElementProperty(); i++)
383         {
384             str.append(indent+"\t");
385             str.append("#"+i+":");
386             n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i);
387             if (n != null)
388                 n.dump(str, indent + "\t"); // NOI18N
389
else
390                 str.append(indent+"\tnull"); // NOI18N
391
this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent);
392         }
393
394     }
395     public String JavaDoc dumpBeanNode(){
396         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
397         str.append("IiopListener\n"); // NOI18N
398
this.dump(str, "\n "); // NOI18N
399
return str.toString();
400     }}
401
402 // END_NOI18N
403

404
Popular Tags