KickJava   Java API By Example, From Geeks To Geeks.

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


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 TransformationRule matches the DTD element transformation-rule
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 TransformationRule 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
50     public TransformationRule() {
51         this(Common.USE_DEFAULT_VALUES);
52     }
53
54     public TransformationRule(int options)
55     {
56         super(comparators, runtimeVersion);
57         // Properties (see root bean comments for the bean graph)
58
initPropertyTables(0);
59         this.initialize(options);
60     }
61
62     // Setting the default values of the properties
63
void initialize(int options) {
64
65     }
66
67     /**
68     * Getter for Name of the Element transformation-rule
69     * @return the Name of the Element transformation-rule
70     */

71     public String JavaDoc getName() {
72         return getAttributeValue(ServerTags.NAME);
73     }
74     /**
75     * Modify the Name of the Element transformation-rule
76     * @param v the new value
77     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
78     */

79     public void setName(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
80         setAttributeValue(ServerTags.NAME, v, overwrite);
81     }
82     /**
83     * Modify the Name of the Element transformation-rule
84     * @param v the new value
85     */

86     public void setName(String JavaDoc v) {
87         setAttributeValue(ServerTags.NAME, v);
88     }
89     /**
90     * Getter for Enabled of the Element transformation-rule
91     * @return the Enabled of the Element transformation-rule
92     */

93     public boolean isEnabled() {
94         return toBoolean(getAttributeValue(ServerTags.ENABLED));
95     }
96     /**
97     * Modify the Enabled of the Element transformation-rule
98     * @param v the new value
99     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
100     */

101     public void setEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
102         setAttributeValue(ServerTags.ENABLED, ""+(v==true), overwrite);
103     }
104     /**
105     * Modify the Enabled of the Element transformation-rule
106     * @param v the new value
107     */

108     public void setEnabled(boolean v) {
109         setAttributeValue(ServerTags.ENABLED, ""+(v==true));
110     }
111     /**
112     * Get the default value of Enabled from dtd
113     */

114     public static String JavaDoc getDefaultEnabled() {
115         return "true".trim();
116     }
117     /**
118     * Getter for ApplyTo of the Element transformation-rule
119     * @return the ApplyTo of the Element transformation-rule
120     */

121     public String JavaDoc getApplyTo() {
122         return getAttributeValue(ServerTags.APPLY_TO);
123     }
124     /**
125     * Modify the ApplyTo of the Element transformation-rule
126     * @param v the new value
127     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
128     */

129     public void setApplyTo(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
130         setAttributeValue(ServerTags.APPLY_TO, v, overwrite);
131     }
132     /**
133     * Modify the ApplyTo of the Element transformation-rule
134     * @param v the new value
135     */

136     public void setApplyTo(String JavaDoc v) {
137         setAttributeValue(ServerTags.APPLY_TO, v);
138     }
139     /**
140     * Get the default value of ApplyTo from dtd
141     */

142     public static String JavaDoc getDefaultApplyTo() {
143         return "request".trim();
144     }
145     /**
146     * Getter for RuleFileLocation of the Element transformation-rule
147     * @return the RuleFileLocation of the Element transformation-rule
148     */

149     public String JavaDoc getRuleFileLocation() {
150         return getAttributeValue(ServerTags.RULE_FILE_LOCATION);
151     }
152     /**
153     * Modify the RuleFileLocation of the Element transformation-rule
154     * @param v the new value
155     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
156     */

157     public void setRuleFileLocation(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
158         setAttributeValue(ServerTags.RULE_FILE_LOCATION, v, overwrite);
159     }
160     /**
161     * Modify the RuleFileLocation of the Element transformation-rule
162     * @param v the new value
163     */

164     public void setRuleFileLocation(String JavaDoc v) {
165         setAttributeValue(ServerTags.RULE_FILE_LOCATION, v);
166     }
167     /**
168     * get the xpath representation for this element
169     * returns something like abc[@name='value'] or abc
170     * depending on the type of the bean
171     */

172     protected String JavaDoc getRelativeXPath() {
173         String JavaDoc ret = null;
174         ret = "transformation-rule" + (canHaveSiblings() ? "[@name='" + getAttributeValue("name") +"']" : "") ;
175         return (null != ret ? ret.trim() : null);
176     }
177
178     /*
179     * generic method to get default value from dtd
180     */

181     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
182         if(attr == null) return null;
183         attr = attr.trim();
184         if(attr.equals(ServerTags.ENABLED)) return "true".trim();
185         if(attr.equals(ServerTags.APPLY_TO)) return "request".trim();
186     return null;
187     }
188     //
189
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
190         comparators.add(c);
191     }
192
193     //
194
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
195         comparators.remove(c);
196     }
197     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
198     }
199
200     // Dump the content of this bean returning it as a String
201
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
202         String JavaDoc s;
203         Object JavaDoc o;
204         org.netbeans.modules.schema2beans.BaseBean n;
205     }
206     public String JavaDoc dumpBeanNode(){
207         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
208         str.append("TransformationRule\n"); // NOI18N
209
this.dump(str, "\n "); // NOI18N
210
return str.toString();
211     }}
212
213 // END_NOI18N
214

215
Popular Tags