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

## com.bea.p13n.security.realm
Class RDBMSDelegate

    java.lang.Object
      |
      +--com.bea.p13n.security.realm.RDBMSDelegate

Direct Known Subclasses:
  RDBMSPerformanceDelegate

public class RDBMSDelegate
extends java.lang.Object

An instance of this class communicates with a single database connection. A pool of instances is then maintained by RDBMSRealm to provide high performance.

Field Summary
`protected java.sql.Connection` | `conn` The main connection to the database.
`protected RDBMSRealm` | `realm` The realm with which this delegate is associated.
`protected static com.bea.p13n.i18n.RealmExceptionTextFormatter` | `textFormatter` Exception class

Constructor Summary
`protected` | `RDBMSDelegate(RDBMSRealm realm)` Creates a new delegate associated with the given realm.

Method Summary
`boolean` | `addGroupMember(RDBMSGroup group, java.security.Principal member)` Add a member to a group.
`void` | `close()` Cleans up by closing all statements and connections.
`protected void` | `close(java.sql.PreparedStatement stmt)` Close a prepared statement
`protected void` | `close(java.sql.ResultSet rs)` Close a result set.
`void` | `deleteGroup(RDBMSGroup group)` Deletes a group from the database.
`void` | `deleteUser(com.bea.p13n.security.realm.RDBMSUser user)` Deletes a user from the database.
`protected void` | `finalize()` Cleans up.
`java.security.acl.Group` | `getGroup(java.lang.String name)` Gets the named group from the database.
`java.util.Map` | `getGroupGroups(RDBMSGroup pGroup)` Gets the direct child groups for a given group.
`java.util.Hashtable` | `getGroupMembers(RDBMSGroup group)` Get the membership information for a group.
`java.util.Enumeration` | `getGroups()` Gets all groups from the database.
`java.util.Map` | `getGroupUsers(RDBMSGroup pGroup)` Gets all users for a particular group from the database.
`protected long` | `getNextGroupId()` Get the next unique group id for a new group.
`protected long` | `getNextUserId()` Get the next unique user id for a new user.
`java.security.Principal` | `getPrincipal(java.lang.String name)` Resolves a name to a User or Group.
`weblogic.security.acl.User` | `getUser(java.lang.String name)` Gets a user from the database.
`java.util.Map` | `getUserGroups(java.lang.String pUserName)`
`java.util.Enumeration` | `getUsers()` Gets all users from the database.
`boolean` | `isValid()` Check to see if this delegate's connection is still open
`java.security.acl.Group` | `newGroup(java.lang.String name)` Create a new group record in the database.
`weblogic.security.acl.User` | `newUser(java.lang.String name, java.lang.String passwd)` Create a new user in the database.
`protected java.sql.PreparedStatement` | `prepare(java.lang.String propKey)` A shorthand convenience function for preparing an SQL statement.
`boolean` | `removeGroupMember(RDBMSGroup group, java.security.Principal member)` Remove a member from a group.
`void` | `setPassword(java.lang.String name, java.lang.String password)` Set the password for a user in the database.

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### textFormatter

    protected static final com.bea.p13n.i18n.RealmExceptionTextFormatter textFormatter

  Exception class

### realm

    protected RDBMSRealm realm

  The realm with which this delegate is associated.

### conn

    protected java.sql.Connection conn

  The main connection to the database.

Constructor Detail

### RDBMSDelegate

    protected RDBMSDelegate(RDBMSRealm realm)

  Creates a new delegate associated with the given realm.

  Throws:
    RDBMSException - an error occurred in fetching properties or communicating with the database

Method Detail

### prepare

    protected java.sql.PreparedStatement prepare(java.lang.String propKey)
                                          throws java.sql.SQLException

  A shorthand convenience function for preparing an SQL statement.

  Parameters:
    `name` - the name of the statement to prepare

### isValid

    public boolean isValid()

  Check to see if this delegate's connection is still open

### getUser

    public weblogic.security.acl.User getUser(java.lang.String name)
                                       throws java.sql.SQLException

  Gets a user from the database.

  Parameters:
    `name` - the username
  Returns:
    the User, or null if it was not found

### getUsers

    public java.util.Enumeration getUsers()
                                   throws java.sql.SQLException

  Gets all users from the database.

  Returns:
    an enumeration of Users

### getGroupUsers

    public java.util.Map getGroupUsers(RDBMSGroup pGroup)
                                throws java.sql.SQLException

  Gets all users for a particular group from the database.

  Parameters:
    `pGroup` - the group that we are interested in.
  Returns:
    a thread-safe Map of Users

### getGroup

    public java.security.acl.Group getGroup(java.lang.String name)
                                     throws java.sql.SQLException

  Gets the named group from the database.

  Parameters:
    `name` - the group name
  Returns:
    the Group object, or null if it was not found

### getGroups

    public java.util.Enumeration getGroups()
                                    throws java.sql.SQLException

  Gets all groups from the database. This does not populate their membership caches; the RDBMSGroup object retrieves this information on-demand, and when its cache expires.

  Returns:
    an Enumeration of Groups

### getUserGroups

    public java.util.Map getUserGroups(java.lang.String pUserName)
                                throws java.sql.SQLException

### getGroupGroups

    public java.util.Map getGroupGroups(RDBMSGroup pGroup)
                                 throws java.sql.SQLException

  Gets the direct child groups for a given group. This does not populate their group caches; the RDBMSGroup object retrieves this information on-demand, and when its cache expires.

  Parameters:
    `pGroup` - the group that we are interested in
  Returns:
    a thread-safe Map of groups for a particular user

### getGroupMembers

    public java.util.Hashtable getGroupMembers(RDBMSGroup group)
                                        throws java.sql.SQLException

  Get the membership information for a group.

  Parameters:
    `group` - the group to query
  Returns:
    a hashtable of name->principal mappings

### newUser

    public weblogic.security.acl.User newUser(java.lang.String name,
                                              java.lang.String passwd)
                                       throws java.sql.SQLException,
                                              java.lang.SecurityException

  Create a new user in the database. This method will call the static hash method on RDBMSUser to encrypt the password.

  Parameters:
    `name` - the new username
    `passwd` - the user's password, *not* encrypted
  Returns:
    the new User object
  Throws:
    java.lang.SecurityException - if the user already exists

### setPassword

    public void setPassword(java.lang.String name,
                            java.lang.String password)
                     throws java.sql.SQLException,
                            java.lang.SecurityException

  Set the password for a user in the database. This is intended to be called by an existing user object, who is responsible for encrypting the password beforehand.

  Parameters:
    `name` - the name of the user to update
    `password` - the new password, already encrypted
  Throws:
    java.lang.SecurityException - if the user does not exist

### newGroup

    public java.security.acl.Group newGroup(java.lang.String name)
                                     throws java.sql.SQLException,
                                            java.lang.SecurityException

  Create a new group record in the database.

  Parameters:
    `the` - new group name
  Returns:
    the Group object
  Throws:
    java.lang.SecurityException - if the group already exists

### deleteUser

    public void deleteUser(com.bea.p13n.security.realm.RDBMSUser user)
                    throws java.sql.SQLException

  Deletes a user from the database.

  Parameters:
    `user` - the user to delete

### deleteGroup

    public void deleteGroup(RDBMSGroup group)
                     throws java.sql.SQLException

  Deletes a group from the database.

  Parameters:
    `user` - the user to delete

### addGroupMember

    public boolean addGroupMember(RDBMSGroup group,
                                  java.security.Principal member)
                           throws java.sql.SQLException

  Add a member to a group. The new member can be either a user or another group. This does NOT check to see if the member already belongs to the group; it is only meant to be called by the group object itself, via the realm, and it is assumed that the group performs this check.

  Parameters:
    `group` - the group to add a member to
    `member` - the new group member
  Returns:
    true always

### removeGroupMember

    public boolean removeGroupMember(RDBMSGroup group,
                                     java.security.Principal member)
                              throws java.sql.SQLException

  Remove a member from a group. Again, the member can be either a user or another group.

  Parameters:
    `group` - the group to remove from
    `member` - the member to remove
  Returns:
    true always

### getPrincipal

    public java.security.Principal getPrincipal(java.lang.String name)
                                         throws java.sql.SQLException

  Resolves a name to a User or Group. First attempts to find a user by that name, and then to find a group.

  Returns:
    the found Principal, or null if none was found

### getNextUserId

    protected long getNextUserId()
                          throws java.sql.SQLException

  Get the next unique user id for a new user.

### getNextGroupId

    protected long getNextGroupId()
                           throws java.sql.SQLException

  Get the next unique group id for a new group.

### finalize

    protected void finalize()

  Cleans up.

  Overrides:
    finalize in class java.lang.Object

### close

    public void close()

  Cleans up by closing all statements and connections.

### close

    protected void close(java.sql.PreparedStatement stmt)

  Close a prepared statement

### close

    protected void close(java.sql.ResultSet rs)

  Close a result set.

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

Copyright © 2002 BEA Systems, Inc. All Rights Reserved