org.apache.jetspeed.page.impl
Class DatabasePageManagerCache

java.lang.Object
  extended by org.apache.jetspeed.page.impl.DatabasePageManagerCache
All Implemented Interfaces:
org.apache.ojb.broker.cache.ObjectCache

public class DatabasePageManagerCache
extends Object
implements org.apache.ojb.broker.cache.ObjectCache

DatabasePageManagerCache

Version:
$Id: $
Author:
Randy Watler

Nested Class Summary
private static class DatabasePageManagerCache.Entry
          Entry Cache entry class adding entry timestamp to track expiration
 
Field Summary
private static HashMap cacheByOID
           
private static HashMap cacheByPath
           
private static int cacheExpiresSeconds
           
private static LinkedList cacheLRUList
           
private static int cacheSize
           
private static boolean constraintsEnabled
           
private static org.apache.jetspeed.page.PageManager pageManager
           
private static boolean permissionsEnabled
           
protected static ThreadLocal transactionedOperations
           
 
Constructor Summary
DatabasePageManagerCache(org.apache.ojb.broker.PersistenceBroker broker, Properties props)
          DatabasePageManagerCache Construct a cache instance using OJB compliant signatures.
 
Method Summary
static void addTransaction(TransactionedOperation operation)
           
 void cache(org.apache.ojb.broker.Identity oid, Object obj)
           
static void cacheAdd(org.apache.ojb.broker.Identity oid, Object obj)
          cacheAdd Add object to cache and cache node instances by unique path; infuse nodes loaded by OJB with page manager configuration.
static void cacheClear()
          cacheClear Clear object and node caches.
static void cacheInit(DatabasePageManager dbPageManager)
          cacheInit Initialize cache using page manager configuration.
static Object cacheLookup(org.apache.ojb.broker.Identity oid)
          cacheLookup Lookup objects by identity.
static NodeImpl cacheLookup(String path)
          cacheLookup Lookup node instances by unique path.
static void cacheRemove(org.apache.ojb.broker.Identity oid)
          cacheRemove Remove identified object from object and node caches.
static void cacheRemove(String path)
          cacheRemove Remove identified object from object and node caches.
private static void cacheRemoveEntry(DatabasePageManagerCache.Entry entry, boolean remove)
          cacheRemoveEntry Remove specified entry from cache.
private static Object cacheValidateEntry(DatabasePageManagerCache.Entry entry)
          cacheValidateEntry Validate specified entry from cache, returning cached object if valid.
 void clear()
           
static void dump()
           
static List getTransactions()
           
 Object lookup(org.apache.ojb.broker.Identity oid)
           
 void remove(org.apache.ojb.broker.Identity oid)
           
static void resetCachedSecurityConstraints()
          resetCachedSecurityConstraints Reset cached security constraints in all cached node objects.
static void rollbackTransactions()
           
static void setPageManagerProxy(org.apache.jetspeed.page.PageManager proxy)
          setPageManagerProxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheByOID

private static HashMap cacheByOID

cacheLRUList

private static LinkedList cacheLRUList

cacheByPath

private static HashMap cacheByPath

cacheSize

private static int cacheSize

cacheExpiresSeconds

private static int cacheExpiresSeconds

constraintsEnabled

private static boolean constraintsEnabled

permissionsEnabled

private static boolean permissionsEnabled

pageManager

private static org.apache.jetspeed.page.PageManager pageManager

transactionedOperations

protected static ThreadLocal transactionedOperations
Constructor Detail

DatabasePageManagerCache

public DatabasePageManagerCache(org.apache.ojb.broker.PersistenceBroker broker,
                                Properties props)
DatabasePageManagerCache Construct a cache instance using OJB compliant signatures.

Parameters:
broker - broker that is to own cache
props - attribute properties passed to cache
Method Detail

cacheInit

public static void cacheInit(DatabasePageManager dbPageManager)
cacheInit Initialize cache using page manager configuration.

Parameters:
pageManager - configured page manager

setPageManagerProxy

public static void setPageManagerProxy(org.apache.jetspeed.page.PageManager proxy)
setPageManagerProxy

Parameters:
proxy - proxied page manager interface used to inject into Folder instances to provide transaction/interception

cacheLookup

public static NodeImpl cacheLookup(String path)
cacheLookup Lookup node instances by unique path.

Parameters:
path - node unique path
Returns:
cached node

cacheAdd

public static void cacheAdd(org.apache.ojb.broker.Identity oid,
                            Object obj)
cacheAdd Add object to cache and cache node instances by unique path; infuse nodes loaded by OJB with page manager configuration.

Parameters:
oid - object/node indentity
obj - object/node to cache

cacheClear

public static void cacheClear()
cacheClear Clear object and node caches.


cacheLookup

public static Object cacheLookup(org.apache.ojb.broker.Identity oid)
cacheLookup Lookup objects by identity.

Parameters:
oid - object identity
Returns:
cached object

cacheRemove

public static void cacheRemove(org.apache.ojb.broker.Identity oid)
cacheRemove Remove identified object from object and node caches.

Parameters:
oid - object identity

cacheRemove

public static void cacheRemove(String path)
cacheRemove Remove identified object from object and node caches.

Parameters:
path - object path

cacheValidateEntry

private static Object cacheValidateEntry(DatabasePageManagerCache.Entry entry)
cacheValidateEntry Validate specified entry from cache, returning cached object if valid.

Parameters:
entry - cache entry to validate
Returns:
validated object from cache

cacheRemoveEntry

private static void cacheRemoveEntry(DatabasePageManagerCache.Entry entry,
                                     boolean remove)
cacheRemoveEntry Remove specified entry from cache.

Parameters:
entry - cache entry to remove
remove - enable removal from cache

resetCachedSecurityConstraints

public static void resetCachedSecurityConstraints()
resetCachedSecurityConstraints Reset cached security constraints in all cached node objects.


cache

public void cache(org.apache.ojb.broker.Identity oid,
                  Object obj)
Specified by:
cache in interface org.apache.ojb.broker.cache.ObjectCache

clear

public void clear()
Specified by:
clear in interface org.apache.ojb.broker.cache.ObjectCache

lookup

public Object lookup(org.apache.ojb.broker.Identity oid)
Specified by:
lookup in interface org.apache.ojb.broker.cache.ObjectCache

remove

public void remove(org.apache.ojb.broker.Identity oid)
Specified by:
remove in interface org.apache.ojb.broker.cache.ObjectCache

dump

public static void dump()

getTransactions

public static List getTransactions()

addTransaction

public static void addTransaction(TransactionedOperation operation)
Parameters:
principal - The principal to set.

rollbackTransactions

public static void rollbackTransactions()


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.