src/org/objectweb/cjdbc/controller/cache/result/ResultCacheFactory.java

説明を見る。
00001 00025 package org.objectweb.cjdbc.controller.cache.result; 00026 00027 import java.util.Hashtable; 00028 00029 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags; 00030 import org.objectweb.cjdbc.controller.cache.result.rules.EagerCaching; 00031 import org.objectweb.cjdbc.controller.cache.result.rules.NoCaching; 00032 import org.objectweb.cjdbc.controller.cache.result.rules.RelaxedCaching; 00033 00040 public class ResultCacheFactory 00041 { 00052 public static AbstractResultCache getCacheInstance(int granularityValue, 00053 int maxEntries, int pendingTimeout) throws InstantiationException 00054 { 00055 AbstractResultCache currentRequestCache = null; 00056 switch (granularityValue) 00057 { 00058 case CachingGranularities.TABLE : 00059 currentRequestCache = new ResultCacheTable(maxEntries, pendingTimeout); 00060 break; 00061 case CachingGranularities.DATABASE : 00062 currentRequestCache = new ResultCacheDatabase(maxEntries, 00063 pendingTimeout); 00064 break; 00065 case CachingGranularities.COLUMN : 00066 currentRequestCache = new ResultCacheColumn(maxEntries, pendingTimeout); 00067 break; 00068 case CachingGranularities.COLUMN_UNIQUE : 00069 currentRequestCache = new ResultCacheColumnUnique(maxEntries, 00070 pendingTimeout); 00071 break; 00072 default : 00073 throw new InstantiationException("Invalid Granularity Value"); 00074 } 00075 return currentRequestCache; 00076 } 00077 00085 public static CacheBehavior getCacheBehaviorInstance(String behaviorString, 00086 Hashtable options) 00087 { 00088 if (behaviorString.equalsIgnoreCase(DatabasesXmlTags.ELT_NoCaching)) 00089 return new NoCaching(); 00090 if (behaviorString.equals(DatabasesXmlTags.ELT_EagerCaching)) 00091 return new EagerCaching(); 00092 if (behaviorString.equals(DatabasesXmlTags.ELT_RelaxedCaching)) 00093 { 00094 // Timeout is in seconds: *1000 00095 long timeout = 1000 * Long.parseLong((String) options 00096 .get(DatabasesXmlTags.ATT_timeout)); 00097 boolean keepIfNotDirty = new Boolean((String) options 00098 .get(DatabasesXmlTags.ATT_keepIfNotDirty)).booleanValue(); 00099 return new RelaxedCaching(keepIfNotDirty, timeout); 00100 } 00101 else 00102 return null; 00103 } 00104 }

CJDBCversion1.0.4に対してTue Oct 12 15:16:00 2004に生成されました。 doxygen 1.3.8