org.jasig.portal.utils.cache
Class WhirlyCacheCacheFactory

java.lang.Object
  extended by org.jasig.portal.utils.cache.WhirlyCacheCacheFactory
All Implemented Interfaces:
CacheFactory, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public final class WhirlyCacheCacheFactory
extends java.lang.Object
implements CacheFactory, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

Implementation of the CacheFactory that will return instances of a cache backed by WhirlyCache.

As WhirlyCache does not use the standard map API, these caches are wrapped by a Map.

Version:
$Revision: 1.1.2.1 $ $Date: 2005/10/13 21:32:01 $
Author:
Scott Battaglia

Nested Class Summary
protected static class WhirlyCacheCacheFactory.WhirlyCacheMap
           
 
Field Summary
private  com.whirlycott.cache.CacheManager cacheManager
          Instance of WhirlyCache manager in order to manage caches from this factory.
private  java.util.Map caches
          Map of caches so that we always return the same instance.
private static org.apache.commons.logging.Log log
          Instance of Commons Logging for logging purposes
private static java.lang.String LOG_MESSAGE_FOUND_IN_CACHE
          Message to display when the cache is found and intanciated already.
private static java.lang.String LOG_MESSAGE_INVALID
          Message to display if we cannot find the cache at all.
private static java.lang.String LOG_MESSAGE_NOT_FOUND_IN_CACHE
          Message to display if the cache was not found in the map and we instanciate a new one.
 
Fields inherited from interface org.jasig.portal.utils.cache.CacheFactory
DEFAULT, PRINCIPAL_CACHE, USER_INFO_CACHE
 
Constructor Summary
WhirlyCacheCacheFactory()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 java.util.Map getCache()
          Method to retrieve a default cache without a name.
 java.util.Map getCache(java.lang.String cacheName)
          Method to retrieve a cache by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_MESSAGE_FOUND_IN_CACHE

private static final java.lang.String LOG_MESSAGE_FOUND_IN_CACHE
Message to display when the cache is found and intanciated already.

See Also:
Constant Field Values

LOG_MESSAGE_NOT_FOUND_IN_CACHE

private static final java.lang.String LOG_MESSAGE_NOT_FOUND_IN_CACHE
Message to display if the cache was not found in the map and we instanciate a new one.

See Also:
Constant Field Values

LOG_MESSAGE_INVALID

private static final java.lang.String LOG_MESSAGE_INVALID
Message to display if we cannot find the cache at all.

See Also:
Constant Field Values

log

private static final org.apache.commons.logging.Log log
Instance of Commons Logging for logging purposes


cacheManager

private final com.whirlycott.cache.CacheManager cacheManager
Instance of WhirlyCache manager in order to manage caches from this factory.


caches

private final java.util.Map caches
Map of caches so that we always return the same instance.

Constructor Detail

WhirlyCacheCacheFactory

public WhirlyCacheCacheFactory()
Method Detail

getCache

public java.util.Map getCache(java.lang.String cacheName)
                       throws java.lang.IllegalArgumentException
Description copied from interface: CacheFactory
Method to retrieve a cache by name.

Specified by:
getCache in interface CacheFactory
Parameters:
cacheName - the name of the cache to retrieve.
Returns:
the cache that is referenced by the cache name provided.
Throws:
java.lang.IllegalArgumentException

getCache

public java.util.Map getCache()
                       throws java.lang.IllegalArgumentException
Description copied from interface: CacheFactory
Method to retrieve a default cache without a name.

Specified by:
getCache in interface CacheFactory
Returns:
the default cache for this CacheFactory
Throws:
java.lang.IllegalArgumentException

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception