org.apache.jcs.engine.control
Class CompositeCacheManager

java.lang.Object
  extended byorg.apache.jcs.engine.control.CompositeCacheManager
All Implemented Interfaces:
IRemoteCacheConstants, java.io.Serializable

public class CompositeCacheManager
extends java.lang.Object
implements IRemoteCacheConstants, java.io.Serializable

Manages a composite cache.

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable auxAttrs
          ???
protected  java.util.Hashtable auxFacs
          Used to keep track of configured auxiliaries
protected  java.util.Hashtable caches
          Caches managed by this cache manager
private  int clients
          Number of clients accessing this cache manager
protected  java.lang.String defaultAuxValues
          The default auxiliary caches to be used if not preconfigured
protected  ICompositeCacheAttributes defaultCacheAttr
          Default cache attributes for this cache manager
protected  IElementAttributes defaultElementAttr
          Default elemeent attributes for this cache manager
protected static CompositeCacheManager instance
          The Singleton Instance
private static org.apache.commons.logging.Log log
           
protected  java.util.Properties props
          Properties with which this manager was configured
protected  java.util.Hashtable systemCaches
          Internal system caches for this cache manager
 
Fields inherited from interface org.apache.jcs.auxiliary.remote.behavior.IRemoteCacheConstants
REMOTE_ALLOW_CLUSTER_GET, REMOTE_CACHE_SERVICE_NAME, REMOTE_CACHE_SERVICE_PORT, REMOTE_CACHE_SERVICE_VAL, REMOTE_LOCAL_CLUSTER_CONSISTENCY, TOMCAT_ON, TOMCAT_XML
 
Constructor Summary
CompositeCacheManager()
           
 
Method Summary
 void configure()
          Configure with default properties file
 void configure(java.util.Properties props)
          Configure from properties object
 void configure(java.lang.String propFile)
          Configure from specific properties file
protected static CompositeCacheManager createInstance()
          Simple factory method, must override in subclasses so getInstance creates / returns the correct object.
 void freeCache(java.lang.String name)
           
 void freeCache(java.lang.String name, boolean fromRemote)
           
 CompositeCache getCache(ICompositeCacheAttributes cattr)
          Gets the cache attribute of the CacheHub object
 CompositeCache getCache(ICompositeCacheAttributes cattr, IElementAttributes attr)
          If the cache is created the CacheAttributes and the element Attributes will be ignored.
 CompositeCache getCache(java.lang.String cacheName)
          Gets the cache attribute of the CacheHub object
 CompositeCache getCache(java.lang.String cacheName, ICompositeCacheAttributes cattr)
          Gets the cache attribute of the CacheHub object
 CompositeCache getCache(java.lang.String cacheName, ICompositeCacheAttributes cattr, IElementAttributes attr)
          Gets the cache attribute of the CacheHub object
 java.lang.String[] getCacheNames()
          Returns a list of the current cache names.
 int getCacheType()
           
 ICompositeCacheAttributes getDefaultCacheAttributes()
          Gets the defaultCacheAttributes attribute of the CacheHub object
 ICompositeCacheAttributes getDefaultCattr()
           
 IElementAttributes getDefaultElementAttributes()
          Gets the defaultElementAttributes attribute of the CacheHub object
static CompositeCacheManager getInstance()
          Gets the CacheHub instance.
static CompositeCacheManager getInstance(java.lang.String propsFilename)
           
static CompositeCacheManager getUnconfiguredInstance()
          Get a CacheHub instance which is not configured.
protected  void incrementClients()
           
(package private)  AuxiliaryCacheAttributes registryAttrGet(java.lang.String name)
           
(package private)  void registryAttrPut(AuxiliaryCacheAttributes auxAttr)
           
(package private)  AuxiliaryCacheFactory registryFacGet(java.lang.String name)
           
(package private)  void registryFacPut(AuxiliaryCacheFactory auxFac)
           
 void release()
           
private  void release(boolean fromRemote)
           
 void setDefaultCacheAttributes(ICompositeCacheAttributes icca)
          Sets the defaultCacheAttributes attribute of the CacheHub object
 void setDefaultElementAttributes(IElementAttributes iea)
          Sets the defaultElementAttributes attribute of the CacheHub object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

caches

protected java.util.Hashtable caches
Caches managed by this cache manager


systemCaches

protected java.util.Hashtable systemCaches
Internal system caches for this cache manager


clients

private int clients
Number of clients accessing this cache manager


defaultCacheAttr

protected ICompositeCacheAttributes defaultCacheAttr
Default cache attributes for this cache manager


defaultElementAttr

protected IElementAttributes defaultElementAttr
Default elemeent attributes for this cache manager


auxFacs

protected java.util.Hashtable auxFacs
Used to keep track of configured auxiliaries


auxAttrs

protected java.util.Hashtable auxAttrs
???


props

protected java.util.Properties props
Properties with which this manager was configured


defaultAuxValues

protected java.lang.String defaultAuxValues
The default auxiliary caches to be used if not preconfigured


instance

protected static CompositeCacheManager instance
The Singleton Instance

Constructor Detail

CompositeCacheManager

public CompositeCacheManager()
Method Detail

getInstance

public static CompositeCacheManager getInstance()
Gets the CacheHub instance. For backward compatibility, if this creates the instance it will attempt to configure it with the default configuration. If you want to configure from your own source, use getUnconfiguredInstance() and then call configure()


getInstance

public static CompositeCacheManager getInstance(java.lang.String propsFilename)

getUnconfiguredInstance

public static CompositeCacheManager getUnconfiguredInstance()
Get a CacheHub instance which is not configured.


createInstance

protected static CompositeCacheManager createInstance()
Simple factory method, must override in subclasses so getInstance creates / returns the correct object.


configure

public void configure()
Configure with default properties file


configure

public void configure(java.lang.String propFile)
Configure from specific properties file

Parameters:
propFile - Path within classpath to load configuration from

configure

public void configure(java.util.Properties props)
Configure from properties object

Parameters:
props -

getDefaultCacheAttributes

public ICompositeCacheAttributes getDefaultCacheAttributes()
Gets the defaultCacheAttributes attribute of the CacheHub object

Returns:
The defaultCacheAttributes value

setDefaultCacheAttributes

public void setDefaultCacheAttributes(ICompositeCacheAttributes icca)
Sets the defaultCacheAttributes attribute of the CacheHub object

Parameters:
icca - The new defaultCacheAttributes value

setDefaultElementAttributes

public void setDefaultElementAttributes(IElementAttributes iea)
Sets the defaultElementAttributes attribute of the CacheHub object

Parameters:
iea - The new defaultElementAttributes value

getDefaultElementAttributes

public IElementAttributes getDefaultElementAttributes()
Gets the defaultElementAttributes attribute of the CacheHub object

Returns:
The defaultElementAttributes value

getCache

public CompositeCache getCache(java.lang.String cacheName)
Gets the cache attribute of the CacheHub object


getCache

public CompositeCache getCache(java.lang.String cacheName,
                               ICompositeCacheAttributes cattr)
Gets the cache attribute of the CacheHub object


getCache

public CompositeCache getCache(java.lang.String cacheName,
                               ICompositeCacheAttributes cattr,
                               IElementAttributes attr)
Gets the cache attribute of the CacheHub object


getCache

public CompositeCache getCache(ICompositeCacheAttributes cattr)
Gets the cache attribute of the CacheHub object


getCache

public CompositeCache getCache(ICompositeCacheAttributes cattr,
                               IElementAttributes attr)
If the cache is created the CacheAttributes and the element Attributes will be ignored. Currently there is no overiding once it is set up. Overriding hte default elemental atributes will require cahnging the way the atributes are assigned to elements. Get cache creates a cache with defaults if none are specified. We might want to create separate method for creating/getting. . .


freeCache

public void freeCache(java.lang.String name)

freeCache

public void freeCache(java.lang.String name,
                      boolean fromRemote)

incrementClients

protected void incrementClients()

release

public void release()

release

private void release(boolean fromRemote)

getCacheNames

public java.lang.String[] getCacheNames()
Returns a list of the current cache names.


getCacheType

public int getCacheType()

getDefaultCattr

public ICompositeCacheAttributes getDefaultCattr()

registryFacPut

void registryFacPut(AuxiliaryCacheFactory auxFac)

registryFacGet

AuxiliaryCacheFactory registryFacGet(java.lang.String name)

registryAttrPut

void registryAttrPut(AuxiliaryCacheAttributes auxAttr)

registryAttrGet

AuxiliaryCacheAttributes registryAttrGet(java.lang.String name)