KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > clientbeans > TargetServer


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 TargetServer matches the DTD element target-server
26  *
27  */

28
29 package com.sun.enterprise.config.clientbeans;
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 TargetServer 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 DESCRIPTION = "Description";
50     static public final String JavaDoc SECURITY = "Security";
51
52     public TargetServer() {
53         this(Common.USE_DEFAULT_VALUES);
54     }
55
56     public TargetServer(int options)
57     {
58         super(comparators, runtimeVersion);
59         // Properties (see root bean comments for the bean graph)
60
initPropertyTables(2);
61         this.createProperty("description", DESCRIPTION,
62             Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
63             String JavaDoc.class);
64         this.createProperty("security", SECURITY,
65             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
66             Security.class);
67         this.initialize(options);
68     }
69
70     // Setting the default values of the properties
71
void initialize(int options) {
72
73     }
74
75     /**
76     * Return the Description of the Element target-server
77     */

78     public String JavaDoc getDescription() {
79         return (String JavaDoc) getValue(ClientTags.DESCRIPTION);
80     }
81     /**
82     * Modify the Description of the Element target-server
83     * @param v the new value
84     */

85     public void setDescription(String JavaDoc v){
86         setValue(ClientTags.DESCRIPTION, (null != v ? v.trim() : null));
87         }
88     // This attribute is optional
89
public void setSecurity(Security value) {
90         this.setValue(SECURITY, value);
91     }
92
93     // Get Method
94
public Security getSecurity() {
95         return (Security)this.getValue(SECURITY);
96     }
97
98     /**
99     * Getter for Name of the Element target-server
100     * @return the Name of the Element target-server
101     */

102     public String JavaDoc getName() {
103         return getAttributeValue(ClientTags.NAME);
104     }
105     /**
106     * Modify the Name of the Element target-server
107     * @param v the new value
108     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
109     */

110     public void setName(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
111         setAttributeValue(ClientTags.NAME, v, overwrite);
112     }
113     /**
114     * Modify the Name of the Element target-server
115     * @param v the new value
116     */

117     public void setName(String JavaDoc v) {
118         setAttributeValue(ClientTags.NAME, v);
119     }
120     /**
121     * Getter for Address of the Element target-server
122     * @return the Address of the Element target-server
123     */

124     public String JavaDoc getAddress() {
125         return getAttributeValue(ClientTags.ADDRESS);
126     }
127     /**
128     * Modify the Address of the Element target-server
129     * @param v the new value
130     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
131     */

132     public void setAddress(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
133         setAttributeValue(ClientTags.ADDRESS, v, overwrite);
134     }
135     /**
136     * Modify the Address of the Element target-server
137     * @param v the new value
138     */

139     public void setAddress(String JavaDoc v) {
140         setAttributeValue(ClientTags.ADDRESS, v);
141     }
142     /**
143     * Getter for Port of the Element target-server
144     * @return the Port of the Element target-server
145     */

146     public String JavaDoc getPort() {
147         return getAttributeValue(ClientTags.PORT);
148     }
149     /**
150     * Modify the Port of the Element target-server
151     * @param v the new value
152     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
153     */

154     public void setPort(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
155         setAttributeValue(ClientTags.PORT, v, overwrite);
156     }
157     /**
158     * Modify the Port of the Element target-server
159     * @param v the new value
160     */

161     public void setPort(String JavaDoc v) {
162         setAttributeValue(ClientTags.PORT, v);
163     }
164     /**
165      * Create a new bean using it's default constructor.
166      * This does not add it to any bean graph.
167      */

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

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

186     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
187         if(attr == null) return null;
188         attr = attr.trim();
189     return null;
190     }
191     //
192
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
193         comparators.add(c);
194     }
195
196     //
197
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
198         comparators.remove(c);
199     }
200     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
201     }
202
203     // Dump the content of this bean returning it as a String
204
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
205         String JavaDoc s;
206         Object JavaDoc o;
207         org.netbeans.modules.schema2beans.BaseBean n;
208         str.append(indent);
209         str.append("Description"); // NOI18N
210
str.append(indent+"\t"); // NOI18N
211
str.append("<"); // NOI18N
212
o = this.getDescription();
213         str.append((o==null?"null":o.toString().trim())); // NOI18N
214
str.append(">\n"); // NOI18N
215
this.dumpAttributes(DESCRIPTION, 0, str, indent);
216
217         str.append(indent);
218         str.append("Security"); // NOI18N
219
n = (org.netbeans.modules.schema2beans.BaseBean) this.getSecurity();
220         if (n != null)
221             n.dump(str, indent + "\t"); // NOI18N
222
else
223             str.append(indent+"\tnull"); // NOI18N
224
this.dumpAttributes(SECURITY, 0, str, indent);
225
226     }
227     public String JavaDoc dumpBeanNode(){
228         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
229         str.append("TargetServer\n"); // NOI18N
230
this.dump(str, "\n "); // NOI18N
231
return str.toString();
232     }}
233
234 // END_NOI18N
235

236
Popular Tags