© 2004 BEA Systems, Inc.

com.bea.p13n.usermgmt
Class RealmHelper

java.lang.Object
  extended bycom.bea.p13n.usermgmt.RealmHelper

public class RealmHelper
extends Object

Utility methods for migrating from 6.x realm to 7.0 mbeans.


Method Summary
static AuthenticationProviderMBean getProviderMBean()
          Gets the AuthenticationProviderMBean to use for User and Group management.
static boolean isInMigrationMode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProviderMBean

public static AuthenticationProviderMBean getProviderMBean()
Gets the AuthenticationProviderMBean to use for User and Group management. Searches all the providers for the realm, looking for the "most useful" AuthenticationProviderMBean. Several search criteria are applied to the set of configured providers, and the first provider that matches is returned.

The returned provider is the first match from the following list:

  1. If the system property com.bea.p13n.usermgmt.AuthenticationProviderName, is set, the provider with that name is used. If the system property is set and the provider is not found, a UserManagementException is thrown. This allows you to set a provider server-wide.
  2. If a property file named usermgmt-provider.properties is found (using the thread's context classloader, so it could be in APP-INF/classes/, for example), and that file contains the property com.bea.p13n.usermgmt.AuthenticationProviderName, then the provider with that name is used. If the named provider is not found, a UserManagementException is thrown. This can allow you to set an application-specific provider.
  3. The provider that implements at least UserReaderMBean and GroupReaderMBean, plus the greatest number of the following additional interfaces. If two providers qualify, the first provider is chosen.
    • UserEditorMBean
    • GroupEditorMBean
    • GroupMemberListerMBean
    • MemberGroupListerMBean
  4. The first provider that is an instance of RealmAdapterAuthenticatorMBean (this is 6.x migration mode).
  5. If all those fail, throw UserManagementException
It is up to the client code to make sure that the returned mbean can be cast to the appropriate interface (i.e., check that it is a valid UserEditor).

The provider returned by this method is used by several methods in UserManager, GroupManager, and RealmConfiguration. If multiple providers are configured, these methods will only act on the single configured provider. Tags which use these methods also act on the single provider. The methods using this provider are:

  • UserManager.createUser()
  • UserManager.setPassword()
  • UserManager.removeUser()
  • UserManager.getUserNames()
  • GroupManager.createGroup()
  • GroupManager.removeGroup()
  • GroupManager.addUserToGroup()
  • GroupManager.removeUserFromGroup()
  • GroupManager.addGroupToGroup()
  • GroupManager.removeGroupFromGroup()
  • GroupManager.getTopLevelGroupNames()
  • GroupManager.getGroupNames()
  • GroupManager.getAllGroupNames()
  • GroupManager.getGroupNamesForUser()
  • GroupManager.getUsernamesForGroup()
  • GroupManager.getChildGroupNames()
  • GroupManager.getParentGroupName()
  • GroupManager.isDescendent()
  • GroupManager.isMember()
  • RealmConfiguration.getRealmUsers()
  • RealmConfiguration.getRealmGroups()
  • RealmConfiguration.isManageableRealm()

Returns:
the AuthenticationProviderMBean to use

isInMigrationMode

public static boolean isInMigrationMode()
Returns:
true if the system is using a 6.x realm in migration mode

© 2004 BEA Systems, Inc.

Copyright © 2004 BEA Systems, Inc. All Rights Reserved