WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

examples.security.rdbmsrealm
Class RDBMSDelegate

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

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.

Author:
Copyright (c) 1998-2000 by BEA Systems, Inc. All Rights Reserved.

Inner Class Summary
(package private) static class RDBMSDelegate.DFactory
          A factory class that creates instances of the RDBMSDelegate class for the purpose of pooling.
protected static class RDBMSDelegate.Finished
          This class indicates to a caller that a method has reached the end of a ResultSet.
 
Field Summary
protected  java.security.Principal aclOwner
          This is the bogus owner associated with all ACLs found in the database.
protected  java.sql.Connection conn
          The main connection to the database.
protected  java.sql.Connection conn2
           
protected  java.sql.Connection conn3
           
protected  java.sql.Connection conn4
           
protected  RDBMSRealm realm
          The realm with which this delegate is associated.
 
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)
           
 void close()
          Cleans up.
 void deleteGroup(java.security.acl.Group group)
           
 void deleteUser(weblogic.security.acl.User user)
           
protected  void finalize()
          Cleans up.
 java.security.acl.Acl getAcl(java.lang.String name)
          Gets an ACL from the database.
protected  java.security.acl.Acl getAclInternal(java.lang.String name, java.sql.ResultSet rs)
          Called by both getAcl and getAcls.
 java.util.Enumeration getAcls()
          Gets all ACLs from the database.
 java.security.acl.Group getGroup(java.lang.String name)
          Gets the named group from the database.
protected  java.security.acl.Group getGroupInternal(java.lang.String name, java.sql.ResultSet rs)
          This method is called both by getGroup and getGroups.
 java.util.Enumeration getGroups()
          Gets all groups from the database.
 java.security.acl.Permission getPermission(java.lang.String name)
          Obtains the named permission from the database.
 java.util.Enumeration getPermissions()
          Returns an enumeration of the permissions for the RDBMS security realm.
 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.Enumeration getUsers()
          Gets all users from the database.
 weblogic.security.acl.User newUser(java.lang.String name, java.lang.String passwd)
           
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)
           
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aclOwner

protected java.security.Principal aclOwner
This is the bogus owner associated with all ACLs found in the database.

conn

protected java.sql.Connection conn
The main connection to the database.

conn2

protected java.sql.Connection conn2

conn3

protected java.sql.Connection conn3

conn4

protected java.sql.Connection conn4

realm

protected RDBMSRealm realm
The realm with which this delegate is associated.
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

addGroupMember

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

close

public void close()
Cleans up.

deleteGroup

public void deleteGroup(java.security.acl.Group group)
                 throws java.sql.SQLException

deleteUser

public void deleteUser(weblogic.security.acl.User user)
                throws java.sql.SQLException

finalize

protected void finalize()
Cleans up.
Overrides:
finalize in class java.lang.Object

getAcl

public java.security.acl.Acl getAcl(java.lang.String name)
                             throws java.sql.SQLException
Gets an ACL from the database. Returns null if the ACL does not exist.

getAclInternal

protected java.security.acl.Acl getAclInternal(java.lang.String name,
                                               java.sql.ResultSet rs)
                                        throws RDBMSDelegate.Finished,
                                               java.sql.SQLException
Called by both getAcl and getAcls.

getAcls

public java.util.Enumeration getAcls()
                              throws java.sql.SQLException
Gets all ACLs from the database.

getGroup

public java.security.acl.Group getGroup(java.lang.String name)
                                 throws java.sql.SQLException
Gets the named group from the database. Returns Null if the group does not exist.

getGroupInternal

protected java.security.acl.Group getGroupInternal(java.lang.String name,
                                                   java.sql.ResultSet rs)
                                            throws RDBMSDelegate.Finished,
                                                   java.sql.SQLException
This method is called both by getGroup and getGroups. It looks through the given ResultSet and gathers group members until it either hits a differently-named group or the end of the ResultSet.

getGroups

public java.util.Enumeration getGroups()
                                throws java.sql.SQLException
Gets all groups from the database. The RDBMS security realm does not support empty groups.

getPermission

public java.security.acl.Permission getPermission(java.lang.String name)
                                           throws java.sql.SQLException
Obtains the named permission from the database. Returns null if none exist.

getPermissions

public java.util.Enumeration getPermissions()
                                     throws java.sql.SQLException
Returns an enumeration of the permissions for the RDBMS security realm.

getPrincipal

public java.security.Principal getPrincipal(java.lang.String name)
                                     throws java.sql.SQLException
Resolves a name to a User or Group. If the principal in question doesn't exist in the database, a null is returned.

getUser

public weblogic.security.acl.User getUser(java.lang.String name)
                                   throws java.sql.SQLException
Gets a user from the database. Returns Null if the user does not exist.

getUsers

public java.util.Enumeration getUsers()
                               throws java.sql.SQLException
Gets all users from the database.

newUser

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

prepare

protected java.sql.PreparedStatement prepare(java.lang.String propKey)
                                      throws java.sql.SQLException,
                                             RDBMSException
A shorthand convenience function for preparing an SQL statement.
Parameters:
name - the name of the statement to prepare

removeGroupMember

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

Documentation is available at
http://e-docs.bea.com/wls/docs60

Copyright © 2000 BEA Systems, Inc. All Rights Reserved.