|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jsecurity.mgt.CachingSecurityManager
public abstract class CachingSecurityManager
A very basic extension point for the SecurityManager interface that merely provides logging and caching support. All SecurityManager method implementations are left to subclasses.
Upon instantiation, a sensible default CacheManager will be attempt to be created
automatically by the ensureCacheManager() method. This CacheManager
can then be used by subclass implementations and children components for use to achieve better application
performance.
| Field Summary | |
|---|---|
protected CacheManager |
cacheManager
|
| Constructor Summary | |
|---|---|
CachingSecurityManager()
Default no-arg constructor that will automatically attempt to initialize a default cacheManager by calling ensureCacheManager(). |
|
| Method Summary | |
|---|---|
protected void |
afterCacheManagerSet()
Template callback to notify subclasses that a CacheManager has been set and is available for use via the
getCacheManager() method. |
protected void |
beforeCacheManagerDestroyed()
|
protected CacheManager |
createCacheManager()
Creates a CacheManager instance to be used by this SecurityManager
and potentially any of its children components. |
void |
destroy()
Called when this object is being destroyed, allowing any necessary cleanup of internal resources. |
protected void |
destroyCacheManager()
|
protected void |
ensureCacheManager()
Simple lazy-initialization method that checks to see if a cacheManager has been set, and if not,
attempts to create one and uses that to set the class attribute. |
CacheManager |
getCacheManager()
Returns the CacheManager used by this SecurityManager. |
void |
setCacheManager(CacheManager cacheManager)
Sets the CacheManager used by this SecurityManager and potentially any of its
children components. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jsecurity.mgt.SecurityManager |
|---|
getSubject, login, logout |
| Methods inherited from interface org.jsecurity.authc.Authenticator |
|---|
authenticate |
| Methods inherited from interface org.jsecurity.authz.Authorizer |
|---|
checkPermission, checkPermission, checkPermissions, checkPermissions, checkRole, checkRoles, hasAllRoles, hasRole, hasRoles, isPermitted, isPermitted, isPermitted, isPermitted, isPermittedAll, isPermittedAll |
| Methods inherited from interface org.jsecurity.session.SessionFactory |
|---|
getSession, start |
| Field Detail |
|---|
protected CacheManager cacheManager
| Constructor Detail |
|---|
public CachingSecurityManager()
ensureCacheManager().
| Method Detail |
|---|
public CacheManager getCacheManager()
public void setCacheManager(CacheManager cacheManager)
SecurityManager and potentially any of its
children components.
After the cacheManager attribute has been set, the template method
afterCacheManagerSet() is executed to allow subclasses to adjust when a
cacheManager is available.
setCacheManager in interface CacheManagerAwarecacheManager - the CacheManager used by this SecurityManager and potentially any of its
children components.protected void ensureCacheManager()
cacheManager has been set, and if not,
attempts to create one and uses that to set the class attribute.
The default implementation functions as follows:
CacheManager cm = getCacheManager();
if (cm == null) {
cm = createCacheManager();
if (cm != null) {
setCacheManager(cm);
}
}
protected void afterCacheManagerSet()
CacheManager has been set and is available for use via the
getCacheManager() method.
protected CacheManager createCacheManager()
CacheManager instance to be used by this SecurityManager
and potentially any of its children components.
This default implementation attempts to create an EhCacheManager, assuming that
ehcache is in the classpath. If Ehcache is not in the classpath, no cache manager will be created and this
method does nothing.
This can be overridden by subclasses for a different implementation, but it is often easier to set a
different implementation via the setCacheManager
method, for example in code or Dependency Injection frameworks (a la Spring or JEE 3).
CacheManager instance.ensureCacheManager()public void destroy()
Destroyable
destroy in interface Destroyableprotected void beforeCacheManagerDestroyed()
protected void destroyCacheManager()
|
JSecurity | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||