org.wanghy.cache.provider.ehcache
Class EhcacheFacade

java.lang.Object
  extended byorg.wanghy.cache.provider.AbstractCacheProviderFacadeImpl
      extended byorg.wanghy.cache.provider.ehcache.EhcacheFacade
All Implemented Interfaces:
CacheProviderFacade, InitializingBean

public final class EhcacheFacade
extends AbstractCacheProviderFacadeImpl

Delegates the caching functionality to EHCache.

Version:
$Revision: 1.22 $ $Date: 2005/04/07 10:06:02 $
Author:
Alex Ruiz

Field Summary
private  CacheManager cacheManager
          EHCache cache manager.
private static Log logger
          Message logger.
 
Fields inherited from class org.wanghy.cache.provider.AbstractCacheProviderFacadeImpl
 
Constructor Summary
EhcacheFacade()
          Constructor.
 
Method Summary
protected  AbstractCacheProfileEditor getCacheProfileEditor()
          Returns a property editor for CacheProfile.
protected  CacheProfileValidator getCacheProfileValidator()
          Returns a validator for the properties of cache profiles.
protected  void onFlushCache(CacheProfile cacheProfile)
          Flushes the caches specified in the given profile.
protected  Object onGetFromCache(Serializable cacheKey, CacheProfile cacheProfile)
          Retrieves an entry from the cache.
protected  void onPutInCache(Serializable cacheKey, CacheProfile cacheProfile, Object objectToCache)
          Stores an object in the cache.
 void removeFromCache(Serializable cacheKey, String cacheProfileId)
          Removes an object from the cache.
 void setCacheManager(CacheManager cacheManager)
          Setter for the field cacheManager.
protected  void validateCacheManager()
           Validates that cacheManager is not null Verifies that the state of cacheManager is 'active' (only if this facade is not configured to fail quietly in case of an error when accessing the cache.)
 
Methods inherited from class org.wanghy.cache.provider.AbstractCacheProviderFacadeImpl
afterPropertiesSet, cancelCacheUpdate, flushCache, getCacheProfile, getCacheProfiles, getFromCache, handleCacheAccessException, isCacheProfileMapValidated, isFailQuietlyEnabled, onCancelCacheUpdate, putInCache, setCacheProfiles, setCacheProfiles, setFailQuietlyEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static Log logger
Message logger.


cacheManager

private CacheManager cacheManager
EHCache cache manager.

Constructor Detail

EhcacheFacade

public EhcacheFacade()
Constructor.

Method Detail

getCacheProfileEditor

protected AbstractCacheProfileEditor getCacheProfileEditor()
Description copied from class: AbstractCacheProviderFacadeImpl
Returns a property editor for CacheProfile.

Specified by:
getCacheProfileEditor in class AbstractCacheProviderFacadeImpl
Returns:
a property editor for cache profiles.
See Also:
AbstractCacheProviderFacadeImpl.getCacheProfileEditor()

getCacheProfileValidator

protected CacheProfileValidator getCacheProfileValidator()
Description copied from class: AbstractCacheProviderFacadeImpl
Returns a validator for the properties of cache profiles.

Specified by:
getCacheProfileValidator in class AbstractCacheProviderFacadeImpl
Returns:
a validator for the properties of cache profiles.
See Also:
AbstractCacheProviderFacadeImpl.getCacheProfileValidator(), EhcacheCacheProfileValidator.validateCacheProfile(Object)

onFlushCache

protected void onFlushCache(CacheProfile cacheProfile)
Description copied from class: AbstractCacheProviderFacadeImpl
Flushes the caches specified in the given profile.

Specified by:
onFlushCache in class AbstractCacheProviderFacadeImpl
Parameters:
cacheProfile - the cache profile that specifies what and how to flush.
See Also:
AbstractCacheProviderFacadeImpl.onFlushCache(CacheProfile)

onGetFromCache

protected Object onGetFromCache(Serializable cacheKey,
                                CacheProfile cacheProfile)
                         throws EntryRetrievalException
Description copied from class: AbstractCacheProviderFacadeImpl
Retrieves an entry from the cache.

Specified by:
onGetFromCache in class AbstractCacheProviderFacadeImpl
Parameters:
cacheKey - the key under which the entry is stored.
cacheProfile - the the cache profile that specifies how to retrieve an entry.
Returns:
the cached entry.
Throws:
EntryRetrievalException - if an unexpected error takes place when retrieving the entry from the cache.
See Also:
AbstractCacheProviderFacadeImpl.onGetFromCache(Serializable, CacheProfile)

onPutInCache

protected void onPutInCache(Serializable cacheKey,
                            CacheProfile cacheProfile,
                            Object objectToCache)
Description copied from class: AbstractCacheProviderFacadeImpl
Stores an object in the cache.

Specified by:
onPutInCache in class AbstractCacheProviderFacadeImpl
Parameters:
cacheKey - the key used to store the object.
cacheProfile - the cache profile that specifies how to store an object in the cache.
objectToCache - the object to store in the cache.
See Also:
AbstractCacheProviderFacadeImpl.onPutInCache(Serializable, CacheProfile, Object)

removeFromCache

public void removeFromCache(Serializable cacheKey,
                            String cacheProfileId)
Description copied from interface: CacheProviderFacade
Removes an object from the cache.

Parameters:
cacheKey - the key under which the object is stored.
cacheProfileId - the id of the cache profile that specifies how to store an object.
See Also:
CacheProviderFacade.removeFromCache(Serializable, String)

setCacheManager

public void setCacheManager(CacheManager cacheManager)
Setter for the field cacheManager.

Parameters:
cacheManager - the new value to set

validateCacheManager

protected void validateCacheManager()

Specified by:
validateCacheManager in class AbstractCacheProviderFacadeImpl
Throws:
IllegalArgumentException - if the Cache Manager is null.
IllegalArgumentException - if the status of the Cache Manager is not "Alive".
See Also:
AbstractCacheProviderFacadeImpl.isFailQuietlyEnabled(), AbstractCacheProviderFacadeImpl.validateCacheManager()


Copyright © 2004-2005 Alex Ruiz. All Rights Reserved.