org.castor.cache.distributed
Class JcsCache<K,V>

java.lang.Object
  extended by org.castor.cache.AbstractBaseCache<K,V>
      extended by org.castor.cache.distributed.AbstractDistributedCache<K,V>
          extended by org.castor.cache.distributed.JcsCache<K,V>
Type Parameters:
K - the type of keys maintained by this cache
V - the type of cached values
All Implemented Interfaces:
Map<K,V>, Cache<K,V>

public final class JcsCache<K,V>
extends AbstractDistributedCache<K,V>

JCS (Java Caching System) implementation of Castor JDO Cache. For more details of JCS, see http://jakarta.apache.org/jcs

Since:
1.0
Version:
$Revision: 9041 $ $Date: 2011-08-16 11:51:17 +0200 (Di, 16 Aug 2011) $
Author:
Tim Telcik, Werner Guttmann, Ralf Joachim
See Also:
The JCS Home Page

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static String IMPLEMENTATION
          The classname of the implementations factory class.
static String TYPE
          The type of the cache.
 
Fields inherited from interface org.castor.cache.Cache
DEFAULT_DEBUG, DEFAULT_NAME, DEFAULT_TYPE, PARAM_DEBUG, PARAM_NAME, PARAM_TYPE
 
Constructor Summary
JcsCache()
           
 
Method Summary
 void clear()
          
 boolean containsKey(Object key)
          
 boolean containsValue(Object value)
          
 Set<Map.Entry<K,V>> entrySet()
          
 V get(Object key)
          
 String getType()
          Indicates the type of this cache.
 void initialize(Properties params)
          Lyfe-cycle method to allow custom initialization of cache implementations.
 void initialize(String implementation, Properties params)
          Normally called to initialize JcsCache.
 boolean isEmpty()
          
 Set<K> keySet()
          
 V put(K key, V value)
          
 void putAll(Map<? extends K,? extends V> map)
          
 V remove(Object key)
          
 int size()
          
 Collection<V> values()
          
 
Methods inherited from class org.castor.cache.distributed.AbstractDistributedCache
getCache, invokeMethod, invokeStaticMethod, setCache
 
Methods inherited from class org.castor.cache.AbstractBaseCache
close, expire, expireAll, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

TYPE

public static final String TYPE
The type of the cache.

See Also:
Constant Field Values

IMPLEMENTATION

public static final String IMPLEMENTATION
The classname of the implementations factory class.

See Also:
Constant Field Values
Constructor Detail

JcsCache

public JcsCache()
Method Detail

initialize

public void initialize(Properties params)
                throws CacheAcquireException
Lyfe-cycle method to allow custom initialization of cache implementations.

Specified by:
initialize in interface Cache<K,V>
Overrides:
initialize in class AbstractBaseCache<K,V>
Parameters:
params - Parameters to initialize the cache (e.g. name, capacity).
Throws:
CacheAcquireException - If cache can not be initialized.

initialize

public void initialize(String implementation,
                       Properties params)
                throws CacheAcquireException
Normally called to initialize JcsCache. To be able to test the method without having org.apache.jcs.JCS implementation, it can also be called with a test implementations classname.

Parameters:
implementation - Cache implementation classname to initialize.
params - Parameters to initialize the cache (e.g. name, capacity).
Throws:
CacheAcquireException - If cache can not be initialized.

getType

public String getType()
Indicates the type of this cache.

Returns:
The cache type.

size

public int size()

Specified by:
size in interface Map<K,V>
Overrides:
size in class AbstractDistributedCache<K,V>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Map<K,V>
Overrides:
isEmpty in class AbstractDistributedCache<K,V>

containsKey

public boolean containsKey(Object key)

Specified by:
containsKey in interface Map<K,V>
Overrides:
containsKey in class AbstractDistributedCache<K,V>

containsValue

public boolean containsValue(Object value)

Specified by:
containsValue in interface Map<K,V>
Overrides:
containsValue in class AbstractDistributedCache<K,V>

get

public V get(Object key)

Specified by:
get in interface Map<K,V>
Overrides:
get in class AbstractDistributedCache<K,V>

put

public V put(K key,
             V value)

Specified by:
put in interface Map<K,V>
Overrides:
put in class AbstractDistributedCache<K,V>

remove

public V remove(Object key)

Specified by:
remove in interface Map<K,V>
Overrides:
remove in class AbstractDistributedCache<K,V>

putAll

public void putAll(Map<? extends K,? extends V> map)

Specified by:
putAll in interface Map<K,V>
Overrides:
putAll in class AbstractDistributedCache<K,V>

clear

public void clear()

Specified by:
clear in interface Map<K,V>
Overrides:
clear in class AbstractDistributedCache<K,V>

keySet

public Set<K> keySet()

Specified by:
keySet in interface Map<K,V>
Overrides:
keySet in class AbstractDistributedCache<K,V>

values

public Collection<V> values()

Specified by:
values in interface Map<K,V>
Overrides:
values in class AbstractDistributedCache<K,V>

entrySet

public Set<Map.Entry<K,V>> entrySet()

Specified by:
entrySet in interface Map<K,V>
Overrides:
entrySet in class AbstractDistributedCache<K,V>


Copyright © 2012. All Rights Reserved.