Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acegisecurity.providers.dao.cache
Class EhCacheBasedUserCache  view EhCacheBasedUserCache download EhCacheBasedUserCache.java

java.lang.Object
  extended byorg.acegisecurity.providers.dao.cache.EhCacheBasedUserCache
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.acegisecurity.providers.dao.UserCache

public class EhCacheBasedUserCache
extends java.lang.Object
implements org.acegisecurity.providers.dao.UserCache, org.springframework.beans.factory.InitializingBean

Caches User objects using a Spring IoC defined EHCACHE.

Version:
$Id: EhCacheBasedUserCache.java,v 1.9 2005/11/29 13:10:11 benalex Exp $

Field Summary
private  Cache cache
           
private static org.apache.commons.logging.Log logger
           
 
Constructor Summary
EhCacheBasedUserCache()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 Cache getCache()
           
 org.acegisecurity.userdetails.UserDetails getUserFromCache(java.lang.String username)
          Obtains a org.acegisecurity.userdetails.UserDetails from the cache.
 void putUserInCache(org.acegisecurity.userdetails.UserDetails user)
          Places a org.acegisecurity.userdetails.UserDetails in the cache.
 void removeUserFromCache(java.lang.String username)
          Removes the specified user from the cache.
 void removeUserFromCache(org.acegisecurity.userdetails.UserDetails user)
           
 void setCache(Cache cache)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

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

cache

private Cache cache
Constructor Detail

EhCacheBasedUserCache

public EhCacheBasedUserCache()
Method Detail

setCache

public void setCache(Cache cache)

getCache

public Cache getCache()

getUserFromCache

public org.acegisecurity.userdetails.UserDetails getUserFromCache(java.lang.String username)
Description copied from interface: org.acegisecurity.providers.dao.UserCache
Obtains a org.acegisecurity.userdetails.UserDetails from the cache.

Specified by:
getUserFromCache in interface org.acegisecurity.providers.dao.UserCache

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Description copied from interface: org.springframework.beans.factory.InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

putUserInCache

public void putUserInCache(org.acegisecurity.userdetails.UserDetails user)
Description copied from interface: org.acegisecurity.providers.dao.UserCache
Places a org.acegisecurity.userdetails.UserDetails in the cache. The username is the key used to subsequently retrieve the UserDetails.

Specified by:
putUserInCache in interface org.acegisecurity.providers.dao.UserCache

removeUserFromCache

public void removeUserFromCache(org.acegisecurity.userdetails.UserDetails user)

removeUserFromCache

public void removeUserFromCache(java.lang.String username)
Description copied from interface: org.acegisecurity.providers.dao.UserCache
Removes the specified user from the cache. The username is the key used to remove the user. If the user is not found, the method should simply return (not thrown an exception).

Some cache implementations may not support eviction from the cache, in which case they should provide appropriate behaviour to alter the user in either its documentation, via an exception, or through a log message.

Specified by:
removeUserFromCache in interface org.acegisecurity.providers.dao.UserCache