org.norther.tammi.root.ojb.cache
Class OJBCacheAdapter

java.lang.Object
  extended by org.norther.tammi.root.db.cache.FactoryCacheAdapter
      extended by org.norther.tammi.root.ojb.cache.OJBCacheAdapter
All Implemented Interfaces:
ObjectCache, ObjectCacheInternal

public class OJBCacheAdapter
extends FactoryCacheAdapter
implements ObjectCacheInternal

An adapter to the OJB factory cache.

Note that it works only when separately activated, typically from the local part of the two level cache system.

Author:
Ilkka Priha

Field Summary
 
Fields inherited from class org.norther.tammi.root.db.cache.FactoryCacheAdapter
ALLOW_EXPIRED_PROPERTY, AUTO_REFRESH_DECLINED_PROPERTY, DEFAULT_EXPIRATION_TIME_PROPERTY, DISCARD_OVERLOADED_PROPERTY, EXPIRATION_LIMIT_PROPERTY, EXPIRATION_SLEEP_INTERVAL_PROPERTY, EXPIRATION_THRESHOLD_PROPERTY, MAX_EXPIRATION_TIME_PROPERTY
 
Fields inherited from interface org.apache.ojb.broker.cache.ObjectCacheInternal
TYPE_CACHED_READ, TYPE_NEW_MATERIALIZED, TYPE_TEMP, TYPE_UNKNOWN, TYPE_WRITE
 
Constructor Summary
OJBCacheAdapter(PersistenceBroker broker, Properties props)
          Constructs a new adapter.
 
Method Summary
 void activate()
          Activates the cache.
 void cache(Identity oid, Object value)
           
 boolean cacheIfNew(Identity oid, Object value)
           
 void clear()
           
 void doInternalCache(Identity oid, Object value, int type)
           
protected  ConcurrentMap getClientCache()
          Gets the client cache.
 boolean isActivated()
          Checks whether activated.
 Object lookup(Identity oid)
           
 void remove(Identity oid)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OJBCacheAdapter

public OJBCacheAdapter(PersistenceBroker broker,
                       Properties props)
Constructs a new adapter.

Parameters:
broker - the persistence broker.
props - the configuration properties.
Method Detail

lookup

public Object lookup(Identity oid)
Specified by:
lookup in interface ObjectCache

cache

public void cache(Identity oid,
                  Object value)
Specified by:
cache in interface ObjectCache

remove

public void remove(Identity oid)
Specified by:
remove in interface ObjectCache

clear

public void clear()
Specified by:
clear in interface ObjectCache

doInternalCache

public void doInternalCache(Identity oid,
                            Object value,
                            int type)
Specified by:
doInternalCache in interface ObjectCacheInternal

cacheIfNew

public boolean cacheIfNew(Identity oid,
                          Object value)
Specified by:
cacheIfNew in interface ObjectCacheInternal

isActivated

public boolean isActivated()
Checks whether activated.

Returns:
true if activated, false otherwise.

activate

public void activate()
Activates the cache.


getClientCache

protected ConcurrentMap getClientCache()
Gets the client cache.

Overrides:
getClientCache in class FactoryCacheAdapter
Returns:
the client cache or null.


Copyright © 2004 The Norther Organization. All rights reserved.