1 24 25 package org.objectweb.cjdbc.controller.cache.result; 26 27 import org.objectweb.cjdbc.common.i18n.Translate; 28 import org.objectweb.cjdbc.common.log.Trace; 29 import org.objectweb.cjdbc.common.sql.AbstractWriteRequest; 30 import org.objectweb.cjdbc.common.sql.ParsingGranularities; 31 import org.objectweb.cjdbc.common.sql.SelectRequest; 32 import org.objectweb.cjdbc.common.sql.UpdateRequest; 33 import org.objectweb.cjdbc.common.sql.schema.DatabaseSchema; 34 import org.objectweb.cjdbc.common.xml.XmlComponent; 35 import org.objectweb.cjdbc.controller.cache.CacheException; 36 import org.objectweb.cjdbc.controller.cache.CacheStatistics; 37 import org.objectweb.cjdbc.controller.cache.result.entries.AbstractResultCacheEntry; 38 import org.objectweb.cjdbc.controller.virtualdatabase.ControllerResultSet; 39 40 53 public abstract class AbstractResultCache implements XmlComponent 54 { 55 64 68 protected int parsingGranularity = ParsingGranularities.NO_PARSING; 69 70 71 protected static Trace logger = Trace 72 .getLogger("org.objectweb.cjdbc.controller.cache"); 73 74 77 78 84 public int getParsingGranularity() 85 { 86 return parsingGranularity; 87 } 88 89 95 public void setParsingGranularity(int parsingGranularity) 96 { 97 this.parsingGranularity = parsingGranularity; 98 } 99 100 106 public void setDatabaseSchema(DatabaseSchema dbs) 107 { 108 if (logger.isInfoEnabled()) 109 logger.info(Translate.get("cache.schemas.not.supported")); 110 } 111 112 118 public void mergeDatabaseSchema(DatabaseSchema dbs) 119 { 120 if (logger.isInfoEnabled()) 121 logger.info(Translate.get("cache.scheduler.doesnt.support.schemas")); 122 } 123 124 127 128 136 public abstract void addCachingRule(ResultCacheRule rule); 137 138 143 public abstract ResultCacheRule getDefaultRule(); 144 145 150 public abstract void setDefaultRule(ResultCacheRule defaultRule); 151 152 161 public abstract void addToCache(SelectRequest request, 162 ControllerResultSet result) throws CacheException; 163 164 179 public abstract AbstractResultCacheEntry getFromCache(SelectRequest request, 180 boolean addToPendingQueries); 181 182 189 public abstract void removeFromCache(SelectRequest request); 190 191 196 public abstract void removeFromPendingQueries(SelectRequest request); 197 198 201 public abstract void shutdown(); 202 203 211 public abstract void writeNotify(AbstractWriteRequest request) 212 throws CacheException; 213 214 222 public abstract boolean isUpdateNecessary(UpdateRequest request) 223 throws CacheException; 224 225 228 public abstract void flushCache(); 229 230 234 240 public abstract void commit(long transactionId) throws CacheException; 241 242 248 public abstract void rollback(long transactionId) throws CacheException; 249 250 253 254 259 protected abstract String getXmlImpl(); 260 261 264 public String getXml() 265 266 { 267 return getXmlImpl(); 268 } 269 270 276 public abstract String [][] getCacheData() throws CacheException; 277 278 284 public abstract String [][] getCacheStatsData() throws CacheException; 285 286 291 public abstract CacheStatistics getCacheStatistics(); 292 293 298 public abstract long getCacheSize(); 299 300 } | Popular Tags |