Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 6.0sp2 API Reference

## weblogic.security.acl
Class FlatGroup

    java.lang.Object
      |
      +--weblogic.security.acl.DefaultGroupImpl
            |
            +--weblogic.security.acl.FlatGroup

public abstract class FlatGroup
extends DefaultGroupImpl

Caching group implementation. Cooperates with classes that inherit from AbstractListableRealm, to provide a group implementation that remains up-to-date when its backing store changes.

FlatGroup attempts to avoid the problem of a Group object being created with a snapshot of the "real" group which is never afterwards updated. For example, if you store group information in a remote server and create a WebLogic ACL that refers to that group, the ACL will become out of date if the membership of that group ever changes on the remote server.

FlatGroup avoids that problem by maintaining its group membership in a cache, instead of a never-changing set. When the cache expires, this group implementation will query the realm that created it to obtain the most recent membership information. This query is performed by calling the FlatGroup.Source.getGroupMembers method (which is implemented by AsbtractListableRealm).

As a result of caching its membership information, a FlatGroup can occasionally become temporarily out-of-date with respect to its backing store, but this caching is necessary to maintain reasonable WebLogic Server performance.

By default, group membership information is cached for 5 minutes. If necessary, you can change this value by setting the `weblogic.security.groupCacheTTL` system property to the number of seconds you need (this value must be greater than zero).

Author:
  Copyright (c) 2000 BEA Systems, Inc. All Rights Reserved.
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
  `AbstractListableRealm`

Inner Class Summary
`static interface` | `FlatGroup.Source` Interface to be implemented by realm classes that use FlatGroup.

Field Summary
`static int` | `LIFETIME_DEFAULT_SEC` Default cache lifetime, in seconds.
`protected java.util.Hashtable` | `members`

Constructor Summary
`protected` | `FlatGroup(java.lang.String name, FlatGroup.Source source)` Create a new group, with no membership information.
`protected` | `FlatGroup(java.lang.String name, FlatGroup.Source source, java.util.Hashtable members)` Create a new group, with the given membership information.

Method Summary
`protected boolean` | `addMemberInternal(java.security.Principal principal)` Update this object's internal state when adding a member.
`protected void` | `ensureFreshness()` Important method for implementors.
`boolean` | `equals(java.lang.Object obj)`
`static long` | `getCacheTTLMillis()` Get the current group membership cache TTL, in milliseconds
`protected abstract java.lang.Class` | `getUserClass()` Return the class object used by users in this realm.
`int` | `hashCode()`
`boolean` | `isMember(java.security.Principal member)` Returns true if the passed principal is a member of the group.
`java.util.Enumeration` | `members()` Returns an enumeration of the members in the group.
`protected boolean` | `removeMemberInternal(java.security.Principal principal)` Update this object's internal state when removing a member.
`protected static void` | `setCacheTTL(long millis)` Set this group's membership cache TTL.
`java.lang.String` | `toString()`

Methods inherited from class weblogic.security.acl.DefaultGroupImpl
`addMember, getName, removeMember`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### LIFETIME_DEFAULT_SEC

    public static final int LIFETIME_DEFAULT_SEC

  Default cache lifetime, in seconds.

### members

    protected java.util.Hashtable members

Constructor Detail

### FlatGroup

    protected FlatGroup(java.lang.String name,
                        FlatGroup.Source source)

  Create a new group, with no membership information. The membership cache won't be populated until the first relevant method is called.

### FlatGroup

    protected FlatGroup(java.lang.String name,
                        FlatGroup.Source source,
                        java.util.Hashtable members)

  Create a new group, with the given membership information. The membership cache is immediately populated.

Method Detail

### ensureFreshness

    protected final void ensureFreshness()

  Important method for implementors. If you override any methods in this class, you should call this method inside a synchronized(this) block before doing anything else, otherwise you risk group membership information being either out-of-date or completely nonexistent.

### isMember

    public boolean isMember(java.security.Principal member)

  Returns true if the passed principal is a member of the group. This method does a recursive search, so if a principal belongs to a group which is a member of this group, true is returned.

  Parameters:
    `member` - the principal whose membership is to be checked.
  Returns:
    true if the principal is a member of this group, false otherwise.
  Overrides:
    isMember in class DefaultGroupImpl

### members

    public java.util.Enumeration members()

  Returns an enumeration of the members in the group. The returned objects can be instances of either Principal or Group (which is a subclass of Principal).

  Returns:
    an enumeration of the group members.
  Overrides:
    members in class DefaultGroupImpl

### toString

    public java.lang.String toString()

  Overrides:
    toString in class DefaultGroupImpl

### hashCode

    public int hashCode()

  Overrides:
    hashCode in class java.lang.Object

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    equals in class java.lang.Object

### getUserClass

    protected abstract java.lang.Class getUserClass()

  Return the class object used by users in this realm. This is used to perform fast and safe membership checks.

### addMemberInternal

    protected boolean addMemberInternal(java.security.Principal principal)

  Update this object's internal state when adding a member. You should call this if you write a new implementation of addMember, performing the call after your add succeeds.

### removeMemberInternal

    protected boolean removeMemberInternal(java.security.Principal principal)

  Update this object's internal state when removing a member. You should call this if you write a new implementation of removeMember, performing the call after your remove succeeds.

### setCacheTTL

    protected static final void setCacheTTL(long millis)

  Set this group's membership cache TTL. Note that this is a server-wide property, so changing this value will affect all objects that inherit from FlatGroup.

  Parameters:
    `millis` - new TTL, in milliseconds (must be positive)

### getCacheTTLMillis

    public static final long getCacheTTLMillis()

  Get the current group membership cache TTL, in milliseconds

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs60
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD