All Examples  This Package

Class examples.security.rdbmsrealm.CachingRealm

java.lang.Object
   |
   +----examples.security.rdbmsrealm.CachingRealm

public class CachingRealm
extends Object
implements ListableRealm
Class CachingRealm works with some underlying realm implementation by caching the least recently used (LRU) bindings of names for users, groups, ACLs, and permissions.

Note that the functions from the ListableRealm interface return null unless the underlying realm implements ListableRealm itself. These functions do not use the cache because we cannot know how complete its information is.

A CachingRealm is configured through a class resource composed of the realm's name with the suffix .properties. The property values for userCacheSize, groupCacheSize, aclCacheSize, and permissionCacheSize can override the defaults of 20, 10, 20, and 0 for the respective cache sizes, and cachedRealmImpl can override the default examples.security.rdbmsrealm.RdbmsRealm for the class of the underlying realm implementation.

Author:
Copyright (c) 1997-1999 by BEA Systems. All Rights Reserved.

Variable Index

 o ACL_CACHE_SIZE
 o GROUP_CACHE_SIZE
 o PERM_CACHE_SIZE
 o REALM_IMPL
 o REALM_IMPL_DFLT
 o USER_CACHE_SIZE

Constructor Index

 o CachingRealm()
Default constructor.

Method Index

 o getAcl(String)
 o getAcl(String, char)
 o getAclOwner(Object)
 o getAcls()
 o getGroup(String)
 o getGroups()
 o getName()
 o getPermission(String)
 o getPermissions()
 o getStatistics()
Returns statistics about the number of requests, cache hits, and hit ratio.
 o getUser(String)
 o getUser(UserInfo)
 o getUsers()
 o init(String, Object)
Obtains resource and property values for size and implementation class and creates the implementation.
 o load(String, Object)
 o main(String[])
Creates a registered realm with the given name and password.
 o save(String)

Variables

 o USER_CACHE_SIZE
 public static final String USER_CACHE_SIZE
 o GROUP_CACHE_SIZE
 public static final String GROUP_CACHE_SIZE
 o ACL_CACHE_SIZE
 public static final String ACL_CACHE_SIZE
 o PERM_CACHE_SIZE
 public static final String PERM_CACHE_SIZE
 o REALM_IMPL
 public static final String REALM_IMPL
 o REALM_IMPL_DFLT
 public static final String REALM_IMPL_DFLT

Constructors

 o CachingRealm
 public CachingRealm()
Default constructor.

Methods

 o main
 public static void main(String argv[]) throws Exception
Creates a registered realm with the given name and password. This function is suitable for use with a startup class.

 o getStatistics
 public String getStatistics()
Returns statistics about the number of requests, cache hits, and hit ratio.

Returns:
Requests, cache hits, and hit ratio
 o init
 public void init(String name,
                  Object ownerCredential) throws NotOwnerException
Obtains resource and property values for size and implementation class and creates the implementation. If it implements ListableRealm set up support for delegating the ListableRealm functions. If it implements CacheableRealm set its cache to this.

 o getName
 public String getName()
 o getUser
 public User getUser(String name)
 o getUser
 public User getUser(UserInfo userInfo)
 o getAclOwner
 public Principal getAclOwner(Object credential)
 o getGroup
 public Group getGroup(String name)
 o getAcl
 public Acl getAcl(String name)
 o getAcl
 public Acl getAcl(String name,
                   char separator)
 o getPermission
 public Permission getPermission(String name)
 o load
 public void load(String name,
                  Object credential) throws ClassNotFoundException, IOException, NotOwnerException
 o save
 public void save(String name) throws IOException
 o getUsers
 public Enumeration getUsers()
 o getGroups
 public Enumeration getGroups()
 o getAcls
 public Enumeration getAcls()
 o getPermissions
 public Enumeration getPermissions()

All Examples  This Package