KickJava   Java API By Example, From Geeks To Geeks.

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


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

71     public boolean isGloballyEnabled() {
72         return toBoolean(getAttributeValue(ServerTags.GLOBALLY_ENABLED));
73     }
74     /**
75     * Modify the GloballyEnabled of the Element http-file-cache
76     * @param v the new value
77     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
78     */

79     public void setGloballyEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
80         setAttributeValue(ServerTags.GLOBALLY_ENABLED, ""+(v==true), overwrite);
81     }
82     /**
83     * Modify the GloballyEnabled of the Element http-file-cache
84     * @param v the new value
85     */

86     public void setGloballyEnabled(boolean v) {
87         setAttributeValue(ServerTags.GLOBALLY_ENABLED, ""+(v==true));
88     }
89     /**
90     * Get the default value of GloballyEnabled from dtd
91     */

92     public static String JavaDoc getDefaultGloballyEnabled() {
93         return "true".trim();
94     }
95     /**
96     * Getter for FileCachingEnabled of the Element http-file-cache
97     * @return the FileCachingEnabled of the Element http-file-cache
98     */

99     public String JavaDoc getFileCachingEnabled() {
100         return getAttributeValue(ServerTags.FILE_CACHING_ENABLED);
101     }
102     /**
103     * Modify the FileCachingEnabled of the Element http-file-cache
104     * @param v the new value
105     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
106     */

107     public void setFileCachingEnabled(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
108         setAttributeValue(ServerTags.FILE_CACHING_ENABLED, v, overwrite);
109     }
110     /**
111     * Modify the FileCachingEnabled of the Element http-file-cache
112     * @param v the new value
113     */

114     public void setFileCachingEnabled(String JavaDoc v) {
115         setAttributeValue(ServerTags.FILE_CACHING_ENABLED, v);
116     }
117     /**
118     * Get the default value of FileCachingEnabled from dtd
119     */

120     public static String JavaDoc getDefaultFileCachingEnabled() {
121         return "on".trim();
122     }
123     /**
124     * Getter for MaxAgeInSeconds of the Element http-file-cache
125     * @return the MaxAgeInSeconds of the Element http-file-cache
126     */

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

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

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

148     public static String JavaDoc getDefaultMaxAgeInSeconds() {
149         return "30".trim();
150     }
151     /**
152     * Getter for MediumFileSizeLimitInBytes of the Element http-file-cache
153     * @return the MediumFileSizeLimitInBytes of the Element http-file-cache
154     */

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

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

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

176     public static String JavaDoc getDefaultMediumFileSizeLimitInBytes() {
177         return "537600".trim();
178     }
179     /**
180     * Getter for MediumFileSpaceInBytes of the Element http-file-cache
181     * @return the MediumFileSpaceInBytes of the Element http-file-cache
182     */

183     public String JavaDoc getMediumFileSpaceInBytes() {
184         return getAttributeValue(ServerTags.MEDIUM_FILE_SPACE_IN_BYTES);
185     }
186     /**
187     * Modify the MediumFileSpaceInBytes of the Element http-file-cache
188     * @param v the new value
189     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
190     */

191     public void setMediumFileSpaceInBytes(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
192         setAttributeValue(ServerTags.MEDIUM_FILE_SPACE_IN_BYTES, v, overwrite);
193     }
194     /**
195     * Modify the MediumFileSpaceInBytes of the Element http-file-cache
196     * @param v the new value
197     */

198     public void setMediumFileSpaceInBytes(String JavaDoc v) {
199         setAttributeValue(ServerTags.MEDIUM_FILE_SPACE_IN_BYTES, v);
200     }
201     /**
202     * Get the default value of MediumFileSpaceInBytes from dtd
203     */

204     public static String JavaDoc getDefaultMediumFileSpaceInBytes() {
205         return "10485760".trim();
206     }
207     /**
208     * Getter for SmallFileSizeLimitInBytes of the Element http-file-cache
209     * @return the SmallFileSizeLimitInBytes of the Element http-file-cache
210     */

211     public String JavaDoc getSmallFileSizeLimitInBytes() {
212         return getAttributeValue(ServerTags.SMALL_FILE_SIZE_LIMIT_IN_BYTES);
213     }
214     /**
215     * Modify the SmallFileSizeLimitInBytes of the Element http-file-cache
216     * @param v the new value
217     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
218     */

219     public void setSmallFileSizeLimitInBytes(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
220         setAttributeValue(ServerTags.SMALL_FILE_SIZE_LIMIT_IN_BYTES, v, overwrite);
221     }
222     /**
223     * Modify the SmallFileSizeLimitInBytes of the Element http-file-cache
224     * @param v the new value
225     */

226     public void setSmallFileSizeLimitInBytes(String JavaDoc v) {
227         setAttributeValue(ServerTags.SMALL_FILE_SIZE_LIMIT_IN_BYTES, v);
228     }
229     /**
230     * Get the default value of SmallFileSizeLimitInBytes from dtd
231     */

232     public static String JavaDoc getDefaultSmallFileSizeLimitInBytes() {
233         return "2048".trim();
234     }
235     /**
236     * Getter for SmallFileSpaceInBytes of the Element http-file-cache
237     * @return the SmallFileSpaceInBytes of the Element http-file-cache
238     */

239     public String JavaDoc getSmallFileSpaceInBytes() {
240         return getAttributeValue(ServerTags.SMALL_FILE_SPACE_IN_BYTES);
241     }
242     /**
243     * Modify the SmallFileSpaceInBytes of the Element http-file-cache
244     * @param v the new value
245     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
246     */

247     public void setSmallFileSpaceInBytes(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
248         setAttributeValue(ServerTags.SMALL_FILE_SPACE_IN_BYTES, v, overwrite);
249     }
250     /**
251     * Modify the SmallFileSpaceInBytes of the Element http-file-cache
252     * @param v the new value
253     */

254     public void setSmallFileSpaceInBytes(String JavaDoc v) {
255         setAttributeValue(ServerTags.SMALL_FILE_SPACE_IN_BYTES, v);
256     }
257     /**
258     * Get the default value of SmallFileSpaceInBytes from dtd
259     */

260     public static String JavaDoc getDefaultSmallFileSpaceInBytes() {
261         return "1048576".trim();
262     }
263     /**
264     * Getter for FileTransmissionEnabled of the Element http-file-cache
265     * @return the FileTransmissionEnabled of the Element http-file-cache
266     */

267     public boolean isFileTransmissionEnabled() {
268         return toBoolean(getAttributeValue(ServerTags.FILE_TRANSMISSION_ENABLED));
269     }
270     /**
271     * Modify the FileTransmissionEnabled of the Element http-file-cache
272     * @param v the new value
273     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
274     */

275     public void setFileTransmissionEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
276         setAttributeValue(ServerTags.FILE_TRANSMISSION_ENABLED, ""+(v==true), overwrite);
277     }
278     /**
279     * Modify the FileTransmissionEnabled of the Element http-file-cache
280     * @param v the new value
281     */

282     public void setFileTransmissionEnabled(boolean v) {
283         setAttributeValue(ServerTags.FILE_TRANSMISSION_ENABLED, ""+(v==true));
284     }
285     /**
286     * Get the default value of FileTransmissionEnabled from dtd
287     */

288     public static String JavaDoc getDefaultFileTransmissionEnabled() {
289         return "false".trim();
290     }
291     /**
292     * Getter for MaxFilesCount of the Element http-file-cache
293     * @return the MaxFilesCount of the Element http-file-cache
294     */

295     public String JavaDoc getMaxFilesCount() {
296         return getAttributeValue(ServerTags.MAX_FILES_COUNT);
297     }
298     /**
299     * Modify the MaxFilesCount of the Element http-file-cache
300     * @param v the new value
301     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
302     */

303     public void setMaxFilesCount(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
304         setAttributeValue(ServerTags.MAX_FILES_COUNT, v, overwrite);
305     }
306     /**
307     * Modify the MaxFilesCount of the Element http-file-cache
308     * @param v the new value
309     */

310     public void setMaxFilesCount(String JavaDoc v) {
311         setAttributeValue(ServerTags.MAX_FILES_COUNT, v);
312     }
313     /**
314     * Get the default value of MaxFilesCount from dtd
315     */

316     public static String JavaDoc getDefaultMaxFilesCount() {
317         return "1024".trim();
318     }
319     /**
320     * Getter for HashInitSize of the Element http-file-cache
321     * @return the HashInitSize of the Element http-file-cache
322     */

323     public String JavaDoc getHashInitSize() {
324         return getAttributeValue(ServerTags.HASH_INIT_SIZE);
325     }
326     /**
327     * Modify the HashInitSize of the Element http-file-cache
328     * @param v the new value
329     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
330     */

331     public void setHashInitSize(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
332         setAttributeValue(ServerTags.HASH_INIT_SIZE, v, overwrite);
333     }
334     /**
335     * Modify the HashInitSize of the Element http-file-cache
336     * @param v the new value
337     */

338     public void setHashInitSize(String JavaDoc v) {
339         setAttributeValue(ServerTags.HASH_INIT_SIZE, v);
340     }
341     /**
342     * Get the default value of HashInitSize from dtd
343     */

344     public static String JavaDoc getDefaultHashInitSize() {
345         return "0".trim();
346     }
347     /**
348     * get the xpath representation for this element
349     * returns something like abc[@name='value'] or abc
350     * depending on the type of the bean
351     */

352     protected String JavaDoc getRelativeXPath() {
353         String JavaDoc ret = null;
354         ret = "http-file-cache";
355         return (null != ret ? ret.trim() : null);
356     }
357
358     /*
359     * generic method to get default value from dtd
360     */

361     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
362         if(attr == null) return null;
363         attr = attr.trim();
364         if(attr.equals(ServerTags.GLOBALLY_ENABLED)) return "true".trim();
365         if(attr.equals(ServerTags.FILE_CACHING_ENABLED)) return "on".trim();
366         if(attr.equals(ServerTags.MAX_AGE_IN_SECONDS)) return "30".trim();
367         if(attr.equals(ServerTags.MEDIUM_FILE_SIZE_LIMIT_IN_BYTES)) return "537600".trim();
368         if(attr.equals(ServerTags.MEDIUM_FILE_SPACE_IN_BYTES)) return "10485760".trim();
369         if(attr.equals(ServerTags.SMALL_FILE_SIZE_LIMIT_IN_BYTES)) return "2048".trim();
370         if(attr.equals(ServerTags.SMALL_FILE_SPACE_IN_BYTES)) return "1048576".trim();
371         if(attr.equals(ServerTags.FILE_TRANSMISSION_ENABLED)) return "false".trim();
372         if(attr.equals(ServerTags.MAX_FILES_COUNT)) return "1024".trim();
373         if(attr.equals(ServerTags.HASH_INIT_SIZE)) return "0".trim();
374     return null;
375     }
376     //
377
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
378         comparators.add(c);
379     }
380
381     //
382
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
383         comparators.remove(c);
384     }
385     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
386     }
387
388     // Dump the content of this bean returning it as a String
389
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
390         String JavaDoc s;
391         Object JavaDoc o;
392         org.netbeans.modules.schema2beans.BaseBean n;
393     }
394     public String JavaDoc dumpBeanNode(){
395         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
396         str.append("HttpFileCache\n"); // NOI18N
397
this.dump(str, "\n "); // NOI18N
398
return str.toString();
399     }}
400
401 // END_NOI18N
402

403
Popular Tags