KickJava   Java API By Example, From Geeks To Geeks.

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


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 ClusterRef matches the DTD element cluster-ref
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 ClusterRef 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 HEALTH_CHECKER = "HealthChecker";
50
51     public ClusterRef() {
52         this(Common.USE_DEFAULT_VALUES);
53     }
54
55     public ClusterRef(int options)
56     {
57         super(comparators, runtimeVersion);
58         // Properties (see root bean comments for the bean graph)
59
initPropertyTables(1);
60         this.createProperty("health-checker", HEALTH_CHECKER,
61             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
62             HealthChecker.class);
63         this.createAttribute(HEALTH_CHECKER, "url", "Url",
64                         AttrProp.CDATA,
65                         null, "/");
66         this.createAttribute(HEALTH_CHECKER, "interval-in-seconds", "IntervalInSeconds",
67                         AttrProp.CDATA,
68                         null, "30");
69         this.createAttribute(HEALTH_CHECKER, "timeout-in-seconds", "TimeoutInSeconds",
70                         AttrProp.CDATA,
71                         null, "10");
72         this.initialize(options);
73     }
74
75     // Setting the default values of the properties
76
void initialize(int options) {
77
78     }
79
80     // This attribute is optional
81
public void setHealthChecker(HealthChecker value) {
82         this.setValue(HEALTH_CHECKER, value);
83     }
84
85     // Get Method
86
public HealthChecker getHealthChecker() {
87         return (HealthChecker)this.getValue(HEALTH_CHECKER);
88     }
89
90     /**
91     * Getter for Ref of the Element cluster-ref
92     * @return the Ref of the Element cluster-ref
93     */

94     public String JavaDoc getRef() {
95         return getAttributeValue(ServerTags.REF);
96     }
97     /**
98     * Modify the Ref of the Element cluster-ref
99     * @param v the new value
100     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
101     */

102     public void setRef(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
103         setAttributeValue(ServerTags.REF, v, overwrite);
104     }
105     /**
106     * Modify the Ref of the Element cluster-ref
107     * @param v the new value
108     */

109     public void setRef(String JavaDoc v) {
110         setAttributeValue(ServerTags.REF, v);
111     }
112     /**
113     * Getter for LbPolicy of the Element cluster-ref
114     * @return the LbPolicy of the Element cluster-ref
115     */

116     public String JavaDoc getLbPolicy() {
117         return getAttributeValue(ServerTags.LB_POLICY);
118     }
119     /**
120     * Modify the LbPolicy of the Element cluster-ref
121     * @param v the new value
122     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
123     */

124     public void setLbPolicy(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
125         setAttributeValue(ServerTags.LB_POLICY, v, overwrite);
126     }
127     /**
128     * Modify the LbPolicy of the Element cluster-ref
129     * @param v the new value
130     */

131     public void setLbPolicy(String JavaDoc v) {
132         setAttributeValue(ServerTags.LB_POLICY, v);
133     }
134     /**
135     * Get the default value of LbPolicy from dtd
136     */

137     public static String JavaDoc getDefaultLbPolicy() {
138         return "round-robin".trim();
139     }
140     /**
141     * Getter for LbPolicyModule of the Element cluster-ref
142     * @return the LbPolicyModule of the Element cluster-ref
143     */

144     public String JavaDoc getLbPolicyModule() {
145             return getAttributeValue(ServerTags.LB_POLICY_MODULE);
146     }
147     /**
148     * Modify the LbPolicyModule of the Element cluster-ref
149     * @param v the new value
150     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
151     */

152     public void setLbPolicyModule(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
153         setAttributeValue(ServerTags.LB_POLICY_MODULE, v, overwrite);
154     }
155     /**
156     * Modify the LbPolicyModule of the Element cluster-ref
157     * @param v the new value
158     */

159     public void setLbPolicyModule(String JavaDoc v) {
160         setAttributeValue(ServerTags.LB_POLICY_MODULE, v);
161     }
162     /**
163      * Create a new bean using it's default constructor.
164      * This does not add it to any bean graph.
165      */

166     public HealthChecker newHealthChecker() {
167         return new HealthChecker();
168     }
169
170     /**
171     * get the xpath representation for this element
172     * returns something like abc[@name='value'] or abc
173     * depending on the type of the bean
174     */

175     protected String JavaDoc getRelativeXPath() {
176         String JavaDoc ret = null;
177         ret = "cluster-ref" + (canHaveSiblings() ? "[@ref='" + getAttributeValue("ref") +"']" : "") ;
178         return (null != ret ? ret.trim() : null);
179     }
180
181     /*
182     * generic method to get default value from dtd
183     */

184     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
185         if(attr == null) return null;
186         attr = attr.trim();
187         if(attr.equals(ServerTags.LB_POLICY)) return "round-robin".trim();
188     return null;
189     }
190     //
191
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
192         comparators.add(c);
193     }
194
195     //
196
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
197         comparators.remove(c);
198     }
199     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
200     }
201
202     // Dump the content of this bean returning it as a String
203
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
204         String JavaDoc s;
205         Object JavaDoc o;
206         org.netbeans.modules.schema2beans.BaseBean n;
207         str.append(indent);
208         str.append("HealthChecker"); // NOI18N
209
n = (org.netbeans.modules.schema2beans.BaseBean) this.getHealthChecker();
210         if (n != null)
211             n.dump(str, indent + "\t"); // NOI18N
212
else
213             str.append(indent+"\tnull"); // NOI18N
214
this.dumpAttributes(HEALTH_CHECKER, 0, str, indent);
215
216     }
217     public String JavaDoc dumpBeanNode(){
218         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
219         str.append("ClusterRef\n"); // NOI18N
220
this.dump(str, "\n "); // NOI18N
221
return str.toString();
222     }}
223
224 // END_NOI18N
225

226
Popular Tags