SolarMetric Kodo JDO 3.4.1 generated on May 30 2006

kodo.datacache
Class TangosolQueryCache

java.lang.Object
  |
  +--serp.util.AbstractEventManager
        |
        +--kodo.datacache.AbstractQueryCache
              |
              +--kodo.datacache.TangosolQueryCache
All Implemented Interfaces:
com.solarmetric.util.Closeable, Configurable, EventListener, com.tangosol.util.MapListener, QueryCache

public class TangosolQueryCache
extends AbstractQueryCache
implements com.tangosol.util.MapListener

A PersistenceManagerFactory query cache that delegates to a Tangosol Coherence cache. This cache can be used to share data among PersistenceManagers created from a single PersistenceManagerFactory. Batch updates are performed atomically. TODO - Refactor TangosolCache and TangosolQueryCache to reduce duplicated code. For that matter, refactor AbstractDataCache and AbstractQueryCache to reduce duplicated code.


Field Summary
static int TYPE_DISTRIBUTED
           
static int TYPE_NAMED
           
static int TYPE_REPLICATED
           
 
Fields inherited from class kodo.datacache.AbstractQueryCache
conf, log
 
Constructor Summary
TangosolQueryCache()
           
 
Method Summary
protected  void clearInternal()
          Clear the cache.
 void close()
          Free the resources used by this cache.
 void endConfiguration()
          Invoked upon completion of bean property configuration for this object.
 void entryDeleted(com.tangosol.util.MapEvent evt)
          Callback for when a QueryKey held by the tangosol query cache is deleted.
 void entryInserted(com.tangosol.util.MapEvent evt)
           
 void entryUpdated(com.tangosol.util.MapEvent evt)
           
 boolean getClearOnClose()
          Whether the contents of the named cache will be cleared when the PersistenceManagerFactory is closed.
protected  QueryResult getInternal(QueryKey key)
          Return the list for the given key.
 com.tangosol.net.NamedCache getTangosolCache()
           
 String getTangosolCacheName()
          Returns the name of the Tangosol cache to use.
 int getTangosolCacheType()
          The tangosol cache type as one of the TYPE constants.
protected  Collection keySet()
          Return a threadsafe view of the keys in this cache.
protected  com.tangosol.net.NamedCache newTangosolQueryCache(String name)
          Returns a new NamedCache for use as the underlying query cache.
protected  boolean pinInternal(QueryKey key)
          Coherence doesn't have a concept of expiring data, so pinning is meaningless.
protected  QueryResult putInternal(QueryKey key, QueryResult value)
          Add the given result to the cache, returning the old result under the given key.
protected  boolean recacheUpdates()
          Tangosol does not automatically update objects stored in the cache, so we must re-enlist them as appropriate.
protected  QueryResult removeInternal(QueryKey key)
          Remove the result under the given key from the cache.
 void setClearOnClose(boolean clearOnClose)
          Sets the option to clear the Tangosol cache when the PersistenceManagerFactory is closed.
 void setTangosolCacheName(String name)
          Sets the name of the Tangosol cache to use.
 void setTangosolCacheType(int type)
          The tangosol cache type as one of the TYPE constants.
 void setTangosolCacheType(String type)
          If distributed, this cache implementation will use a distibuted cache.
protected  boolean unpinInternal(QueryKey key)
          Coherence doesn't have a concept of expiring data, so unpinning is meaningless.
 
Methods inherited from class kodo.datacache.AbstractQueryCache
addExpirationListener, afterCommit, classesChanged, clear, closeWithoutClear, fireEvent, get, getHitRate, getHits, getMisses, getStatistics, getStatisticsString, isClosed, keyRemoved, newListenerCollection, pin, put, remove, removeAllInternal, removeExpirationListener, resetStatistics, setConfiguration, startConfiguration, unpin
 
Methods inherited from class serp.util.AbstractEventManager
fireEvent, getListeners, hasListener, hasListeners, registerListener, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_DISTRIBUTED

public static final int TYPE_DISTRIBUTED

TYPE_REPLICATED

public static final int TYPE_REPLICATED

TYPE_NAMED

public static final int TYPE_NAMED
Constructor Detail

TangosolQueryCache

public TangosolQueryCache()
Method Detail

getTangosolCache

public com.tangosol.net.NamedCache getTangosolCache()

setTangosolCacheName

public void setTangosolCacheName(String name)
Sets the name of the Tangosol cache to use.

getTangosolCacheName

public final String getTangosolCacheName()
Returns the name of the Tangosol cache to use.

setTangosolCacheType

public void setTangosolCacheType(int type)
The tangosol cache type as one of the TYPE constants.

getTangosolCacheType

public int getTangosolCacheType()
The tangosol cache type as one of the TYPE constants.

setTangosolCacheType

public void setTangosolCacheType(String type)
If distributed, this cache implementation will use a distibuted cache. If replicated, this cache implementation will use a replicated cache. If left unset or set to named, the cache is looked up through Coherence's named-cache lookup mechanisms. This method is primarily used for automated string-based configuration.

setClearOnClose

public void setClearOnClose(boolean clearOnClose)
Sets the option to clear the Tangosol cache when the PersistenceManagerFactory is closed. When this option is true, all contents of the named cache will be cleared. Defaults to false.

getClearOnClose

public boolean getClearOnClose()
Whether the contents of the named cache will be cleared when the PersistenceManagerFactory is closed.

getInternal

protected QueryResult getInternal(QueryKey key)
Description copied from class: AbstractQueryCache
Return the list for the given key.
Overrides:
getInternal in class AbstractQueryCache

putInternal

protected QueryResult putInternal(QueryKey key,
                                  QueryResult value)
Description copied from class: AbstractQueryCache
Add the given result to the cache, returning the old result under the given key.
Overrides:
putInternal in class AbstractQueryCache

removeInternal

protected QueryResult removeInternal(QueryKey key)
Description copied from class: AbstractQueryCache
Remove the result under the given key from the cache.
Overrides:
removeInternal in class AbstractQueryCache

clearInternal

protected void clearInternal()
Description copied from class: AbstractQueryCache
Clear the cache.
Overrides:
clearInternal in class AbstractQueryCache

pinInternal

protected boolean pinInternal(QueryKey key)
Coherence doesn't have a concept of expiring data, so pinning is meaningless. This method is equivalent to invoking Map.containsKey(java.lang.Object).
Overrides:
pinInternal in class AbstractQueryCache

unpinInternal

protected boolean unpinInternal(QueryKey key)
Coherence doesn't have a concept of expiring data, so unpinning is meaningless. This method is equivalent to invoking Map.containsKey(java.lang.Object).
Overrides:
unpinInternal in class AbstractQueryCache

recacheUpdates

protected boolean recacheUpdates()
Tangosol does not automatically update objects stored in the cache, so we must re-enlist them as appropriate.

keySet

protected Collection keySet()
Description copied from class: AbstractQueryCache
Return a threadsafe view of the keys in this cache. This collection must be iteratable without risk of concurrent modification exceptions. It does not have to implement contains() efficiently or use set semantics.
Overrides:
keySet in class AbstractQueryCache

close

public void close()
Description copied from interface: QueryCache
Free the resources used by this cache.
Overrides:
close in class AbstractQueryCache

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of bean property configuration for this object.
Overrides:
endConfiguration in class AbstractQueryCache

newTangosolQueryCache

protected com.tangosol.net.NamedCache newTangosolQueryCache(String name)
Returns a new NamedCache for use as the underlying query cache. This implementation returns a NamedCache obtained by invoking CacheFactory.getCache(java.lang.String) unless the TangosolCacheType optional QueryCache property is set to distributed or to replicated, in which case CacheFactory.getDistributedCache(java.lang.String) or CacheFactory.getReplicatedCache(java.lang.String) are invoked, as appropriate. It uses the name specified by the TangosolCacheName property, or "kodo" if unset. To implement a more sophisticated caching strategy, override this method. AbstractQueryCache and CacheAwareQuery need support for expiration listeners. A tangosol MapListener is added to facalitate the listeners.

entryDeleted

public void entryDeleted(com.tangosol.util.MapEvent evt)
Callback for when a QueryKey held by the tangosol query cache is deleted. Deletes can happen due to tx commits, expiration-due-to-size, and time-based removal. Translate the tangosol MapEvent indicating an entry was deleted into a QueryCache ExpirationEvent (), which will then fire the expirationListeners (e.g. CachingResultList)
Specified by:
entryDeleted in interface com.tangosol.util.MapListener

entryInserted

public void entryInserted(com.tangosol.util.MapEvent evt)
Specified by:
entryInserted in interface com.tangosol.util.MapListener

entryUpdated

public void entryUpdated(com.tangosol.util.MapEvent evt)
Specified by:
entryUpdated in interface com.tangosol.util.MapListener

SolarMetric Kodo JDO 3.4.1 generated on May 30 2006

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.