edu.internet2.middleware.grouper.cache
Class EhcacheController

java.lang.Object
  extended by edu.internet2.middleware.grouper.cache.EhcacheController
All Implemented Interfaces:
CacheController

public class EhcacheController
extends Object
implements CacheController

Base class for common cache operations.

Since:
1.2.1
Version:
$Id: EhcacheController.java,v 1.13 2009-08-11 20:34:18 mchyzer Exp $
Author:
blair christensen.

Method Summary
static EhcacheController ehcacheController()
          utility cache controller if you dont want to create your own...
 void flushCache()
          Flush all caches.
 net.sf.ehcache.Cache getCache(String name)
          Note, this might be better to be used from GrouperCache
 net.sf.ehcache.Cache getCache(String name, boolean useDefaultIfNotInConfigFile, int defaultMaxElementsInMemory, boolean defaultEternal, int defaultTimeToIdleSeconds, int defaultTimeToLiveSeconds, boolean defaultOverflowToDisk)
          Note, this might be better to be used from GrouperCache
 GrouperCache getGrouperCache(String name)
          Retrieve a grouper cache (like a generic Map)
 GrouperCache getGrouperCache(String name, boolean useDefaultIfNotInConfigFile, int defaultMaxElementsInMemory, boolean defaultEternal, int defaultTimeToIdleSeconds, int defaultTimeToLiveSeconds, boolean defaultOverflowToDisk)
          Retrieve a GrouperCache which is a generic Map cache.
 CacheStats getStats(String cache)
           
 void initialize()
          Initialize privilege cache.
 void stop()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

ehcacheController

public static EhcacheController ehcacheController()
utility cache controller if you dont want to create your own...

Returns:
ehcache controller

stop

public void stop()
See Also:
AccessResolver.stop()

flushCache

public void flushCache()
Flush all caches.

Specified by:
flushCache in interface CacheController
Since:
1.2.1

getGrouperCache

public GrouperCache getGrouperCache(String name)
                             throws IllegalStateException
Retrieve a grouper cache (like a generic Map)

Parameters:
name - should be unique, prefix with fully qualified classname
Returns:
Cache name.
Throws:
IllegalStateException - if cache not found.
Since:
1.2.1

getGrouperCache

public GrouperCache getGrouperCache(String name,
                                    boolean useDefaultIfNotInConfigFile,
                                    int defaultMaxElementsInMemory,
                                    boolean defaultEternal,
                                    int defaultTimeToIdleSeconds,
                                    int defaultTimeToLiveSeconds,
                                    boolean defaultOverflowToDisk)
                             throws IllegalStateException
Retrieve a GrouperCache which is a generic Map cache. Note the defaults are only used in the first invocation of the cache retrieval.

Parameters:
name - should be unique, prefix with fully qualified classname
useDefaultIfNotInConfigFile - use the defaults if not in the config file
defaultMaxElementsInMemory - if not in config file, this is max elements in memory
defaultEternal - if not in config file, true to never expire stuff
defaultTimeToIdleSeconds - if not in config file, time where if not accessed, will expire
defaultTimeToLiveSeconds - if not in config file, time where even if accessed, will expire
defaultOverflowToDisk - if not in config file, if it should go to disk in overflow
Returns:
Cache name.
Throws:
IllegalStateException - if cache not found.
Since:
1.2.1

getCache

public net.sf.ehcache.Cache getCache(String name)
                              throws IllegalStateException
Note, this might be better to be used from GrouperCache

Parameters:
name - should be unique, prefix with fully qualified classname
Returns:
Cache name.
Throws:
IllegalStateException - if cache not found.
Since:
1.2.1

getCache

public net.sf.ehcache.Cache getCache(String name,
                                     boolean useDefaultIfNotInConfigFile,
                                     int defaultMaxElementsInMemory,
                                     boolean defaultEternal,
                                     int defaultTimeToIdleSeconds,
                                     int defaultTimeToLiveSeconds,
                                     boolean defaultOverflowToDisk)
                              throws IllegalStateException
Note, this might be better to be used from GrouperCache

Parameters:
name - should be unique, prefix with fully qualified classname
useDefaultIfNotInConfigFile - use the defaults if not in the config file
defaultMaxElementsInMemory - if not in config file, this is max elements in memory
defaultEternal - if not in config file, true to never expire stuff
defaultTimeToIdleSeconds - if not in config file, time where if not accessed, will expire
defaultTimeToLiveSeconds - if not in config file, time where even if accessed, will expire
defaultOverflowToDisk - if not in config file, if it should go to disk in overflow
Returns:
Cache name.
Throws:
IllegalStateException - if cache not found.
Since:
1.2.1

getStats

public CacheStats getStats(String cache)
Specified by:
getStats in interface CacheController
Parameters:
cache -
Returns:
ehcache statistics for cache.
Since:
1.2.1

initialize

public void initialize()
Initialize privilege cache.

Specified by:
initialize in interface CacheController
Since:
1.2.1