org.apache.shiro.realm
Class CachingRealm

java.lang.Object
  extended by org.apache.shiro.realm.CachingRealm
All Implemented Interfaces:
Authorizer, CacheManagerAware, Realm, Nameable
Direct Known Subclasses:
AuthenticatingRealm

public abstract class CachingRealm
extends Object
implements Realm, Nameable, CacheManagerAware

A very basic abstract extension point for the Realm interface that provides caching support.

All actual Realm method implementations are left to subclasses.

Since:
0.9
Author:
Les Hazlewood

Constructor Summary
CachingRealm()
           
 
Method Summary
protected  void afterCacheManagerSet()
           
 CacheManager getCacheManager()
          Returns the CacheManager used for data caching to reduce EIS round trips, or null if caching is disabled.
 String getName()
          Returns the (application-unique) name assigned to this Realm.
 boolean isCachingEnabled()
          Returns true if caching should be used if a CacheManager has been configured, false otherwise.
 void setCacheManager(CacheManager cacheManager)
          Sets the CacheManager to be used for data caching to reduce EIS round trips.
 void setCachingEnabled(boolean cachingEnabled)
          Sets whether or not caching should be used if a CacheManager has been configured.
 void setName(String name)
          Sets the (preferably application unique) name for this component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.shiro.realm.Realm
getAuthenticationInfo, supports
 
Methods inherited from interface org.apache.shiro.authz.Authorizer
checkPermission, checkPermission, checkPermissions, checkPermissions, checkRole, checkRoles, hasAllRoles, hasRole, hasRoles, isPermitted, isPermitted, isPermitted, isPermitted, isPermittedAll, isPermittedAll
 

Constructor Detail

CachingRealm

public CachingRealm()
Method Detail

getCacheManager

public CacheManager getCacheManager()
Returns the CacheManager used for data caching to reduce EIS round trips, or null if caching is disabled.

Returns:
the CacheManager used for data caching to reduce EIS round trips, or null if caching is disabled.

setCacheManager

public void setCacheManager(CacheManager cacheManager)
Sets the CacheManager to be used for data caching to reduce EIS round trips.

This property is null by default, indicating that caching is turned off.

Specified by:
setCacheManager in interface CacheManagerAware
Parameters:
cacheManager - the CacheManager to use for data caching, or null to disable caching.

isCachingEnabled

public boolean isCachingEnabled()
Returns true if caching should be used if a CacheManager has been configured, false otherwise.

The default value is true since the large majority of Realms will benefit from caching if a CacheManager has been configured. However, memory-only realms should set this value to false since they would manage account data in memory already lookups would already be as efficient as possible.

Returns:
true if caching will be globally enabled if a CacheManager has been configured, false otherwise

setCachingEnabled

public void setCachingEnabled(boolean cachingEnabled)
Sets whether or not caching should be used if a CacheManager has been configured.

Parameters:
cachingEnabled - whether or not to globally enable caching for this realm.

getName

public String getName()
Description copied from interface: Realm
Returns the (application-unique) name assigned to this Realm. All realms configured for a single application must have a unique name.

Specified by:
getName in interface Realm
Returns:
the (application-unique) name assigned to this Realm.

setName

public void setName(String name)
Description copied from interface: Nameable
Sets the (preferably application unique) name for this component.

Specified by:
setName in interface Nameable
Parameters:
name - the preferably application unique name for this component.

afterCacheManagerSet

protected void afterCacheManagerSet()


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.