--- /dev/null
+// CacheProp.java\r
+// $Id: CacheProp.java,v 1.2 2010/06/15 17:53:07 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.jigsaw.proxy;\r
+\r
+import org.w3c.tools.resources.Attribute;\r
+import org.w3c.tools.resources.AttributeRegistry;\r
+import org.w3c.tools.resources.BooleanAttribute;\r
+import org.w3c.tools.resources.DoubleAttribute;\r
+import org.w3c.tools.resources.FileAttribute;\r
+import org.w3c.tools.resources.IntegerAttribute;\r
+import org.w3c.tools.resources.LongAttribute;\r
+import org.w3c.tools.resources.StringAttribute;\r
+\r
+import org.w3c.jigsaw.http.httpd;\r
+\r
+import org.w3c.jigsaw.config.PropertySet;\r
+\r
+import org.w3c.www.protocol.http.HttpManager;\r
+import org.w3c.www.protocol.http.cache.CacheFilter;\r
+import org.w3c.www.protocol.http.cache.CacheStore;\r
+\r
+class CacheProp extends PropertySet {\r
+ private static String title = "Cache properties";\r
+\r
+ static {\r
+ Class c = null;\r
+ Attribute a = null;\r
+\r
+ try {\r
+ c = Class.forName("org.w3c.jigsaw.proxy.CacheProp");\r
+ //Added by Jeff Huang\r
+ //TODO: FIXIT\r
+ } catch (Exception ex) {\r
+ ex.printStackTrace();\r
+ System.exit(1);\r
+ }\r
+ // The Cache directory\r
+ a = new FileAttribute(CacheStore.CACHE_DIRECTORY_P,\r
+ null,\r
+ Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // The cache size in bytes:\r
+ a = new LongAttribute(CacheFilter.CACHE_SIZE_P\r
+ , new Long(20971520)\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // The cache store size (the maximum disc used by the resources,\r
+ // not the database or the headers\r
+ a = new LongAttribute(CacheStore.STORE_SIZE_P\r
+ , new Long(23068672)\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // The debug flag:\r
+ a = new BooleanAttribute(CacheFilter.DEBUG_P\r
+ , Boolean.FALSE\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // The is-shared flag:\r
+ a = new BooleanAttribute(CacheFilter.SHARED_P\r
+ , Boolean.TRUE\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // Is the cache to be connected ?\r
+ a = new BooleanAttribute(CacheFilter.CACHE_CONNECTED_P\r
+ , Boolean.TRUE\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // Are garbage collections allowed ?\r
+ a = new BooleanAttribute(CacheStore.GARBAGE_COLLECTION_ENABLED_P\r
+ , Boolean.TRUE\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // The allowed file size ratio:\r
+ a = new DoubleAttribute(CacheStore.FILE_SIZE_RATIO_P\r
+ , new Double((double) 0.1)\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // the gabrage collection ration, the % of the cache to be kept\r
+ // after a gc\r
+ a = new DoubleAttribute(CacheStore.GARBAGE_COLLECTION_THRESHOLD_P\r
+ , new Double((double) 0.8)\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // the delay between two synchronization of the store\r
+ a = new LongAttribute(CacheStore.SYNCHRONIZATION_DELAY_P\r
+ , new Long(60000)\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // the delay between two attempts to compact generations\r
+ a = new LongAttribute(CacheStore.GENERATION_COMPACT_DELAY_P\r
+ , new Long(60000)\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // the maximum unmber of cached resources in the store\r
+ a = new IntegerAttribute(CacheStore.MAX_CACHED_RESOURCES_P\r
+ , new Integer(50000)\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // the maximum unmber of generations\r
+ a = new IntegerAttribute(CacheStore.MAX_GENERATIONS_P\r
+ , new Integer(10)\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // the Class of the validator\r
+ a = new StringAttribute(CacheFilter.VALIDATOR_P\r
+ , null\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // the Class of the Sweeper\r
+ a = new StringAttribute(CacheFilter.SWEEPER_P\r
+ , null\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ // the Class of the Serializer\r
+ a = new StringAttribute(CacheFilter.SERIALIZER_P\r
+ , null\r
+ , Attribute.EDITABLE);\r
+ AttributeRegistry.registerAttribute(c, a);\r
+ }\r
+ \r
+ /**\r
+ * Get this property set title.\r
+ * @return A String encoded title.\r
+ */\r
+\r
+ public String getTitle() {\r
+ return title;\r
+ }\r
+\r
+ CacheProp(String name, httpd server) {\r
+ super(name, server);\r
+ }\r
+}\r