001: // CacheProp.java
002: // $Id: CacheProp.java,v 1.16 2000/08/16 21:37:43 ylafon Exp $
003: // (c) COPYRIGHT MIT and INRIA, 1996.
004: // Please first read the full copyright statement in file COPYRIGHT.html
005:
006: package org.w3c.jigsaw.proxy;
007:
008: import org.w3c.tools.resources.Attribute;
009: import org.w3c.tools.resources.AttributeRegistry;
010: import org.w3c.tools.resources.BooleanAttribute;
011: import org.w3c.tools.resources.DoubleAttribute;
012: import org.w3c.tools.resources.FileAttribute;
013: import org.w3c.tools.resources.IntegerAttribute;
014: import org.w3c.tools.resources.LongAttribute;
015: import org.w3c.tools.resources.StringAttribute;
016:
017: import org.w3c.jigsaw.http.httpd;
018:
019: import org.w3c.jigsaw.config.PropertySet;
020:
021: import org.w3c.www.protocol.http.HttpManager;
022: import org.w3c.www.protocol.http.cache.CacheFilter;
023: import org.w3c.www.protocol.http.cache.CacheStore;
024:
025: class CacheProp extends PropertySet {
026: private static String title = "Cache properties";
027:
028: static {
029: Class c = null;
030: Attribute a = null;
031:
032: try {
033: c = Class.forName("org.w3c.jigsaw.proxy.CacheProp");
034: } catch (Exception ex) {
035: ex.printStackTrace();
036: System.exit(1);
037: }
038: // The Cache directory
039: a = new FileAttribute(CacheStore.CACHE_DIRECTORY_P, null,
040: Attribute.EDITABLE);
041: AttributeRegistry.registerAttribute(c, a);
042: // The cache size in bytes:
043: a = new LongAttribute(CacheFilter.CACHE_SIZE_P, new Long(
044: 20971520), Attribute.EDITABLE);
045: AttributeRegistry.registerAttribute(c, a);
046: // The cache store size (the maximum disc used by the resources,
047: // not the database or the headers
048: a = new LongAttribute(CacheStore.STORE_SIZE_P, new Long(
049: 23068672), Attribute.EDITABLE);
050: AttributeRegistry.registerAttribute(c, a);
051: // The debug flag:
052: a = new BooleanAttribute(CacheFilter.DEBUG_P, Boolean.FALSE,
053: Attribute.EDITABLE);
054: AttributeRegistry.registerAttribute(c, a);
055: // The is-shared flag:
056: a = new BooleanAttribute(CacheFilter.SHARED_P, Boolean.TRUE,
057: Attribute.EDITABLE);
058: AttributeRegistry.registerAttribute(c, a);
059: // Is the cache to be connected ?
060: a = new BooleanAttribute(CacheFilter.CACHE_CONNECTED_P,
061: Boolean.TRUE, Attribute.EDITABLE);
062: AttributeRegistry.registerAttribute(c, a);
063: // Are garbage collections allowed ?
064: a = new BooleanAttribute(
065: CacheStore.GARBAGE_COLLECTION_ENABLED_P, Boolean.TRUE,
066: Attribute.EDITABLE);
067: AttributeRegistry.registerAttribute(c, a);
068: // The allowed file size ratio:
069: a = new DoubleAttribute(CacheStore.FILE_SIZE_RATIO_P,
070: new Double((double) 0.1), Attribute.EDITABLE);
071: AttributeRegistry.registerAttribute(c, a);
072: // the gabrage collection ration, the % of the cache to be kept
073: // after a gc
074: a = new DoubleAttribute(
075: CacheStore.GARBAGE_COLLECTION_THRESHOLD_P, new Double(
076: (double) 0.8), Attribute.EDITABLE);
077: AttributeRegistry.registerAttribute(c, a);
078: // the delay between two synchronization of the store
079: a = new LongAttribute(CacheStore.SYNCHRONIZATION_DELAY_P,
080: new Long(60000), Attribute.EDITABLE);
081: AttributeRegistry.registerAttribute(c, a);
082: // the delay between two attempts to compact generations
083: a = new LongAttribute(CacheStore.GENERATION_COMPACT_DELAY_P,
084: new Long(60000), Attribute.EDITABLE);
085: AttributeRegistry.registerAttribute(c, a);
086: // the maximum unmber of cached resources in the store
087: a = new IntegerAttribute(CacheStore.MAX_CACHED_RESOURCES_P,
088: new Integer(50000), Attribute.EDITABLE);
089: AttributeRegistry.registerAttribute(c, a);
090: // the maximum unmber of generations
091: a = new IntegerAttribute(CacheStore.MAX_GENERATIONS_P,
092: new Integer(10), Attribute.EDITABLE);
093: AttributeRegistry.registerAttribute(c, a);
094: // the Class of the validator
095: a = new StringAttribute(CacheFilter.VALIDATOR_P, null,
096: Attribute.EDITABLE);
097: AttributeRegistry.registerAttribute(c, a);
098: // the Class of the Sweeper
099: a = new StringAttribute(CacheFilter.SWEEPER_P, null,
100: Attribute.EDITABLE);
101: AttributeRegistry.registerAttribute(c, a);
102: // the Class of the Serializer
103: a = new StringAttribute(CacheFilter.SERIALIZER_P, null,
104: Attribute.EDITABLE);
105: AttributeRegistry.registerAttribute(c, a);
106: }
107:
108: /**
109: * Get this property set title.
110: * @return A String encoded title.
111: */
112:
113: public String getTitle() {
114: return title;
115: }
116:
117: CacheProp(String name, httpd server) {
118: super(name, server);
119: }
120: }
|