KickJava   Java API By Example, From Geeks To Geeks.

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


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 EjbContainerAvailability matches the DTD element ejb-container-availability
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 EjbContainerAvailability 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 EjbContainerAvailability() {
52         this(Common.USE_DEFAULT_VALUES);
53     }
54
55     public EjbContainerAvailability(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(EjbContainerAvailability.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 AvailabilityEnabled of the Element ejb-container-availability
152     * @return the AvailabilityEnabled of the Element ejb-container-availability
153     */

154     public String JavaDoc getAvailabilityEnabled() {
155             return getAttributeValue(ServerTags.AVAILABILITY_ENABLED);
156     }
157     /**
158     * Modify the AvailabilityEnabled of the Element ejb-container-availability
159     * @param v the new value
160     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
161     */

162     public void setAvailabilityEnabled(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
163         setAttributeValue(ServerTags.AVAILABILITY_ENABLED, v, overwrite);
164     }
165     /**
166     * Modify the AvailabilityEnabled of the Element ejb-container-availability
167     * @param v the new value
168     */

169     public void setAvailabilityEnabled(String JavaDoc v) {
170         setAttributeValue(ServerTags.AVAILABILITY_ENABLED, v);
171     }
172     /**
173     * Getter for SfsbHaPersistenceType of the Element ejb-container-availability
174     * @return the SfsbHaPersistenceType of the Element ejb-container-availability
175     */

176     public String JavaDoc getSfsbHaPersistenceType() {
177         return getAttributeValue(ServerTags.SFSB_HA_PERSISTENCE_TYPE);
178     }
179     /**
180     * Modify the SfsbHaPersistenceType of the Element ejb-container-availability
181     * @param v the new value
182     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
183     */

184     public void setSfsbHaPersistenceType(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
185         setAttributeValue(ServerTags.SFSB_HA_PERSISTENCE_TYPE, v, overwrite);
186     }
187     /**
188     * Modify the SfsbHaPersistenceType of the Element ejb-container-availability
189     * @param v the new value
190     */

191     public void setSfsbHaPersistenceType(String JavaDoc v) {
192         setAttributeValue(ServerTags.SFSB_HA_PERSISTENCE_TYPE, v);
193     }
194     /**
195     * Get the default value of SfsbHaPersistenceType from dtd
196     */

197     public static String JavaDoc getDefaultSfsbHaPersistenceType() {
198         return "ha".trim();
199     }
200     /**
201     * Getter for SfsbPersistenceType of the Element ejb-container-availability
202     * @return the SfsbPersistenceType of the Element ejb-container-availability
203     */

204     public String JavaDoc getSfsbPersistenceType() {
205         return getAttributeValue(ServerTags.SFSB_PERSISTENCE_TYPE);
206     }
207     /**
208     * Modify the SfsbPersistenceType of the Element ejb-container-availability
209     * @param v the new value
210     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
211     */

212     public void setSfsbPersistenceType(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
213         setAttributeValue(ServerTags.SFSB_PERSISTENCE_TYPE, v, overwrite);
214     }
215     /**
216     * Modify the SfsbPersistenceType of the Element ejb-container-availability
217     * @param v the new value
218     */

219     public void setSfsbPersistenceType(String JavaDoc v) {
220         setAttributeValue(ServerTags.SFSB_PERSISTENCE_TYPE, v);
221     }
222     /**
223     * Get the default value of SfsbPersistenceType from dtd
224     */

225     public static String JavaDoc getDefaultSfsbPersistenceType() {
226         return "file".trim();
227     }
228     /**
229     * Getter for SfsbCheckpointEnabled of the Element ejb-container-availability
230     * @return the SfsbCheckpointEnabled of the Element ejb-container-availability
231     */

232     public String JavaDoc getSfsbCheckpointEnabled() {
233             return getAttributeValue(ServerTags.SFSB_CHECKPOINT_ENABLED);
234     }
235     /**
236     * Modify the SfsbCheckpointEnabled of the Element ejb-container-availability
237     * @param v the new value
238     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
239     */

240     public void setSfsbCheckpointEnabled(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
241         setAttributeValue(ServerTags.SFSB_CHECKPOINT_ENABLED, v, overwrite);
242     }
243     /**
244     * Modify the SfsbCheckpointEnabled of the Element ejb-container-availability
245     * @param v the new value
246     */

247     public void setSfsbCheckpointEnabled(String JavaDoc v) {
248         setAttributeValue(ServerTags.SFSB_CHECKPOINT_ENABLED, v);
249     }
250     /**
251     * Getter for SfsbQuickCheckpointEnabled of the Element ejb-container-availability
252     * @return the SfsbQuickCheckpointEnabled of the Element ejb-container-availability
253     */

254     public String JavaDoc getSfsbQuickCheckpointEnabled() {
255             return getAttributeValue(ServerTags.SFSB_QUICK_CHECKPOINT_ENABLED);
256     }
257     /**
258     * Modify the SfsbQuickCheckpointEnabled of the Element ejb-container-availability
259     * @param v the new value
260     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
261     */

262     public void setSfsbQuickCheckpointEnabled(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
263         setAttributeValue(ServerTags.SFSB_QUICK_CHECKPOINT_ENABLED, v, overwrite);
264     }
265     /**
266     * Modify the SfsbQuickCheckpointEnabled of the Element ejb-container-availability
267     * @param v the new value
268     */

269     public void setSfsbQuickCheckpointEnabled(String JavaDoc v) {
270         setAttributeValue(ServerTags.SFSB_QUICK_CHECKPOINT_ENABLED, v);
271     }
272     /**
273     * Getter for SfsbStorePoolName of the Element ejb-container-availability
274     * @return the SfsbStorePoolName of the Element ejb-container-availability
275     */

276     public String JavaDoc getSfsbStorePoolName() {
277             return getAttributeValue(ServerTags.SFSB_STORE_POOL_NAME);
278     }
279     /**
280     * Modify the SfsbStorePoolName of the Element ejb-container-availability
281     * @param v the new value
282     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
283     */

284     public void setSfsbStorePoolName(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
285         setAttributeValue(ServerTags.SFSB_STORE_POOL_NAME, v, overwrite);
286     }
287     /**
288     * Modify the SfsbStorePoolName of the Element ejb-container-availability
289     * @param v the new value
290     */

291     public void setSfsbStorePoolName(String JavaDoc v) {
292         setAttributeValue(ServerTags.SFSB_STORE_POOL_NAME, v);
293     }
294     /**
295      * Create a new bean using it's default constructor.
296      * This does not add it to any bean graph.
297      */

298     public ElementProperty newElementProperty() {
299         return new ElementProperty();
300     }
301
302     /**
303     * get the xpath representation for this element
304     * returns something like abc[@name='value'] or abc
305     * depending on the type of the bean
306     */

307     protected String JavaDoc getRelativeXPath() {
308         String JavaDoc ret = null;
309         ret = "ejb-container-availability";
310         return (null != ret ? ret.trim() : null);
311     }
312
313     /*
314     * generic method to get default value from dtd
315     */

316     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
317         if(attr == null) return null;
318         attr = attr.trim();
319         if(attr.equals(ServerTags.SFSB_HA_PERSISTENCE_TYPE)) return "ha".trim();
320         if(attr.equals(ServerTags.SFSB_PERSISTENCE_TYPE)) return "file".trim();
321     return null;
322     }
323     //
324
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
325         comparators.add(c);
326     }
327
328     //
329
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
330         comparators.remove(c);
331     }
332     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
333     }
334
335     // Dump the content of this bean returning it as a String
336
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
337         String JavaDoc s;
338         Object JavaDoc o;
339         org.netbeans.modules.schema2beans.BaseBean n;
340         str.append(indent);
341         str.append("ElementProperty["+this.sizeElementProperty()+"]"); // NOI18N
342
for(int i=0; i<this.sizeElementProperty(); i++)
343         {
344             str.append(indent+"\t");
345             str.append("#"+i+":");
346             n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i);
347             if (n != null)
348                 n.dump(str, indent + "\t"); // NOI18N
349
else
350                 str.append(indent+"\tnull"); // NOI18N
351
this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent);
352         }
353
354     }
355     public String JavaDoc dumpBeanNode(){
356         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
357         str.append("EjbContainerAvailability\n"); // NOI18N
358
this.dump(str, "\n "); // NOI18N
359
return str.toString();
360     }}
361
362 // END_NOI18N
363

364
Popular Tags