KickJava   Java API By Example, From Geeks To Geeks.

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


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 ElementProperty matches the DTD element element-property
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 ElementProperty 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
51     public ElementProperty() {
52         this(Common.USE_DEFAULT_VALUES);
53     }
54
55     public ElementProperty(int options)
56     {
57         super(comparators, runtimeVersion);
58         // Properties (see root bean comments for the bean graph)
59
initPropertyTables(1);
60         this.createProperty("description", DESCRIPTION,
61             Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
62             String JavaDoc.class);
63         this.initialize(options);
64     }
65
66     // Setting the default values of the properties
67
void initialize(int options) {
68
69     }
70
71     /**
72     * Return the Description of the Element element-property
73     */

74     public String JavaDoc getDescription() {
75         return (String JavaDoc) getValue(ServerTags.DESCRIPTION);
76     }
77     /**
78     * Modify the Description of the Element element-property
79     * @param v the new value
80     */

81     public void setDescription(String JavaDoc v){
82         setValue(ServerTags.DESCRIPTION, (null != v ? v.trim() : null));
83         }
84     /**
85     * Getter for Name of the Element element-property
86     * @return the Name of the Element element-property
87     */

88     public String JavaDoc getName() {
89         return getAttributeValue(ServerTags.NAME);
90     }
91     /**
92     * Modify the Name of the Element element-property
93     * @param v the new value
94     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
95     */

96     public void setName(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
97         setAttributeValue(ServerTags.NAME, v, overwrite);
98     }
99     /**
100     * Modify the Name of the Element element-property
101     * @param v the new value
102     */

103     public void setName(String JavaDoc v) {
104         setAttributeValue(ServerTags.NAME, v);
105     }
106     /**
107     * Getter for Value of the Element element-property
108     * @return the Value of the Element element-property
109     */

110     public String JavaDoc getValue() {
111         return getAttributeValue(ServerTags.VALUE);
112     }
113     /**
114     * Modify the Value of the Element element-property
115     * @param v the new value
116     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
117     */

118     public void setValue(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
119         setAttributeValue(ServerTags.VALUE, v, overwrite);
120     }
121     /**
122     * Modify the Value of the Element element-property
123     * @param v the new value
124     */

125     public void setValue(String JavaDoc v) {
126         setAttributeValue(ServerTags.VALUE, v);
127     }
128     /**
129     * get the xpath representation for this element
130     * returns something like abc[@name='value'] or abc
131     * depending on the type of the bean
132     */

133     protected String JavaDoc getRelativeXPath() {
134         String JavaDoc ret = null;
135         ret = "element-property" + (canHaveSiblings() ? "[@name='" + getAttributeValue("name") +"']" : "") ;
136         return (null != ret ? ret.trim() : null);
137     }
138
139     /*
140     * generic method to get default value from dtd
141     */

142     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
143         if(attr == null) return null;
144         attr = attr.trim();
145     return null;
146     }
147     //
148
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
149         comparators.add(c);
150     }
151
152     //
153
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
154         comparators.remove(c);
155     }
156     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
157     }
158
159     // Dump the content of this bean returning it as a String
160
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
161         String JavaDoc s;
162         Object JavaDoc o;
163         org.netbeans.modules.schema2beans.BaseBean n;
164         str.append(indent);
165         str.append("Description"); // NOI18N
166
str.append(indent+"\t"); // NOI18N
167
str.append("<"); // NOI18N
168
o = this.getDescription();
169         str.append((o==null?"null":o.toString().trim())); // NOI18N
170
str.append(">\n"); // NOI18N
171
this.dumpAttributes(DESCRIPTION, 0, str, indent);
172
173     }
174     public String JavaDoc dumpBeanNode(){
175         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
176         str.append("ElementProperty\n"); // NOI18N
177
this.dump(str, "\n "); // NOI18N
178
return str.toString();
179     }}
180
181 // END_NOI18N
182

183
Popular Tags