KickJava   Java API By Example, From Geeks To Geeks.

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


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 AvailabilityService matches the DTD element availability-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 AvailabilityService 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 WEB_CONTAINER_AVAILABILITY = "WebContainerAvailability";
50     static public final String JavaDoc EJB_CONTAINER_AVAILABILITY = "EjbContainerAvailability";
51     static public final String JavaDoc JMS_AVAILABILITY = "JmsAvailability";
52     static public final String JavaDoc ELEMENT_PROPERTY = "ElementProperty";
53
54     public AvailabilityService() {
55         this(Common.USE_DEFAULT_VALUES);
56     }
57
58     public AvailabilityService(int options)
59     {
60         super(comparators, runtimeVersion);
61         // Properties (see root bean comments for the bean graph)
62
initPropertyTables(4);
63         this.createProperty("web-container-availability", WEB_CONTAINER_AVAILABILITY,
64             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
65             WebContainerAvailability.class);
66         this.createAttribute(WEB_CONTAINER_AVAILABILITY, "availability-enabled", "AvailabilityEnabled",
67                         AttrProp.CDATA | AttrProp.IMPLIED,
68                         null, null);
69         this.createAttribute(WEB_CONTAINER_AVAILABILITY, "persistence-type", "PersistenceType",
70                         AttrProp.CDATA,
71                         null, "memory");
72         this.createAttribute(WEB_CONTAINER_AVAILABILITY, "persistence-frequency", "PersistenceFrequency",
73                         AttrProp.CDATA | AttrProp.IMPLIED,
74                         null, null);
75         this.createAttribute(WEB_CONTAINER_AVAILABILITY, "persistence-scope", "PersistenceScope",
76                         AttrProp.CDATA | AttrProp.IMPLIED,
77                         null, null);
78         this.createAttribute(WEB_CONTAINER_AVAILABILITY, "persistence-store-health-check-enabled", "PersistenceStoreHealthCheckEnabled",
79                         AttrProp.CDATA,
80                         null, "false");
81         this.createAttribute(WEB_CONTAINER_AVAILABILITY, "sso-failover-enabled", "SsoFailoverEnabled",
82                         AttrProp.CDATA,
83                         null, "false");
84         this.createAttribute(WEB_CONTAINER_AVAILABILITY, "http-session-store-pool-name", "HttpSessionStorePoolName",
85                         AttrProp.CDATA | AttrProp.IMPLIED,
86                         null, null);
87         this.createProperty("ejb-container-availability", EJB_CONTAINER_AVAILABILITY,
88             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
89             EjbContainerAvailability.class);
90         this.createAttribute(EJB_CONTAINER_AVAILABILITY, "availability-enabled", "AvailabilityEnabled",
91                         AttrProp.CDATA | AttrProp.IMPLIED,
92                         null, null);
93         this.createAttribute(EJB_CONTAINER_AVAILABILITY, "sfsb-ha-persistence-type", "SfsbHaPersistenceType",
94                         AttrProp.CDATA,
95                         null, "ha");
96         this.createAttribute(EJB_CONTAINER_AVAILABILITY, "sfsb-persistence-type", "SfsbPersistenceType",
97                         AttrProp.CDATA,
98                         null, "file");
99         this.createAttribute(EJB_CONTAINER_AVAILABILITY, "sfsb-checkpoint-enabled", "SfsbCheckpointEnabled",
100                         AttrProp.CDATA | AttrProp.IMPLIED,
101                         null, null);
102         this.createAttribute(EJB_CONTAINER_AVAILABILITY, "sfsb-quick-checkpoint-enabled", "SfsbQuickCheckpointEnabled",
103                         AttrProp.CDATA | AttrProp.IMPLIED,
104                         null, null);
105         this.createAttribute(EJB_CONTAINER_AVAILABILITY, "sfsb-store-pool-name", "SfsbStorePoolName",
106                         AttrProp.CDATA | AttrProp.IMPLIED,
107                         null, null);
108         this.createProperty("jms-availability", JMS_AVAILABILITY,
109             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
110             JmsAvailability.class);
111         this.createAttribute(JMS_AVAILABILITY, "availability-enabled", "AvailabilityEnabled",
112                         AttrProp.CDATA,
113                         null, "false");
114         this.createAttribute(JMS_AVAILABILITY, "mq-store-pool-name", "MqStorePoolName",
115                         AttrProp.CDATA | AttrProp.IMPLIED,
116                         null, null);
117         this.createProperty("property", ELEMENT_PROPERTY,
118             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
119             ElementProperty.class);
120         this.createAttribute(ELEMENT_PROPERTY, "name", "Name",
121                         AttrProp.CDATA | AttrProp.REQUIRED,
122                         null, null);
123         this.createAttribute(ELEMENT_PROPERTY, "value", "Value",
124                         AttrProp.CDATA | AttrProp.REQUIRED,
125                         null, null);
126         this.initialize(options);
127     }
128
129     // Setting the default values of the properties
130
void initialize(int options) {
131
132     }
133
134     // This attribute is optional
135
public void setWebContainerAvailability(WebContainerAvailability value) {
136         this.setValue(WEB_CONTAINER_AVAILABILITY, value);
137     }
138
139     // Get Method
140
public WebContainerAvailability getWebContainerAvailability() {
141         return (WebContainerAvailability)this.getValue(WEB_CONTAINER_AVAILABILITY);
142     }
143
144     // This attribute is optional
145
public void setEjbContainerAvailability(EjbContainerAvailability value) {
146         this.setValue(EJB_CONTAINER_AVAILABILITY, value);
147     }
148
149     // Get Method
150
public EjbContainerAvailability getEjbContainerAvailability() {
151         return (EjbContainerAvailability)this.getValue(EJB_CONTAINER_AVAILABILITY);
152     }
153
154     // This attribute is optional
155
public void setJmsAvailability(JmsAvailability value) {
156         this.setValue(JMS_AVAILABILITY, value);
157     }
158
159     // Get Method
160
public JmsAvailability getJmsAvailability() {
161         return (JmsAvailability)this.getValue(JMS_AVAILABILITY);
162     }
163
164     // This attribute is an array, possibly empty
165
public void setElementProperty(int index, ElementProperty value) {
166         this.setValue(ELEMENT_PROPERTY, index, value);
167     }
168
169     // Get Method
170
public ElementProperty getElementProperty(int index) {
171         return (ElementProperty)this.getValue(ELEMENT_PROPERTY, index);
172     }
173
174     // This attribute is an array, possibly empty
175
public void setElementProperty(ElementProperty[] value) {
176         this.setValue(ELEMENT_PROPERTY, value);
177     }
178
179     // Getter Method
180
public ElementProperty[] getElementProperty() {
181         return (ElementProperty[])this.getValues(ELEMENT_PROPERTY);
182     }
183
184     // Return the number of properties
185
public int sizeElementProperty() {
186         return this.size(ELEMENT_PROPERTY);
187     }
188
189     // Add a new element returning its index in the list
190
public int addElementProperty(ElementProperty value)
191             throws ConfigException{
192         return addElementProperty(value, true);
193     }
194
195     // Add a new element returning its index in the list with a boolean flag
196
public int addElementProperty(ElementProperty value, boolean overwrite)
197             throws ConfigException{
198         ElementProperty old = getElementPropertyByName(value.getName());
199         if(old != null) {
200             throw new ConfigException(StringManager.getManager(AvailabilityService.class).getString("cannotAddDuplicate", "ElementProperty"));
201         }
202         return this.addValue(ELEMENT_PROPERTY, value, overwrite);
203     }
204
205     //
206
// Remove an element using its reference
207
// Returns the index the element had in the list
208
//
209
public int removeElementProperty(ElementProperty value){
210         return this.removeValue(ELEMENT_PROPERTY, value);
211     }
212
213     //
214
// Remove an element using its reference
215
// Returns the index the element had in the list
216
// with boolean overwrite
217
//
218
public int removeElementProperty(ElementProperty value, boolean overwrite)
219             throws StaleWriteConfigException{
220         return this.removeValue(ELEMENT_PROPERTY, value, overwrite);
221     }
222
223     public ElementProperty getElementPropertyByName(String JavaDoc id) {
224      if (null != id) { id = id.trim(); }
225     ElementProperty[] o = getElementProperty();
226      if (o == null) return null;
227
228      for (int i=0; i < o.length; i++) {
229          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
230              return o[i];
231          }
232      }
233
234         return null;
235         
236     }
237     /**
238     * Getter for AvailabilityEnabled of the Element availability-service
239     * @return the AvailabilityEnabled of the Element availability-service
240     */

241     public boolean isAvailabilityEnabled() {
242         return toBoolean(getAttributeValue(ServerTags.AVAILABILITY_ENABLED));
243     }
244     /**
245     * Modify the AvailabilityEnabled of the Element availability-service
246     * @param v the new value
247     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
248     */

249     public void setAvailabilityEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
250         setAttributeValue(ServerTags.AVAILABILITY_ENABLED, ""+(v==true), overwrite);
251     }
252     /**
253     * Modify the AvailabilityEnabled of the Element availability-service
254     * @param v the new value
255     */

256     public void setAvailabilityEnabled(boolean v) {
257         setAttributeValue(ServerTags.AVAILABILITY_ENABLED, ""+(v==true));
258     }
259     /**
260     * Get the default value of AvailabilityEnabled from dtd
261     */

262     public static String JavaDoc getDefaultAvailabilityEnabled() {
263         return "true".trim();
264     }
265     /**
266     * Getter for HaAgentHosts of the Element availability-service
267     * @return the HaAgentHosts of the Element availability-service
268     */

269     public String JavaDoc getHaAgentHosts() {
270             return getAttributeValue(ServerTags.HA_AGENT_HOSTS);
271     }
272     /**
273     * Modify the HaAgentHosts of the Element availability-service
274     * @param v the new value
275     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
276     */

277     public void setHaAgentHosts(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
278         setAttributeValue(ServerTags.HA_AGENT_HOSTS, v, overwrite);
279     }
280     /**
281     * Modify the HaAgentHosts of the Element availability-service
282     * @param v the new value
283     */

284     public void setHaAgentHosts(String JavaDoc v) {
285         setAttributeValue(ServerTags.HA_AGENT_HOSTS, v);
286     }
287     /**
288     * Getter for HaAgentPort of the Element availability-service
289     * @return the HaAgentPort of the Element availability-service
290     */

291     public String JavaDoc getHaAgentPort() {
292             return getAttributeValue(ServerTags.HA_AGENT_PORT);
293     }
294     /**
295     * Modify the HaAgentPort of the Element availability-service
296     * @param v the new value
297     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
298     */

299     public void setHaAgentPort(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
300         setAttributeValue(ServerTags.HA_AGENT_PORT, v, overwrite);
301     }
302     /**
303     * Modify the HaAgentPort of the Element availability-service
304     * @param v the new value
305     */

306     public void setHaAgentPort(String JavaDoc v) {
307         setAttributeValue(ServerTags.HA_AGENT_PORT, v);
308     }
309     /**
310     * Getter for HaAgentPassword of the Element availability-service
311     * @return the HaAgentPassword of the Element availability-service
312     */

313     public String JavaDoc getHaAgentPassword() {
314             return getAttributeValue(ServerTags.HA_AGENT_PASSWORD);
315     }
316     /**
317     * Modify the HaAgentPassword of the Element availability-service
318     * @param v the new value
319     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
320     */

321     public void setHaAgentPassword(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
322         setAttributeValue(ServerTags.HA_AGENT_PASSWORD, v, overwrite);
323     }
324     /**
325     * Modify the HaAgentPassword of the Element availability-service
326     * @param v the new value
327     */

328     public void setHaAgentPassword(String JavaDoc v) {
329         setAttributeValue(ServerTags.HA_AGENT_PASSWORD, v);
330     }
331     /**
332     * Getter for HaStoreName of the Element availability-service
333     * @return the HaStoreName of the Element availability-service
334     */

335     public String JavaDoc getHaStoreName() {
336             return getAttributeValue(ServerTags.HA_STORE_NAME);
337     }
338     /**
339     * Modify the HaStoreName of the Element availability-service
340     * @param v the new value
341     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
342     */

343     public void setHaStoreName(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
344         setAttributeValue(ServerTags.HA_STORE_NAME, v, overwrite);
345     }
346     /**
347     * Modify the HaStoreName of the Element availability-service
348     * @param v the new value
349     */

350     public void setHaStoreName(String JavaDoc v) {
351         setAttributeValue(ServerTags.HA_STORE_NAME, v);
352     }
353     /**
354     * Getter for AutoManageHaStore of the Element availability-service
355     * @return the AutoManageHaStore of the Element availability-service
356     */

357     public boolean isAutoManageHaStore() {
358         return toBoolean(getAttributeValue(ServerTags.AUTO_MANAGE_HA_STORE));
359     }
360     /**
361     * Modify the AutoManageHaStore of the Element availability-service
362     * @param v the new value
363     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
364     */

365     public void setAutoManageHaStore(boolean v, boolean overwrite) throws StaleWriteConfigException {
366         setAttributeValue(ServerTags.AUTO_MANAGE_HA_STORE, ""+(v==true), overwrite);
367     }
368     /**
369     * Modify the AutoManageHaStore of the Element availability-service
370     * @param v the new value
371     */

372     public void setAutoManageHaStore(boolean v) {
373         setAttributeValue(ServerTags.AUTO_MANAGE_HA_STORE, ""+(v==true));
374     }
375     /**
376     * Get the default value of AutoManageHaStore from dtd
377     */

378     public static String JavaDoc getDefaultAutoManageHaStore() {
379         return "false".trim();
380     }
381     /**
382     * Getter for StorePoolName of the Element availability-service
383     * @return the StorePoolName of the Element availability-service
384     */

385     public String JavaDoc getStorePoolName() {
386             return getAttributeValue(ServerTags.STORE_POOL_NAME);
387     }
388     /**
389     * Modify the StorePoolName of the Element availability-service
390     * @param v the new value
391     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
392     */

393     public void setStorePoolName(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
394         setAttributeValue(ServerTags.STORE_POOL_NAME, v, overwrite);
395     }
396     /**
397     * Modify the StorePoolName of the Element availability-service
398     * @param v the new value
399     */

400     public void setStorePoolName(String JavaDoc v) {
401         setAttributeValue(ServerTags.STORE_POOL_NAME, v);
402     }
403     /**
404     * Getter for HaStoreHealthcheckEnabled of the Element availability-service
405     * @return the HaStoreHealthcheckEnabled of the Element availability-service
406     */

407     public boolean isHaStoreHealthcheckEnabled() {
408         return toBoolean(getAttributeValue(ServerTags.HA_STORE_HEALTHCHECK_ENABLED));
409     }
410     /**
411     * Modify the HaStoreHealthcheckEnabled of the Element availability-service
412     * @param v the new value
413     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
414     */

415     public void setHaStoreHealthcheckEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
416         setAttributeValue(ServerTags.HA_STORE_HEALTHCHECK_ENABLED, ""+(v==true), overwrite);
417     }
418     /**
419     * Modify the HaStoreHealthcheckEnabled of the Element availability-service
420     * @param v the new value
421     */

422     public void setHaStoreHealthcheckEnabled(boolean v) {
423         setAttributeValue(ServerTags.HA_STORE_HEALTHCHECK_ENABLED, ""+(v==true));
424     }
425     /**
426     * Get the default value of HaStoreHealthcheckEnabled from dtd
427     */

428     public static String JavaDoc getDefaultHaStoreHealthcheckEnabled() {
429         return "false".trim();
430     }
431     /**
432     * Getter for HaStoreHealthcheckIntervalInSeconds of the Element availability-service
433     * @return the HaStoreHealthcheckIntervalInSeconds of the Element availability-service
434     */

435     public String JavaDoc getHaStoreHealthcheckIntervalInSeconds() {
436         return getAttributeValue(ServerTags.HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS);
437     }
438     /**
439     * Modify the HaStoreHealthcheckIntervalInSeconds of the Element availability-service
440     * @param v the new value
441     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
442     */

443     public void setHaStoreHealthcheckIntervalInSeconds(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
444         setAttributeValue(ServerTags.HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS, v, overwrite);
445     }
446     /**
447     * Modify the HaStoreHealthcheckIntervalInSeconds of the Element availability-service
448     * @param v the new value
449     */

450     public void setHaStoreHealthcheckIntervalInSeconds(String JavaDoc v) {
451         setAttributeValue(ServerTags.HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS, v);
452     }
453     /**
454     * Get the default value of HaStoreHealthcheckIntervalInSeconds from dtd
455     */

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

463     public WebContainerAvailability newWebContainerAvailability() {
464         return new WebContainerAvailability();
465     }
466
467     /**
468      * Create a new bean using it's default constructor.
469      * This does not add it to any bean graph.
470      */

471     public EjbContainerAvailability newEjbContainerAvailability() {
472         return new EjbContainerAvailability();
473     }
474
475     /**
476      * Create a new bean using it's default constructor.
477      * This does not add it to any bean graph.
478      */

479     public JmsAvailability newJmsAvailability() {
480         return new JmsAvailability();
481     }
482
483     /**
484      * Create a new bean using it's default constructor.
485      * This does not add it to any bean graph.
486      */

487     public ElementProperty newElementProperty() {
488         return new ElementProperty();
489     }
490
491     /**
492     * get the xpath representation for this element
493     * returns something like abc[@name='value'] or abc
494     * depending on the type of the bean
495     */

496     protected String JavaDoc getRelativeXPath() {
497         String JavaDoc ret = null;
498         ret = "availability-service";
499         return (null != ret ? ret.trim() : null);
500     }
501
502     /*
503     * generic method to get default value from dtd
504     */

505     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
506         if(attr == null) return null;
507         attr = attr.trim();
508         if(attr.equals(ServerTags.AVAILABILITY_ENABLED)) return "true".trim();
509         if(attr.equals(ServerTags.AUTO_MANAGE_HA_STORE)) return "false".trim();
510         if(attr.equals(ServerTags.HA_STORE_HEALTHCHECK_ENABLED)) return "false".trim();
511         if(attr.equals(ServerTags.HA_STORE_HEALTHCHECK_INTERVAL_IN_SECONDS)) return "5".trim();
512     return null;
513     }
514     //
515
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
516         comparators.add(c);
517     }
518
519     //
520
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
521         comparators.remove(c);
522     }
523     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
524     }
525
526     // Dump the content of this bean returning it as a String
527
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
528         String JavaDoc s;
529         Object JavaDoc o;
530         org.netbeans.modules.schema2beans.BaseBean n;
531         str.append(indent);
532         str.append("WebContainerAvailability"); // NOI18N
533
n = (org.netbeans.modules.schema2beans.BaseBean) this.getWebContainerAvailability();
534         if (n != null)
535             n.dump(str, indent + "\t"); // NOI18N
536
else
537             str.append(indent+"\tnull"); // NOI18N
538
this.dumpAttributes(WEB_CONTAINER_AVAILABILITY, 0, str, indent);
539
540         str.append(indent);
541         str.append("EjbContainerAvailability"); // NOI18N
542
n = (org.netbeans.modules.schema2beans.BaseBean) this.getEjbContainerAvailability();
543         if (n != null)
544             n.dump(str, indent + "\t"); // NOI18N
545
else
546             str.append(indent+"\tnull"); // NOI18N
547
this.dumpAttributes(EJB_CONTAINER_AVAILABILITY, 0, str, indent);
548
549         str.append(indent);
550         str.append("JmsAvailability"); // NOI18N
551
n = (org.netbeans.modules.schema2beans.BaseBean) this.getJmsAvailability();
552         if (n != null)
553             n.dump(str, indent + "\t"); // NOI18N
554
else
555             str.append(indent+"\tnull"); // NOI18N
556
this.dumpAttributes(JMS_AVAILABILITY, 0, str, indent);
557
558         str.append(indent);
559         str.append("ElementProperty["+this.sizeElementProperty()+"]"); // NOI18N
560
for(int i=0; i<this.sizeElementProperty(); i++)
561         {
562             str.append(indent+"\t");
563             str.append("#"+i+":");
564             n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i);
565             if (n != null)
566                 n.dump(str, indent + "\t"); // NOI18N
567
else
568                 str.append(indent+"\tnull"); // NOI18N
569
this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent);
570         }
571
572     }
573     public String JavaDoc dumpBeanNode(){
574         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
575         str.append("AvailabilityService\n"); // NOI18N
576
this.dump(str, "\n "); // NOI18N
577
return str.toString();
578     }}
579
580 // END_NOI18N
581

582
Popular Tags