KickJava   Java API By Example, From Geeks To Geeks.

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


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 HttpProtocol matches the DTD element http-protocol
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 HttpProtocol 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 HttpProtocol() {
51         this(Common.USE_DEFAULT_VALUES);
52     }
53
54     public HttpProtocol(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 Version of the Element http-protocol
69     * @return the Version of the Element http-protocol
70     */

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

79     public void setVersion(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
80         setAttributeValue(ServerTags.VERSION, v, overwrite);
81     }
82     /**
83     * Modify the Version of the Element http-protocol
84     * @param v the new value
85     */

86     public void setVersion(String JavaDoc v) {
87         setAttributeValue(ServerTags.VERSION, v);
88     }
89     /**
90     * Get the default value of Version from dtd
91     */

92     public static String JavaDoc getDefaultVersion() {
93         return "HTTP/1.1".trim();
94     }
95     /**
96     * Getter for DnsLookupEnabled of the Element http-protocol
97     * @return the DnsLookupEnabled of the Element http-protocol
98     */

99     public boolean isDnsLookupEnabled() {
100         return toBoolean(getAttributeValue(ServerTags.DNS_LOOKUP_ENABLED));
101     }
102     /**
103     * Modify the DnsLookupEnabled of the Element http-protocol
104     * @param v the new value
105     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
106     */

107     public void setDnsLookupEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
108         setAttributeValue(ServerTags.DNS_LOOKUP_ENABLED, ""+(v==true), overwrite);
109     }
110     /**
111     * Modify the DnsLookupEnabled of the Element http-protocol
112     * @param v the new value
113     */

114     public void setDnsLookupEnabled(boolean v) {
115         setAttributeValue(ServerTags.DNS_LOOKUP_ENABLED, ""+(v==true));
116     }
117     /**
118     * Get the default value of DnsLookupEnabled from dtd
119     */

120     public static String JavaDoc getDefaultDnsLookupEnabled() {
121         return "false".trim();
122     }
123     /**
124     * Getter for ForcedResponseType of the Element http-protocol
125     * @return the ForcedResponseType of the Element http-protocol
126     */

127     public String JavaDoc getForcedResponseType() {
128         return getAttributeValue(ServerTags.FORCED_RESPONSE_TYPE);
129     }
130     /**
131     * Modify the ForcedResponseType of the Element http-protocol
132     * @param v the new value
133     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
134     */

135     public void setForcedResponseType(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
136         setAttributeValue(ServerTags.FORCED_RESPONSE_TYPE, v, overwrite);
137     }
138     /**
139     * Modify the ForcedResponseType of the Element http-protocol
140     * @param v the new value
141     */

142     public void setForcedResponseType(String JavaDoc v) {
143         setAttributeValue(ServerTags.FORCED_RESPONSE_TYPE, v);
144     }
145     /**
146     * Get the default value of ForcedResponseType from dtd
147     */

148     public static String JavaDoc getDefaultForcedResponseType() {
149         return "text/html; charset=iso-8859-1".trim();
150     }
151     /**
152     * Getter for DefaultResponseType of the Element http-protocol
153     * @return the DefaultResponseType of the Element http-protocol
154     */

155     public String JavaDoc getDefaultResponseType() {
156         return getAttributeValue(ServerTags.DEFAULT_RESPONSE_TYPE);
157     }
158     /**
159     * Modify the DefaultResponseType of the Element http-protocol
160     * @param v the new value
161     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
162     */

163     public void setDefaultResponseType(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
164         setAttributeValue(ServerTags.DEFAULT_RESPONSE_TYPE, v, overwrite);
165     }
166     /**
167     * Modify the DefaultResponseType of the Element http-protocol
168     * @param v the new value
169     */

170     public void setDefaultResponseType(String JavaDoc v) {
171         setAttributeValue(ServerTags.DEFAULT_RESPONSE_TYPE, v);
172     }
173     /**
174     * Get the default value of DefaultResponseType from dtd
175     */

176     public static String JavaDoc getDefaultDefaultResponseType() {
177         return "text/html; charset=iso-8859-1".trim();
178     }
179     /**
180     * Getter for SslEnabled of the Element http-protocol
181     * @return the SslEnabled of the Element http-protocol
182     */

183     public boolean isSslEnabled() {
184         return toBoolean(getAttributeValue(ServerTags.SSL_ENABLED));
185     }
186     /**
187     * Modify the SslEnabled of the Element http-protocol
188     * @param v the new value
189     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
190     */

191     public void setSslEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
192         setAttributeValue(ServerTags.SSL_ENABLED, ""+(v==true), overwrite);
193     }
194     /**
195     * Modify the SslEnabled of the Element http-protocol
196     * @param v the new value
197     */

198     public void setSslEnabled(boolean v) {
199         setAttributeValue(ServerTags.SSL_ENABLED, ""+(v==true));
200     }
201     /**
202     * Get the default value of SslEnabled from dtd
203     */

204     public static String JavaDoc getDefaultSslEnabled() {
205         return "true".trim();
206     }
207     /**
208     * get the xpath representation for this element
209     * returns something like abc[@name='value'] or abc
210     * depending on the type of the bean
211     */

212     protected String JavaDoc getRelativeXPath() {
213         String JavaDoc ret = null;
214         ret = "http-protocol";
215         return (null != ret ? ret.trim() : null);
216     }
217
218     /*
219     * generic method to get default value from dtd
220     */

221     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
222         if(attr == null) return null;
223         attr = attr.trim();
224         if(attr.equals(ServerTags.VERSION)) return "HTTP/1.1".trim();
225         if(attr.equals(ServerTags.DNS_LOOKUP_ENABLED)) return "false".trim();
226         if(attr.equals(ServerTags.FORCED_RESPONSE_TYPE)) return "text/html; charset=iso-8859-1".trim();
227         if(attr.equals(ServerTags.DEFAULT_RESPONSE_TYPE)) return "text/html; charset=iso-8859-1".trim();
228         if(attr.equals(ServerTags.SSL_ENABLED)) return "true".trim();
229     return null;
230     }
231     //
232
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
233         comparators.add(c);
234     }
235
236     //
237
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
238         comparators.remove(c);
239     }
240     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
241     }
242
243     // Dump the content of this bean returning it as a String
244
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
245         String JavaDoc s;
246         Object JavaDoc o;
247         org.netbeans.modules.schema2beans.BaseBean n;
248     }
249     public String JavaDoc dumpBeanNode(){
250         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
251         str.append("HttpProtocol\n"); // NOI18N
252
this.dump(str, "\n "); // NOI18N
253
return str.toString();
254     }}
255
256 // END_NOI18N
257

258
Popular Tags