org.jpox.cache
Class EhcacheLevel2Cache

java.lang.Object
  extended byorg.jpox.cache.EhcacheLevel2Cache
All Implemented Interfaces:
javax.jdo.datastore.DataStoreCache, org.jpox.cache.Level2Cache

public class EhcacheLevel2Cache
extends java.lang.Object
implements org.jpox.cache.Level2Cache

Simple implementation of a plugin for use of Ehcache caching product with JPOX. Please refer to ehcache.sourceforge.net for full details of their product.

Version:
$Revision: 1.6 $

Nested Class Summary
 
Nested classes inherited from class org.jpox.cache.Level2Cache
org.jpox.cache.Level2Cache.PinnedClass
 
Nested classes inherited from class javax.jdo.datastore.DataStoreCache
javax.jdo.datastore.DataStoreCache.EmptyDataStoreCache
 
Constructor Summary
EhcacheLevel2Cache(java.util.Properties props)
          Constructor.
 
Method Summary
 void clear()
          Method to clear the cache
 boolean containsOid(java.lang.Object oid)
          Accessor for whether the cache contains the specified id.
 void evict(java.lang.Object oid)
           
 void evictAll()
           
 void evictAll(java.lang.Class pcClass, boolean subclasses)
           
 void evictAll(java.util.Collection oids)
           
 void evictAll(java.lang.Object[] oids)
           
 org.jpox.cache.CachedPC get(java.lang.Object oid)
          Accessor for an object in the cache.
 int getNumberOfPinnedObjects()
          Accessor for the number of pinned objects - not supported by Ehcache.
 int getNumberOfUnpinnedObjects()
          Accessor for the number of unpinned objects - not supported by Ehcache.
 int getSize()
          Accessor for the size of the cache.
 boolean isEmpty()
          Accessor for whether the cache is empty
 void pin(java.lang.Object oid)
           
 void pinAll(java.lang.Class cls, boolean subs)
           
 void pinAll(java.util.Collection oids)
           
 void pinAll(java.lang.Object[] oids)
           
 org.jpox.cache.CachedPC put(java.lang.Object oid, org.jpox.cache.CachedPC pc)
          Method to add an object to the cache under its id
 void unpin(java.lang.Object oid)
           
 void unpinAll(java.lang.Class cls, boolean subs)
           
 void unpinAll(java.util.Collection oids)
           
 void unpinAll(java.lang.Object[] oids)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EhcacheLevel2Cache

public EhcacheLevel2Cache(java.util.Properties props)
Constructor.

Parameters:
props - Any properties to control the cache
Method Detail

clear

public void clear()
Method to clear the cache

Specified by:
clear in interface org.jpox.cache.Level2Cache
See Also:
Level2Cache.clear()

containsOid

public boolean containsOid(java.lang.Object oid)
Accessor for whether the cache contains the specified id.

Specified by:
containsOid in interface org.jpox.cache.Level2Cache
See Also:
Level2Cache.containsOid(java.lang.Object)

get

public org.jpox.cache.CachedPC get(java.lang.Object oid)
Accessor for an object in the cache.

Specified by:
get in interface org.jpox.cache.Level2Cache
See Also:
Level2Cache.get(java.lang.Object)

getNumberOfPinnedObjects

public int getNumberOfPinnedObjects()
Accessor for the number of pinned objects - not supported by Ehcache.

Specified by:
getNumberOfPinnedObjects in interface org.jpox.cache.Level2Cache
See Also:
Level2Cache.getNumberOfPinnedObjects()

getNumberOfUnpinnedObjects

public int getNumberOfUnpinnedObjects()
Accessor for the number of unpinned objects - not supported by Ehcache.

Specified by:
getNumberOfUnpinnedObjects in interface org.jpox.cache.Level2Cache
See Also:
Level2Cache.getNumberOfUnpinnedObjects()

getSize

public int getSize()
Accessor for the size of the cache.

Specified by:
getSize in interface org.jpox.cache.Level2Cache
See Also:
Level2Cache.getSize()

isEmpty

public boolean isEmpty()
Accessor for whether the cache is empty

Specified by:
isEmpty in interface org.jpox.cache.Level2Cache
See Also:
Level2Cache.isEmpty()

put

public org.jpox.cache.CachedPC put(java.lang.Object oid,
                                   org.jpox.cache.CachedPC pc)
Method to add an object to the cache under its id

Specified by:
put in interface org.jpox.cache.Level2Cache
Parameters:
oid - The identity
pc - The cacheable object

evict

public void evict(java.lang.Object oid)
Specified by:
evict in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.evict(java.lang.Object)

evictAll

public void evictAll()
Specified by:
evictAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.evictAll()

evictAll

public void evictAll(java.lang.Class pcClass,
                     boolean subclasses)
Specified by:
evictAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.evictAll(java.lang.Class, boolean)

evictAll

public void evictAll(java.util.Collection oids)
Specified by:
evictAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.evictAll(java.util.Collection)

evictAll

public void evictAll(java.lang.Object[] oids)
Specified by:
evictAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.evictAll(java.lang.Object[])

pin

public void pin(java.lang.Object oid)
Specified by:
pin in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.pin(java.lang.Object)

pinAll

public void pinAll(java.lang.Class cls,
                   boolean subs)
Specified by:
pinAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.pinAll(java.lang.Class, boolean)

pinAll

public void pinAll(java.util.Collection oids)
Specified by:
pinAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.pinAll(java.util.Collection)

pinAll

public void pinAll(java.lang.Object[] oids)
Specified by:
pinAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.pinAll(java.lang.Object[])

unpin

public void unpin(java.lang.Object oid)
Specified by:
unpin in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.unpin(java.lang.Object)

unpinAll

public void unpinAll(java.lang.Class cls,
                     boolean subs)
Specified by:
unpinAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.unpinAll(java.lang.Class, boolean)

unpinAll

public void unpinAll(java.util.Collection oids)
Specified by:
unpinAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.unpinAll(java.util.Collection)

unpinAll

public void unpinAll(java.lang.Object[] oids)
Specified by:
unpinAll in interface javax.jdo.datastore.DataStoreCache
See Also:
DataStoreCache.unpinAll(java.lang.Object[])


Copyright © 2003-2007 Java Persistent Objects (JPOX). All Rights Reserved.