oracle.ldap.util
Class Util

java.lang.Object
  |
  +--oracle.ldap.util.Util

public class Util
extends java.lang.Object


Field Summary
static java.lang.String API_VERSION
          The API version number
static int CREDTYPE_PASSWD
          Using userpassword to authenticate
static java.lang.String DASURL_ACCOUNT_INFO
          DAS URL type - Account Info
static java.lang.String DASURL_BASE
          DAS URL type - Base URL
static java.lang.String DASURL_CREATE_GROUP
          DAS URL type - Create Group
static java.lang.String DASURL_CREATE_RESOURCE
          DAS URL type - Create Resource
static java.lang.String DASURL_CREATE_USER
          DAS URL type - Create User
static java.lang.String DASURL_DELETE_GROUP
          DAS URL type - Delete Group
static java.lang.String DASURL_DELETE_GROUP_GIVEN_GUID
          DAS URL type - Delete Group Given GUID
static java.lang.String DASURL_DELETE_USER
          DAS URL type - Delete User
static java.lang.String DASURL_DELETE_USER_GIVEN_GUID
          DAS URL type - Delete User Given GUID
static java.lang.String DASURL_EDIT_GROUP
          DAS URL type - Edit Group
static java.lang.String DASURL_EDIT_GROUP_GIVEN_GUID
          DAS URL type - Edit Group Given GUID
static java.lang.String DASURL_EDIT_USER
          DAS URL type - Edit User
static java.lang.String DASURL_EDIT_USER_GIVEN_GUID
          DAS URL type - Edit User Given GUID
static java.lang.String DASURL_GROUP_LOV
          DAS URL type - Group LOV
static java.lang.String DASURL_GROUP_PRIVILEGE
          DAS URL type - Group Privilege
static java.lang.String DASURL_GROUP_PRIVILEGE_GIVEN_GUID
          DAS URL type - Group Privilege Given GUID
static java.lang.String DASURL_GROUP_SEARCH
          DAS URL type - Group Search
static java.lang.String DASURL_PASSWORD_CHANGE
          DAS URL type - Password Change
static java.lang.String DASURL_USER_LOV
          DAS URL type - User Lov
static java.lang.String DASURL_USER_PRIVILEGE
          DAS URL type - User Privilege
static java.lang.String DASURL_USER_PRIVILEGE_GIVEN_GUID
          DAS URL type - User Privilege Given GUID
static java.lang.String DASURL_USER_SEARCH
          DAS URL type - User Search
static int IDTYPE_DEFAULT
          Use default value
static int IDTYPE_DN
          The id used is a DN
static int IDTYPE_GUID
          The id used is a GUID
static int IDTYPE_SIMPLE
          The id used is a simple id
static java.lang.String INTERFACE_VERSION
          The Interface version number
static int PROPERTIES_DETACHED
          User detached properties
static int PROPERTIES_ENTRY
          User entry properties
 
Constructor Summary
Util()
           
 
Method Summary
static void authenticateUser(javax.naming.directory.DirContext ctx, User curUser, int authType, java.lang.Object cred)
          Authenticate User using the appropriate credentials
static boolean checkInterfaceVersion(java.lang.String intVersion)
          This method checks if the interface version given is supported with the version of the current API
static void createDefaultSubscriber(javax.naming.directory.DirContext ctx, java.lang.String ohome, java.lang.String domain, java.lang.String subscriber)
           
static java.util.Hashtable getAllDASUrl(javax.naming.directory.DirContext ctx)
          Returns a Hashtable containing all the DAS URLs.
static java.lang.String getDASUrl(javax.naming.directory.DirContext ctx, java.lang.String urlTypeDN)
          Returns a particular DAS url identified by the urlTypeDN.
static java.lang.String[] getDefaultSubscriber()
           
static java.lang.String getDomain()
           
static PropertySetCollection getEntryDetails(javax.naming.directory.DirContext ctx, java.lang.String base, java.lang.String filter, int scope, java.lang.String[] attrList)
           
static PropertySetCollection getGroupMembership(javax.naming.directory.DirContext ctx, User curUser, java.lang.String[] attrList, boolean nested)
          Return a list of groups the user belongs to directly or indirectly
static PropertySetCollection getOwnership(javax.naming.directory.DirContext ctx, User curUser, java.lang.String[] attrList, boolean nested)
           
static java.lang.String getSubscriberDn(javax.naming.directory.DirContext ctx, java.lang.String subId, int subIdType)
          Returns the DN of the given subscriber.
static java.lang.String getUserDn(javax.naming.directory.DirContext ctx, java.lang.String userId, int userIdType, java.lang.String subscriberDN)
          Returns the DN of the given user.
static java.lang.String normalizeDN(java.lang.String inDn)
           
static void printResults(PropertySetCollection resultSet)
          Prints the entries represented by the PropertySetCollecition in LDIF format
static void setEntryDetails(javax.naming.directory.DirContext ctx, java.lang.String base, javax.naming.directory.ModificationItem[] mods)
           
static void subAndLoadLdif(javax.naming.directory.DirContext ctx, java.lang.String filename, java.util.Vector subVector)
           
static java.lang.String[] vector2StrArray(java.util.Vector list)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

API_VERSION

public static java.lang.String API_VERSION
The API version number

INTERFACE_VERSION

public static java.lang.String INTERFACE_VERSION
The Interface version number

IDTYPE_DN

public static int IDTYPE_DN
The id used is a DN

IDTYPE_SIMPLE

public static int IDTYPE_SIMPLE
The id used is a simple id

IDTYPE_GUID

public static int IDTYPE_GUID
The id used is a GUID

IDTYPE_DEFAULT

public static int IDTYPE_DEFAULT
Use default value

PROPERTIES_ENTRY

public static int PROPERTIES_ENTRY
User entry properties

PROPERTIES_DETACHED

public static int PROPERTIES_DETACHED
User detached properties

CREDTYPE_PASSWD

public static int CREDTYPE_PASSWD
Using userpassword to authenticate

DASURL_BASE

public static java.lang.String DASURL_BASE
DAS URL type - Base URL

DASURL_CREATE_USER

public static java.lang.String DASURL_CREATE_USER
DAS URL type - Create User

DASURL_EDIT_GROUP

public static java.lang.String DASURL_EDIT_GROUP
DAS URL type - Edit Group

DASURL_EDIT_GROUP_GIVEN_GUID

public static java.lang.String DASURL_EDIT_GROUP_GIVEN_GUID
DAS URL type - Edit Group Given GUID

DASURL_GROUP_SEARCH

public static java.lang.String DASURL_GROUP_SEARCH
DAS URL type - Group Search

DASURL_EDIT_USER

public static java.lang.String DASURL_EDIT_USER
DAS URL type - Edit User

DASURL_GROUP_LOV

public static java.lang.String DASURL_GROUP_LOV
DAS URL type - Group LOV

DASURL_DELETE_USER

public static java.lang.String DASURL_DELETE_USER
DAS URL type - Delete User

DASURL_USER_PRIVILEGE

public static java.lang.String DASURL_USER_PRIVILEGE
DAS URL type - User Privilege

DASURL_CREATE_GROUP

public static java.lang.String DASURL_CREATE_GROUP
DAS URL type - Create Group

DASURL_USER_SEARCH

public static java.lang.String DASURL_USER_SEARCH
DAS URL type - User Search

DASURL_ACCOUNT_INFO

public static java.lang.String DASURL_ACCOUNT_INFO
DAS URL type - Account Info

DASURL_EDIT_USER_GIVEN_GUID

public static java.lang.String DASURL_EDIT_USER_GIVEN_GUID
DAS URL type - Edit User Given GUID

DASURL_DELETE_USER_GIVEN_GUID

public static java.lang.String DASURL_DELETE_USER_GIVEN_GUID
DAS URL type - Delete User Given GUID

DASURL_DELETE_GROUP_GIVEN_GUID

public static java.lang.String DASURL_DELETE_GROUP_GIVEN_GUID
DAS URL type - Delete Group Given GUID

DASURL_GROUP_PRIVILEGE

public static java.lang.String DASURL_GROUP_PRIVILEGE
DAS URL type - Group Privilege

DASURL_USER_PRIVILEGE_GIVEN_GUID

public static java.lang.String DASURL_USER_PRIVILEGE_GIVEN_GUID
DAS URL type - User Privilege Given GUID

DASURL_PASSWORD_CHANGE

public static java.lang.String DASURL_PASSWORD_CHANGE
DAS URL type - Password Change

DASURL_USER_LOV

public static java.lang.String DASURL_USER_LOV
DAS URL type - User Lov

DASURL_GROUP_PRIVILEGE_GIVEN_GUID

public static java.lang.String DASURL_GROUP_PRIVILEGE_GIVEN_GUID
DAS URL type - Group Privilege Given GUID

DASURL_DELETE_GROUP

public static java.lang.String DASURL_DELETE_GROUP
DAS URL type - Delete Group

DASURL_CREATE_RESOURCE

public static java.lang.String DASURL_CREATE_RESOURCE
DAS URL type - Create Resource
Constructor Detail

Util

public Util()
Method Detail

getEntryDetails

public static PropertySetCollection getEntryDetails(javax.naming.directory.DirContext ctx,
                                                    java.lang.String base,
                                                    java.lang.String filter,
                                                    int scope,
                                                    java.lang.String[] attrList)
                                             throws javax.naming.NamingException

setEntryDetails

public static void setEntryDetails(javax.naming.directory.DirContext ctx,
                                   java.lang.String base,
                                   javax.naming.directory.ModificationItem[] mods)
                            throws UtilException

authenticateUser

public static void authenticateUser(javax.naming.directory.DirContext ctx,
                                    User curUser,
                                    int authType,
                                    java.lang.Object cred)
                             throws UtilException
Authenticate User using the appropriate credentials
Parameters:
ctx - a valid DirContext
authType - Util.CREDTYPE_PASSWD is the only one supported at the moment
cred - the credentials based on the authType
Throws:
UtilException -  

getSubscriberDn

public static java.lang.String getSubscriberDn(javax.naming.directory.DirContext ctx,
                                               java.lang.String subId,
                                               int subIdType)
                                        throws UtilException
Returns the DN of the given subscriber. If DN is used as the subscriber ID, then simply look up the DN to validate it
Parameters:
ctx - a valid DirContext
subId - Subscriber ID
subIdType - The type of subscriber id being used - use one of IDTYPE_DN, IDTYPE_SIMPLE or Util.IDTYPE_GUID
Throws:
UtilException -  

getUserDn

public static java.lang.String getUserDn(javax.naming.directory.DirContext ctx,
                                         java.lang.String userId,
                                         int userIdType,
                                         java.lang.String subscriberDN)
                                  throws UtilException
Returns the DN of the given user. If DN is used as the user ID, then simply look up the DN to validate it. If subscriber DN is null, default subscriber will be used
Parameters:
ctx - a valid DirContext
userId - User ID
userIdType - The type of user id being used - use one of IDTYPE_DN, IDTYPE_SIMPLE or Util.IDTYPE_GUID
Throws:
UtilException -  

getOwnership

public static PropertySetCollection getOwnership(javax.naming.directory.DirContext ctx,
                                                 User curUser,
                                                 java.lang.String[] attrList,
                                                 boolean nested)
                                          throws UtilException

getGroupMembership

public static PropertySetCollection getGroupMembership(javax.naming.directory.DirContext ctx,
                                                       User curUser,
                                                       java.lang.String[] attrList,
                                                       boolean nested)
                                                throws UtilException
Return a list of groups the user belongs to directly or indirectly
Parameters:
ctx - a valid DirContext
curUser - a valid User object
attrList - a String array of attributes to be retrieved from each group
nested - Set to true to look for nested membership. Otherwise, only direct memberships are returned
Throws:
UtilException -  

vector2StrArray

public static java.lang.String[] vector2StrArray(java.util.Vector list)

normalizeDN

public static java.lang.String normalizeDN(java.lang.String inDn)

getDASUrl

public static java.lang.String getDASUrl(javax.naming.directory.DirContext ctx,
                                         java.lang.String urlTypeDN)
                                  throws UtilException
Returns a particular DAS url identified by the urlTypeDN.
Parameters:
ctx - a valid DirContext
urlTypeDN - use one of Util.DASURL_* which represents a particular URL type.
Returns:
a String representing the URL

getAllDASUrl

public static java.util.Hashtable getAllDASUrl(javax.naming.directory.DirContext ctx)
                                        throws UtilException
Returns a Hashtable containing all the DAS URLs. Each individual url can then be retrieved from the Hashtable using Util.DASURL_* as the key to identify the URL type.
Parameters:
ctx - a valid DirContext
Returns:
a Hashtable containing all the DAS URLs

printResults

public static void printResults(PropertySetCollection resultSet)
Prints the entries represented by the PropertySetCollecition in LDIF format
Parameters:
resultSet - A valid ProperSetCollection

getDefaultSubscriber

public static java.lang.String[] getDefaultSubscriber()

getDomain

public static java.lang.String getDomain()

createDefaultSubscriber

public static void createDefaultSubscriber(javax.naming.directory.DirContext ctx,
                                           java.lang.String ohome,
                                           java.lang.String domain,
                                           java.lang.String subscriber)

subAndLoadLdif

public static void subAndLoadLdif(javax.naming.directory.DirContext ctx,
                                  java.lang.String filename,
                                  java.util.Vector subVector)

checkInterfaceVersion

public static boolean checkInterfaceVersion(java.lang.String intVersion)
This method checks if the interface version given is supported with the version of the current API
Parameters:
String - Interface Version