scone.netobjects
Class AccessCache

java.lang.Object
  extended by java.util.Observable
      extended by scone.netobjects.AccessCache
All Implemented Interfaces:
TableRecordCacheInterface

public class AccessCache
extends java.util.Observable
implements TableRecordCacheInterface

caches the access table from the database and provides means to update the database

Author:
Harald Weinreich, Volkert Buchmann

Field Summary
protected static CacheTable cache
           
static java.lang.Object lock
           
protected static AccessCache observable
           
 
Constructor Summary
AccessCache()
           
 
Method Summary
static void broadcastEvent(AccessEvent event)
           
static void clean()
           
static java.lang.String createKey(java.lang.String userId, java.lang.String nodeId, java.lang.String timeString, java.lang.String frameName)
           
static Access get(java.lang.String userId, java.lang.String nodeId, long time, java.lang.String frameName)
          returns an Access object to a specific key
static int getAccessCount(java.lang.String sqlClause)
          This method returns a number of Accesses to a given query string.
static int getAccessCount(java.lang.String tables, java.lang.String sqlClause)
          This method returns a number of Accesses to a given query string.
static java.util.Vector getAccesses(java.lang.String sqlClause)
          This method returns a Vector of Access-Objects to a given query string
static void init(int timeTillCleanUp, int gcType)
          creates a new CacheTable, generates a new Connection and a lock object
static void putObserver(java.util.Observer o)
          adds an Observer to the AccessCache class.
static void removeObserver(java.util.Observer o)
          removes an Observer from the AccessCache class.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected static CacheTable cache

lock

public static java.lang.Object lock

observable

protected static AccessCache observable
Constructor Detail

AccessCache

public AccessCache()
Method Detail

init

public static void init(int timeTillCleanUp,
                        int gcType)
creates a new CacheTable, generates a new Connection and a lock object

Parameters:
timeTillCleanUp - how long between runs of clean()
gcType - how soon are the objects removed from the memory

get

public static Access get(java.lang.String userId,
                         java.lang.String nodeId,
                         long time,
                         java.lang.String frameName)
returns an Access object to a specific key

Parameters:
userId: - The id of the user (from cookie)
nodeId: - The current Node
time: - The (start) time of the access
frameName: - Name of the frame or window (given or generated by Scone)

getAccesses

public static java.util.Vector getAccesses(java.lang.String sqlClause)
This method returns a Vector of Access-Objects to a given query string

Parameters:
sqlClause - The where clause for the query string.

getAccessCount

public static int getAccessCount(java.lang.String tables,
                                 java.lang.String sqlClause)
This method returns a number of Accesses to a given query string.

Parameters:
tables - The table names.
sqlClause - The where clause for the query string.
Returns:
The number of nodes.

getAccessCount

public static int getAccessCount(java.lang.String sqlClause)
This method returns a number of Accesses to a given query string.

Parameters:
sqlClause - The where clause for the query string.
Returns:
The number of nodes.

createKey

public static java.lang.String createKey(java.lang.String userId,
                                         java.lang.String nodeId,
                                         java.lang.String timeString,
                                         java.lang.String frameName)

clean

public static void clean()

putObserver

public static void putObserver(java.util.Observer o)
adds an Observer to the AccessCache class.
Use this static method instead of addObserver() !

Parameters:
o - the Observer

removeObserver

public static void removeObserver(java.util.Observer o)
removes an Observer from the AccessCache class.
Use this static method instead of deleteObserver() !

Parameters:
o - the Observer

broadcastEvent

public static void broadcastEvent(AccessEvent event)