1 23 24 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 ; 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 43 public class HttpFileCache extends ConfigBean implements Serializable 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 initPropertyTables(0); 59 this.initialize(options); 60 } 61 62 void initialize(int options) { 64 65 } 66 67 71 public boolean isGloballyEnabled() { 72 return toBoolean(getAttributeValue(ServerTags.GLOBALLY_ENABLED)); 73 } 74 79 public void setGloballyEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 80 setAttributeValue(ServerTags.GLOBALLY_ENABLED, ""+(v==true), overwrite); 81 } 82 86 public void setGloballyEnabled(boolean v) { 87 setAttributeValue(ServerTags.GLOBALLY_ENABLED, ""+(v==true)); 88 } 89 92 public static String getDefaultGloballyEnabled() { 93 return "true".trim(); 94 } 95 99 public String getFileCachingEnabled() { 100 return getAttributeValue(ServerTags.FILE_CACHING_ENABLED); 101 } 102 107 public void setFileCachingEnabled(String v, boolean overwrite) throws StaleWriteConfigException { 108 setAttributeValue(ServerTags.FILE_CACHING_ENABLED, v, overwrite); 109 } 110 114 public void setFileCachingEnabled(String v) { 115 setAttributeValue(ServerTags.FILE_CACHING_ENABLED, v); 116 } 117 120 public static String getDefaultFileCachingEnabled() { 121 return "on".trim(); 122 } 123 127 public String getMaxAgeInSeconds() { 128 return getAttributeValue(ServerTags.MAX_AGE_IN_SECONDS); 129 } 130 135 public void setMaxAgeInSeconds(String v, boolean overwrite) throws StaleWriteConfigException { 136 setAttributeValue(ServerTags.MAX_AGE_IN_SECONDS, v, overwrite); 137 } 138 142 public void setMaxAgeInSeconds(String v) { 143 setAttributeValue(ServerTags.MAX_AGE_IN_SECONDS, v); 144 } 145 148 public static String getDefaultMaxAgeInSeconds() { 149 return "30".trim(); 150 } 151 155 public String getMediumFileSizeLimitInBytes() { 156 return getAttributeValue(ServerTags.MEDIUM_FILE_SIZE_LIMIT_IN_BYTES); 157 } 158 163 public void setMediumFileSizeLimitInBytes(String v, boolean overwrite) throws StaleWriteConfigException { 164 setAttributeValue(ServerTags.MEDIUM_FILE_SIZE_LIMIT_IN_BYTES, v, overwrite); 165 } 166 170 public void setMediumFileSizeLimitInBytes(String v) { 171 setAttributeValue(ServerTags.MEDIUM_FILE_SIZE_LIMIT_IN_BYTES, v); 172 } 173 176 public static String getDefaultMediumFileSizeLimitInBytes() { 177 return "537600".trim(); 178 } 179 183 public String getMediumFileSpaceInBytes() { 184 return getAttributeValue(ServerTags.MEDIUM_FILE_SPACE_IN_BYTES); 185 } 186 191 public void setMediumFileSpaceInBytes(String v, boolean overwrite) throws StaleWriteConfigException { 192 setAttributeValue(ServerTags.MEDIUM_FILE_SPACE_IN_BYTES, v, overwrite); 193 } 194 198 public void setMediumFileSpaceInBytes(String v) { 199 setAttributeValue(ServerTags.MEDIUM_FILE_SPACE_IN_BYTES, v); 200 } 201 204 public static String getDefaultMediumFileSpaceInBytes() { 205 return "10485760".trim(); 206 } 207 211 public String getSmallFileSizeLimitInBytes() { 212 return getAttributeValue(ServerTags.SMALL_FILE_SIZE_LIMIT_IN_BYTES); 213 } 214 219 public void setSmallFileSizeLimitInBytes(String v, boolean overwrite) throws StaleWriteConfigException { 220 setAttributeValue(ServerTags.SMALL_FILE_SIZE_LIMIT_IN_BYTES, v, overwrite); 221 } 222 226 public void setSmallFileSizeLimitInBytes(String v) { 227 setAttributeValue(ServerTags.SMALL_FILE_SIZE_LIMIT_IN_BYTES, v); 228 } 229 232 public static String getDefaultSmallFileSizeLimitInBytes() { 233 return "2048".trim(); 234 } 235 239 public String getSmallFileSpaceInBytes() { 240 return getAttributeValue(ServerTags.SMALL_FILE_SPACE_IN_BYTES); 241 } 242 247 public void setSmallFileSpaceInBytes(String v, boolean overwrite) throws StaleWriteConfigException { 248 setAttributeValue(ServerTags.SMALL_FILE_SPACE_IN_BYTES, v, overwrite); 249 } 250 254 public void setSmallFileSpaceInBytes(String v) { 255 setAttributeValue(ServerTags.SMALL_FILE_SPACE_IN_BYTES, v); 256 } 257 260 public static String getDefaultSmallFileSpaceInBytes() { 261 return "1048576".trim(); 262 } 263 267 public boolean isFileTransmissionEnabled() { 268 return toBoolean(getAttributeValue(ServerTags.FILE_TRANSMISSION_ENABLED)); 269 } 270 275 public void setFileTransmissionEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 276 setAttributeValue(ServerTags.FILE_TRANSMISSION_ENABLED, ""+(v==true), overwrite); 277 } 278 282 public void setFileTransmissionEnabled(boolean v) { 283 setAttributeValue(ServerTags.FILE_TRANSMISSION_ENABLED, ""+(v==true)); 284 } 285 288 public static String getDefaultFileTransmissionEnabled() { 289 return "false".trim(); 290 } 291 295 public String getMaxFilesCount() { 296 return getAttributeValue(ServerTags.MAX_FILES_COUNT); 297 } 298 303 public void setMaxFilesCount(String v, boolean overwrite) throws StaleWriteConfigException { 304 setAttributeValue(ServerTags.MAX_FILES_COUNT, v, overwrite); 305 } 306 310 public void setMaxFilesCount(String v) { 311 setAttributeValue(ServerTags.MAX_FILES_COUNT, v); 312 } 313 316 public static String getDefaultMaxFilesCount() { 317 return "1024".trim(); 318 } 319 323 public String getHashInitSize() { 324 return getAttributeValue(ServerTags.HASH_INIT_SIZE); 325 } 326 331 public void setHashInitSize(String v, boolean overwrite) throws StaleWriteConfigException { 332 setAttributeValue(ServerTags.HASH_INIT_SIZE, v, overwrite); 333 } 334 338 public void setHashInitSize(String v) { 339 setAttributeValue(ServerTags.HASH_INIT_SIZE, v); 340 } 341 344 public static String getDefaultHashInitSize() { 345 return "0".trim(); 346 } 347 352 protected String getRelativeXPath() { 353 String ret = null; 354 ret = "http-file-cache"; 355 return (null != ret ? ret.trim() : null); 356 } 357 358 361 public static String getDefaultAttributeValue(String 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 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 378 comparators.add(c); 379 } 380 381 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 public void dump(StringBuffer str, String indent){ 390 String s; 391 Object o; 392 org.netbeans.modules.schema2beans.BaseBean n; 393 } 394 public String dumpBeanNode(){ 395 StringBuffer str = new StringBuffer (); 396 str.append("HttpFileCache\n"); this.dump(str, "\n "); return str.toString(); 399 }} 400 401 403 | Popular Tags |