Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.controller.cache.result.AbstractResultCache Class Reference

Inheritance diagram for org.objectweb.cjdbc.controller.cache.result.AbstractResultCache:

Inheritance graph
[legend]
List of all members.

Public Member Functions

int getParsingGranularity ()
void setParsingGranularity (int parsingGranularity)
void setDatabaseSchema (DatabaseSchema dbs)
void mergeDatabaseSchema (DatabaseSchema dbs)
abstract void addCachingRule (ResultCacheRule rule)
abstract ResultCacheRule getDefaultRule ()
abstract void setDefaultRule (ResultCacheRule defaultRule)
abstract void addToCache (SelectRequest request, ControllerResultSet result) throws CacheException
abstract CacheEntry getFromCache (SelectRequest request, boolean addToPendingQueries)
abstract void removeFromCache (SelectRequest request)
abstract void removeFromPendingQueries (SelectRequest request)
abstract void writeNotify (AbstractWriteRequest request) throws CacheException
abstract boolean isUpdateNecessary (UpdateRequest request) throws CacheException
abstract void flushCache ()
abstract void commit (long transactionId) throws CacheException
abstract void rollback (long transactionId) throws CacheException
String getXml ()
abstract String[][] getCacheData () throws CacheException
abstract String[][] getCacheStatsData () throws CacheException
abstract CacheStatistics getCacheStatistics ()
abstract long getCacheSize ()

Protected Member Functions

abstract String getXmlImpl ()

Protected Attributes

int parsingGranularity = ParsingGranularities.NO_PARSING

Static Protected Attributes

Trace logger

Detailed Description

This class defines the minimal functionnalities that a request cache must provide.

Only read requests (SELECTs) can be cached, there is no sense to cache writes as they do not provide any result to cache. However, the cache must be notified of the write queries in order to maintain cache coherency.

Author:
Emmanuel Cecchet

Nicolas Modrzyk

Version:
1.0

Definition at line 53 of file AbstractResultCache.java.


Member Function Documentation

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.addCachingRule ResultCacheRule  rule  )  [pure virtual]
 

Add precise management and configuration of the cache behavior. A cache rule contains information on a query pattern and how to act if that pattern was matched.

Parameters:
rule of action for the cache
See also:
org.objectweb.cjdbc.controller.cache.result.ResultCacheRule

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.addToCache SelectRequest  request,
ControllerResultSet  result
throws CacheException [pure virtual]
 

Adds an entry request/reply to the cache. Note that if the request was already in the cache, its result must be updated in any case but the request must never appear twice in the cache.

Parameters:
request the request
result the result corresponding to the request
Exceptions:
CacheException if an error occurs

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.commit long  transactionId  )  throws CacheException [pure virtual]
 

Commit a transaction given its id.

Parameters:
transactionId the transaction id
Exceptions:
CacheException if an error occurs

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.flushCache  )  [pure virtual]
 

Removes all entries from the cache.

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

abstract String [][] org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getCacheData  )  throws CacheException [pure virtual]
 

Returns the content of the cache as displayable array of array of string

Returns:
the data
Exceptions:
CacheException if fails

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

Referenced by org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveCacheData().

abstract long org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getCacheSize  )  [pure virtual]
 

Returns number of entries in the cache

Returns:
integer value representing the total number of entries

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

abstract CacheStatistics org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getCacheStatistics  )  [pure virtual]
 

Returns pointer to the stats collector

Returns:
CacheStatistics object

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

abstract String [][] org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getCacheStatsData  )  throws CacheException [pure virtual]
 

Returns a bunch of stats collected by the cache, such as cache hits.

Returns:
the data
Exceptions:
CacheException if fails to collect the data.

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

Referenced by org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveCacheStatsData().

abstract ResultCacheRule org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getDefaultRule  )  [pure virtual]
 

Return the default cache rule

Returns:
default query cache rule. Cannot be null

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

abstract CacheEntry org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getFromCache SelectRequest  request,
boolean  addToPendingQueries
[pure virtual]
 

Gets the result to the given request from the cache.

The returned ResultCacheEntry is null if the request is not present in the cache.

An invalid CacheEntry may be returned (it means that the result is null) but the already parsed query can be retrieved from the cache entry.

Parameters:
request an SQL select request
addToPendingQueries true if the request must be added to the pending query list on a cache miss
Returns:
the ResultCacheEntry if found, else null

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

int org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getParsingGranularity  ) 
 

Gets the needed query parsing granularity.

Returns:
needed query parsing granularity
See also:
setParsingGranularity

Reimplemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

Definition at line 84 of file AbstractResultCache.java.

00085   {
00086     return parsingGranularity;
00087   }

String org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getXml  ) 
 

See also:
org.objectweb.cjdbc.common.xml.XmlComponent.getXml()

Definition at line 259 of file AbstractResultCache.java.

References org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getXmlImpl().

00261   {
00262     return getXmlImpl();
00263   }

abstract String org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getXmlImpl  )  [protected, pure virtual]
 

Gets information about the request cache in xml

Returns:
xml formatted String containing information

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

Referenced by org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getXml().

abstract boolean org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.isUpdateNecessary UpdateRequest  request  )  throws CacheException [pure virtual]
 

Returns true if the cache does not contain the values that are given in the update statement.

Parameters:
request the update request that needs to be executed
Returns:
false if the request shouldn't be executed, true otherwise.
Exceptions:
CacheException if an error occurs

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache, org.objectweb.cjdbc.controller.cache.result.ResultCacheColumn, org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique, org.objectweb.cjdbc.controller.cache.result.ResultCacheDatabase, and org.objectweb.cjdbc.controller.cache.result.ResultCacheTable.

void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.mergeDatabaseSchema DatabaseSchema  dbs  ) 
 

Merge the given DatabaseSchema with the current one.

Parameters:
dbs a DatabaseSchema value
See also:
org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema

Reimplemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

Definition at line 118 of file AbstractResultCache.java.

References org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.logger.

00119   {
00120     if (logger.isInfoEnabled())
00121       logger.info(Translate.get("cache.scheduler.doesnt.support.schemas"));
00122   }

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.removeFromCache SelectRequest  request  )  [pure virtual]
 

Removes an entry from the cache (both request and reply are dropped). The request is NOT removed from the pending query list, but it shouldn't be in this list.

Parameters:
request a SelectRequest

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

Referenced by org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryEager.invalidate().

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.removeFromPendingQueries SelectRequest  request  )  [pure virtual]
 

Removes an entry from the pending query list.

Parameters:
request a SelectRequest

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.rollback long  transactionId  )  throws CacheException [pure virtual]
 

Rollback a transaction given its id.

Parameters:
transactionId the transaction id
Exceptions:
CacheException if an error occurs

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.setDatabaseSchema DatabaseSchema  dbs  ) 
 

Sets the DatabaseSchema of the current virtual database.

Parameters:
dbs a DatabaseSchema value
See also:
org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseSchema

Reimplemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

Definition at line 106 of file AbstractResultCache.java.

References org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.logger.

00107   {
00108     if (logger.isInfoEnabled())
00109       logger.info(Translate.get("cache.schemas.not.supported"));
00110   }

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.setDefaultRule ResultCacheRule  defaultRule  )  [pure virtual]
 

Set the default query rule

Parameters:
defaultRule default rule to set

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.

void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.setParsingGranularity int  parsingGranularity  ) 
 

Sets the needed query parsing granularity.

Parameters:
parsingGranularity the query parsing granularity to set
See also:
getParsingGranularity

Definition at line 95 of file AbstractResultCache.java.

00096   {
00097     this.parsingGranularity = parsingGranularity;
00098   }

abstract void org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.writeNotify AbstractWriteRequest  request  )  throws CacheException [pure virtual]
 

Notifies the cache that the given write request has been issued, so that cache coherency can be maintained. If the cache is distributed, this method is reponsible for broadcasting this information to other caches.

Parameters:
request an AbstractWriteRequest value
Exceptions:
CacheException if an error occurs

Implemented in org.objectweb.cjdbc.controller.cache.result.ResultCache.


Member Data Documentation

Trace org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.logger [static, protected]
 

Initial value:

 Trace
                                                .getLogger("org.objectweb.cjdbc.controller.cache")
Logger instance.

Definition at line 71 of file AbstractResultCache.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.mergeDatabaseSchema(), and org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.setDatabaseSchema().

int org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.parsingGranularity = ParsingGranularities.NO_PARSING [protected]
 

Parsing granularity. Default is: org.objectweb.cjdbc.common.sql.ParsingGranularities#NO_PARSING.

Definition at line 68 of file AbstractResultCache.java.


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:03:27 2005 for C-JDBC by  doxygen 1.3.9.1