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

org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry Class Reference

Inheritance diagram for org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry:

Inheritance graph
[legend]
Collaboration diagram for org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ResultCacheEntry (SelectRequest request, ControllerResultSet result)
abstract String getType ()
String getState ()
boolean isValid ()
boolean isDirty ()
SelectRequest getRequest ()
ControllerResultSet getResult ()
void setResult (ControllerResultSet result)
abstract void invalidate ()
void markDirty ()
void setValid ()
CacheEntry getNext ()
void setNext (CacheEntry next)
CacheEntry getPrev ()
void setPrev (CacheEntry prev)
abstract String[] toStringTable ()
int getSizeOfResult ()

Protected Attributes

SelectRequest request
ControllerResultSet result
int state

Detailed Description

A CacheEntry represents a SQL select request with its reponse. The cache entry can have 3 states:

Author:
Emmanuel Cecchet
Version:
1.0

Definition at line 46 of file ResultCacheEntry.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.ResultCacheEntry SelectRequest  request,
ControllerResultSet  result
 

Creates a new CacheEntry instance.

Parameters:
request a SelectRequest value
result a ControllerResultSet value

Definition at line 61 of file ResultCacheEntry.java.

00062   {
00063     this.request = request;
00064     this.result = result;
00065     state = CACHE_VALID;
00066     next = null;
00067     prev = null;
00068   }


Member Function Documentation

CacheEntry org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getNext  ) 
 

Gets the value of next ResultCacheEntry in LRU.

Returns:
value of next.

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 177 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.getFromCache(), and org.objectweb.cjdbc.controller.cache.result.ResultCache.removeFromCache().

00178   {
00179     return next;
00180   }

CacheEntry org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getPrev  ) 
 

Gets the value of previous ResultCacheEntry in LRU.

Returns:
value of previous.

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 197 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.getFromCache(), and org.objectweb.cjdbc.controller.cache.result.ResultCache.removeFromCache().

00198   {
00199     return prev;
00200   }

SelectRequest org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getRequest  ) 
 

Returns the SELECT request of this cache entry.

Returns:
a SelectRequest value

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 119 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.getFromCache(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAllExceptPk(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processAddToCache(), org.objectweb.cjdbc.controller.cache.result.threads.RelaxedCacheThread.run(), and org.objectweb.cjdbc.controller.cache.result.threads.EagerCacheThread.run().

00120   {
00121     return request;
00122   }

ControllerResultSet org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getResult  ) 
 

Returns the ControllerResultSet of the cached select request

Returns:
a ControllerResultSet value

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 129 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.getFromCache(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.isUpdateNecessary(), and org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processWriteNotify().

00130   {
00131     return result;
00132   }

int org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getSizeOfResult  ) 
 

Size of the result in bytes

Returns:
an integer

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 224 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryRelaxed.toStringTable(), and org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryEager.toStringTable().

00225   {
00226     try
00227     {
00228       return CJDBCStream.countBytes(result);
00229     }
00230     catch (Exception e)
00231     {
00232       return -1;
00233     }
00234   }

String org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getState  ) 
 

Get the state of this entry as a string

Returns:
Valid or Dirty or Invalid

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 82 of file ResultCacheEntry.java.

References org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.isDirty(), and org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.isValid().

Referenced by org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryRelaxed.toStringTable(), and org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryEager.toStringTable().

00083   {
00084     if (isValid())
00085       return "Valid";
00086     if (isDirty())
00087       return "Dirty";
00088     else
00089       return "Invalid";
00090   }

abstract String org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getType  )  [pure virtual]
 

Get the type of this entry as a string

Returns:
NoCache or Eager or Relaxed

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Implemented in org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryEager, org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryNoCache, and org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryRelaxed.

abstract void org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.invalidate  )  [pure virtual]
 

Invalidates this cache entry (removes the ResultSet and turn state to CACHE_INVALID).

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Implemented in org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryEager, org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryNoCache, and org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryRelaxed.

Referenced by org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAll(), org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.invalidateAllExceptPk(), and org.objectweb.cjdbc.controller.cache.result.schema.CacheDatabaseTable.removePkResultCacheEntry().

boolean org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.isDirty  ) 
 

Returns true if cache entry state is marked dirty (state is CACHE_DIRTY).

Returns:
a boolean value

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 109 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getState(), and org.objectweb.cjdbc.controller.cache.result.threads.RelaxedCacheThread.run().

00110   {
00111     return state == CACHE_DIRTY;
00112   }

boolean org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.isValid  ) 
 

Return true if cache entry state is valid (state is CACHE_VALID).

Returns:
a boolean value

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 98 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.getFromCache(), org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.getState(), org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.isUpdateNecessary(), and org.objectweb.cjdbc.controller.cache.result.ResultCacheColumnUnique.processAddToCache().

00099   {
00100     return state == CACHE_VALID;
00101   }

void org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.markDirty  ) 
 

Marks this entry dirty (state becomes CACHE_DIRTY).

The ResultSet if not affected by this method.

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 159 of file ResultCacheEntry.java.

00160   {
00161     state = CACHE_DIRTY;
00162   }

void org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.setNext CacheEntry  next  ) 
 

Sets the value of next ResultCacheEntry in LRU.

Parameters:
next value to assign to next.

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 187 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.getFromCache(), and org.objectweb.cjdbc.controller.cache.result.ResultCache.removeFromCache().

00188   {
00189     this.next = next;
00190   }

void org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.setPrev CacheEntry  prev  ) 
 

Sets the value of previous ResultCacheEntry in LRU.

Parameters:
prev value to assign to prev.

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 207 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.getFromCache(), and org.objectweb.cjdbc.controller.cache.result.ResultCache.removeFromCache().

00208   {
00209     this.prev = prev;
00210   }

void org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.setResult ControllerResultSet  result  ) 
 

Set a new ControllerResultSet of the cached select request (cache update).

The cache state is automatically set to valid (CACHE_VALID).

Parameters:
result a ControllerResultSet value

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 142 of file ResultCacheEntry.java.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.removeFromCache().

00143   {
00144     this.result = result;
00145     state = CACHE_VALID;
00146   }

void org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.setValid  ) 
 

Marks this entry valid (state becomes CACHE_VALID).

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Definition at line 167 of file ResultCacheEntry.java.

00168   {
00169     state = CACHE_VALID;
00170   }

abstract String [] org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntry.toStringTable  )  [pure virtual]
 

Get data about this entry

Returns:
an array [request,type,status(valid,notvalid,dirty),deadLine]

Implements org.objectweb.cjdbc.controller.cache.result.entries.CacheEntry.

Implemented in org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryEager, org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryNoCache, and org.objectweb.cjdbc.controller.cache.result.entries.ResultCacheEntryRelaxed.

Referenced by org.objectweb.cjdbc.controller.cache.result.ResultCache.getCacheData().


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