Skip navigation links

Oracle Internet Directory API Reference
11g Release 1 (11.1.1)

E10664-01


oracle.ldap.util
Class Util

java.lang.Object
  extended by oracle.ldap.util.Util


public class Util
extends java.lang.Object

Util class provides a set of static utility methods that are used throughout the oracle.ldap.util package. Many of these APIs are generic LDAP methods that are extremely useful in performing LDAP operations.


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_DELEGATION_CONSOLE
          DAS URL type - Delegation Console
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_MY_PROFILE
          DAS URL type - Edit My Profile
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_EUS_CONSOLE
          DAS URL type - EUS Console
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_RESET_PASSWORD
          DAS URL type - Reset Password
static java.lang.String DASURL_TIMEZONE
          DAS URL type - Time Zone
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 java.lang.String DASURL_VIEW_USER_PROFILE
          DAS URL type - View User Profile
static int FILE_CREATEABLE
          Constant to indicate the check for the ability to create the file.
static int FILE_EXISTENCE
          Constant to indicate the check for existence of a file.
static int FILE_NOT_EMPTY
          Constant to indicate the check for non-emptiness of a file.
static int FILE_NOT_EXISTENCE
          Constant to indicate the check for not existence of a file.
static int FILE_READABLE
          Constant to indicate the check for readablity of a file.
static int FILE_WRITABLE
          Constant to indicate the check for writability of a file.
static int IDTYPE_DEFAULT
          Use default value
static int IDTYPE_DN
          The id type used is a DN
static int IDTYPE_FILTER
          The id type used is a filter
static int IDTYPE_GUID
          The id type used is a GUID
static int IDTYPE_KERB_PRINCIPAL
          The id type used is a Kerberos Principal
static int IDTYPE_SIMPLE
          The id type used is a simple id
static int IDTYPE_WINDOWS
          The id type used is a Windows user 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
static int PWD_VERIFIERTYPE_COMMON
          The Common Password Verifier

 

Constructor Summary
Util()
           

 

Method Summary
static void addUniquemember(javax.naming.directory.DirContext ctx, java.lang.String base, java.lang.String memberDn)
           
static void authenticateUser(javax.naming.directory.DirContext ctx, User curUser, int authType, java.lang.Object cred)
          Authenticate User using the appropriate credentials
static void bulkDelete(javax.naming.directory.DirContext ctx, java.lang.String base, boolean deleteBaseDN)
          Deletes the entire sub-tree from the base DN.
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 java.lang.String createDN(javax.naming.directory.DirContext ctx, java.lang.String inDN)
           
static boolean dnExists(javax.naming.directory.DirContext ctx, java.lang.String dn)
          Returns true if the given DN exists
static PropertySetCollection dnExists(javax.naming.directory.DirContext ctx, java.lang.String dn, java.lang.String[] attrs)
          Returns a non-null PropertySetCollection if DN exists.
static java.util.Hashtable getAllDASUrl(javax.naming.directory.DirContext ctx)
          Returns a Hashtable containing all the DAS URLs.
static java.lang.String getAttrOfRDN(java.lang.String rdn)
          Returns the attribute part of the RDN For example, if rdn is "dc=acme", "dc" will be returned
static java.lang.String getAttrValueOfRDN(java.lang.String rdn)
          Returns the value part of the RDN For example, if rdn is "dc=acme", "acme" will be retuned
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[] getDefaultSubscriber(java.util.logging.Logger lgr)
           
static java.lang.String getDomain()
           
static java.lang.String getDomain(java.util.logging.Logger lgr)
           
static PropertySetCollection getEntryDetails(javax.naming.directory.DirContext ctx, java.lang.String base, java.lang.String filter, int scope, java.lang.String[] attrList)
           
static java.lang.Object getEntryDetails(javax.naming.directory.DirContext ctx, java.lang.String base, java.lang.String filter, int scope, java.lang.String[] attrList, boolean convert)
           
static java.lang.Object getEntryDetails(javax.naming.directory.DirContext ctx, java.lang.String base, java.lang.String filter, javax.naming.directory.SearchControls ctls)
          getEntryDetails
static LDIFRecord getEntryFromDirectory(javax.naming.directory.DirContext dirCtx, java.lang.String dn)
          Use this method to retrieve the a particular entry from the directory.
static java.lang.String getFQHN()
          Returns the Fully Qualified Host Name of the local machine.
static PropertySetCollection getGroupMembership(javax.naming.directory.DirContext ctx, java.lang.String dn, java.lang.String[] attrList, boolean nested)
           
static PropertySetCollection getGroupMembership(javax.naming.directory.DirContext ctx, java.lang.String dn, java.lang.String[] attrList, boolean nested, java.lang.String memberAttribute)
          Returns a PropertySetCollection of groups that the dn belongs to directly or indirectly.
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 The groups are returned in a PropertySetCollection.
static java.lang.String getIAC_DNFromFQHN()
          Returns a DN based on the fully qualified host name.
static LDIFRecord getLDIFRecord(java.lang.String dn, javax.naming.directory.Attributes pAttrs)
          Use this method to convert a set of attributes and a DN into an LDIFRecord
static LDAPObjectClass getObjectClass(javax.naming.directory.DirContext ctx, java.lang.String inID)
          Returns a LDAPObjectClass object representing the objectclass identified by inID.
static PropertySetCollection getOwnership(javax.naming.directory.DirContext ctx, java.lang.String dn, java.lang.String[] attrList, boolean nested)
          Returns a PropertySetCollection of DNs where the input DN is an owner.
protected static PropertySetCollection getOwnership(javax.naming.directory.DirContext ctx, java.lang.String base, java.lang.String dn, java.lang.String[] attrList, boolean nested)
           
static PropertySetCollection getOwnership(javax.naming.directory.DirContext ctx, User curUser, java.lang.String[] attrList, boolean nested)
          Returns a PropertySetCollection of DNs where the user is an owner.
static java.lang.String getParameterFromFile(java.lang.String parameter, java.lang.String fileName)
          Returns the value of the parameter from file.
static java.lang.String getParentDN(java.lang.String dn)
          Returns the parent DN of the given DN For example, if dn is "dc=acme,dc=com", getParentDN returns "dc=com".
static java.lang.String getRDN(java.lang.String dn)
          Returns the RDN portion of the DN.
static java.lang.String[] getSSODBInfo(javax.naming.directory.DirContext ctx)
           
static java.lang.String getSubscriberDn(javax.naming.directory.DirContext ctx, java.lang.String subId, int subIdType)
           
static java.lang.String getSubscriberDn(javax.naming.directory.DirContext ctx, java.lang.String subId, int subIdType, java.util.logging.Logger lgr)
          Deprecated. Use Subscriber.getDN(ctx)
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.
protected static void grpErrHandler(javax.naming.NamingException ne, UtilException ue)
           
static java.lang.String handleSpecialChars(java.lang.String originalString)
          handleSpecialChars for the string value after '=' of a filter If the string value should contain one of the characters of this set { '*', ')', '(', '\', NULL}, this operation adds an escape '\' character (ASCII 0x5c) followed by the two hexadecimal digits representing the ASCII value of the encoded character.
static java.lang.String handleSpecialFilterChars(java.lang.String originalString)
           
static void ldapAdd(javax.naming.directory.DirContext ctx, java.lang.String base, ModPropertySet ps)
          Performs ldapadd and creates a new entry specified by the base DN.
static boolean ldapCompare(javax.naming.directory.DirContext ctx, java.lang.String baseDN, java.lang.String attr, java.lang.Object attrval)
          Performs ldapcompare on the specified baseDN comparing the attribute and its value as specified
static void ldapDelete(javax.naming.directory.DirContext ctx, java.lang.String base)
          Performs ldapdelete of the base DN.
static void ldapModify(javax.naming.directory.DirContext ctx, java.util.logging.Logger lgr, java.lang.String fileName, java.util.Vector subVector, boolean ignoreError)
          Performs ldapmodify using the specified LDIF file.
static void ldapModify(javax.naming.directory.DirContext ctx, java.util.logging.Logger lgr, java.lang.String fileName, java.util.Vector subVector, boolean ignoreError, java.io.PrintStream pStream)
          Performs ldapmodify using the specified LDIF file.
static void ldapModify(javax.naming.directory.DirContext ctx, java.lang.String base, ModPropertySet ps)
          Performs ldapmodify on the base DN using the ModPropertySet specified.
static void ldapModify(javax.naming.directory.DirContext ctx, java.lang.String fileName, java.util.Vector subVector, boolean ignoreError)
           
static void ldapModify(javax.naming.directory.DirContext ctx, java.lang.String fileName, java.util.Vector subVector, boolean ignoreError, java.io.PrintStream pStream)
           
static PropertySetCollection ldapSearch(javax.naming.directory.DirContext ctx, java.lang.String base, java.lang.String filter, int scope, java.lang.String[] attrList)
          Performs an ldapsearch with the specified information.
static java.lang.String makeFilter(java.lang.String attr, java.lang.String value)
          makeFilter
static PropertySetCollection multiSearchBaseSearch(javax.naming.directory.DirContext ctx, java.lang.String specifiedSearchBase, java.lang.String[] allSearchBases, java.lang.String filter, java.lang.String[] attrList, boolean returnONE)
           
static java.lang.String normalizeDN(java.lang.String inDN)
          Normalizes the DN.
static java.lang.String normalizeDN(java.lang.String inDN, java.lang.String[] attrList)
          Normalizes the DN and ensures that it only contains the attributes from the attrList.
static void performLDAPOperation(javax.naming.directory.DirContext dirCtx, LDIFRecord ldifRecord)
          Use this method to perform an LDAP operation.
static void printResults(PropertySetCollection resultSet)
          Prints the entries represented by the PropertySetCollecition in LDIF format to Standard Output
static void removeUniquemember(javax.naming.directory.DirContext ctx, Group[] groupArr, java.lang.String memberDn)
           
static void removeUniquemember(javax.naming.directory.DirContext ctx, Group group, java.lang.String memberDn)
           
static void removeUniquemember(javax.naming.directory.DirContext ctx, java.lang.String[] groupDNArr, java.lang.String memberDn)
           
static void removeUniquemember(javax.naming.directory.DirContext ctx, java.lang.String groupDN, java.lang.String memberDn)
           
static java.lang.String resolveDuplicateDN(javax.naming.directory.DirContext ctx, java.lang.String dnString)
          Returns a unique DN whose value is guaranteed to be unique in the specified LDAP server.
static void setEntryDetails(javax.naming.directory.DirContext ctx, java.lang.String base, javax.naming.directory.ModificationItem[] mods)
          setEntryDetails
static void setEntryDetails(javax.naming.directory.DirContext ctx, java.lang.String base, ModPropertySet ps)
          setEntryDetails
static void subAndLoadLdif(javax.naming.directory.DirContext ctx, java.lang.String filename, java.util.Vector subVector)
           
static void subAndLoadLdif(javax.naming.directory.DirContext ctx, java.lang.String filename, java.util.Vector subVector, java.util.logging.Logger lgr)
           
static void validateFile(java.io.File fileObj, int checkFor)
           
static void validateFile(java.lang.String fileName, int checkFor)
          Use this method to validate the file properties.
protected static java.lang.String[] vector2StrArray(java.util.Vector list)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, 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

PWD_VERIFIERTYPE_COMMON

public static int PWD_VERIFIERTYPE_COMMON
The Common Password Verifier

IDTYPE_DN

public static int IDTYPE_DN
The id type used is a DN

IDTYPE_SIMPLE

public static int IDTYPE_SIMPLE
The id type used is a simple id

IDTYPE_GUID

public static int IDTYPE_GUID
The id type used is a GUID

IDTYPE_DEFAULT

public static int IDTYPE_DEFAULT
Use default value

IDTYPE_FILTER

public static int IDTYPE_FILTER
The id type used is a filter

IDTYPE_WINDOWS

public static int IDTYPE_WINDOWS
The id type used is a Windows user id

IDTYPE_KERB_PRINCIPAL

public static int IDTYPE_KERB_PRINCIPAL
The id type used is a Kerberos Principal

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

DASURL_EUS_CONSOLE

public static java.lang.String DASURL_EUS_CONSOLE
DAS URL type - EUS Console

DASURL_DELEGATION_CONSOLE

public static java.lang.String DASURL_DELEGATION_CONSOLE
DAS URL type - Delegation Console

DASURL_EDIT_MY_PROFILE

public static java.lang.String DASURL_EDIT_MY_PROFILE
DAS URL type - Edit My Profile

DASURL_RESET_PASSWORD

public static java.lang.String DASURL_RESET_PASSWORD
DAS URL type - Reset Password

DASURL_VIEW_USER_PROFILE

public static java.lang.String DASURL_VIEW_USER_PROFILE
DAS URL type - View User Profile

DASURL_TIMEZONE

public static java.lang.String DASURL_TIMEZONE
DAS URL type - Time Zone

FILE_EXISTENCE

public static final int FILE_EXISTENCE
Constant to indicate the check for existence of a file.
See Also:
Constant Field Values

FILE_NOT_EXISTENCE

public static final int FILE_NOT_EXISTENCE
Constant to indicate the check for not existence of a file.
See Also:
Constant Field Values

FILE_READABLE

public static final int FILE_READABLE
Constant to indicate the check for readablity of a file.
See Also:
Constant Field Values

FILE_WRITABLE

public static final int FILE_WRITABLE
Constant to indicate the check for writability of a file.
See Also:
Constant Field Values

FILE_NOT_EMPTY

public static final int FILE_NOT_EMPTY
Constant to indicate the check for non-emptiness of a file.
See Also:
Constant Field Values

FILE_CREATEABLE

public static final int FILE_CREATEABLE
Constant to indicate the check for the ability to create the file.
See Also:
Constant Field Values

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
Throws:
javax.naming.NamingException

getEntryDetails

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

getEntryDetails

public static java.lang.Object getEntryDetails(javax.naming.directory.DirContext ctx,
                                               java.lang.String base,
                                               java.lang.String filter,
                                               javax.naming.directory.SearchControls ctls)
                                        throws javax.naming.NamingException
getEntryDetails
Returns:
result of type NamingEnumeration
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
setEntryDetails
Parameters:
ctx - - a valid directory context base - base DN mods - valid list of ModificationItem
Throws:
UtilException

setEntryDetails

public static void setEntryDetails(javax.naming.directory.DirContext ctx,
                                   java.lang.String base,
                                   ModPropertySet ps)
                            throws UtilException
setEntryDetails
Parameters:
ctx - - a valid directory context base - base DN ps - a valid ModPropertySet
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,
                                               java.util.logging.Logger lgr)
                                        throws UtilException
Deprecated. Use Subscriber.getDN(ctx)
Returns the DN of the given subscriber.
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

getSubscriberDn

public static java.lang.String getSubscriberDn(javax.naming.directory.DirContext ctx,
                                               java.lang.String subId,
                                               int subIdType)
                                        throws UtilException
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
Returns a PropertySetCollection of DNs where the user is an owner. If nested is set to true, the method will look for nested ownership as well.
Parameters:
ctx - DirContext
curUser - a valid User object
attrList - a set of attributes to be fetched
nested - true if nested ownership is desired
Throws:
UtilException

getOwnership

public static PropertySetCollection getOwnership(javax.naming.directory.DirContext ctx,
                                                 java.lang.String dn,
                                                 java.lang.String[] attrList,
                                                 boolean nested)
                                          throws UtilException
Returns a PropertySetCollection of DNs where the input DN is an owner. If nested is set to true, the method will look for nested ownership as well.
Parameters:
ctx - DirContext
dn - the DN to be looked up
attrList - a set of attributes to be fetched
nested - true if nested ownership is desired
Throws:
UtilException

getOwnership

protected static PropertySetCollection getOwnership(javax.naming.directory.DirContext ctx,
                                                    java.lang.String base,
                                                    java.lang.String dn,
                                                    java.lang.String[] attrList,
                                                    boolean nested)
                                             throws UtilException
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 The groups are returned in a PropertySetCollection.
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

getGroupMembership

public static PropertySetCollection getGroupMembership(javax.naming.directory.DirContext ctx,
                                                       java.lang.String dn,
                                                       java.lang.String[] attrList,
                                                       boolean nested,
                                                       java.lang.String memberAttribute)
                                                throws UtilException
Returns a PropertySetCollection of groups that the dn belongs to directly or indirectly. The groups are returned in a PropertySetCollection. The memberAttribute allows the choice of the uniqemember attribute or the member attribute to be used during the lookup.
Parameters:
ctx - a valid DirContext
dn - a valid DN
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
memberAttribute - use "uniquemember" or "member".
Returns:
a PropertySetCollection
Throws:
UtilException

getGroupMembership

public static PropertySetCollection getGroupMembership(javax.naming.directory.DirContext ctx,
                                                       java.lang.String dn,
                                                       java.lang.String[] attrList,
                                                       boolean nested)
                                                throws UtilException
Throws:
UtilException

grpErrHandler

protected static void grpErrHandler(javax.naming.NamingException ne,
                                    UtilException ue)
                             throws UtilException
Throws:
UtilException

vector2StrArray

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

normalizeDN

public static java.lang.String normalizeDN(java.lang.String inDN,
                                           java.lang.String[] attrList)
Normalizes the DN and ensures that it only contains the attributes from the attrList. This logic is used by OUI to validate the realm DN. Should not be exposed as a public API in the javadoc

normalizeDN

public static java.lang.String normalizeDN(java.lang.String inDN)
Normalizes the DN.
Parameters:
inDN - the DN to be normalized
Returns:
the normalized DN

createDN

public static java.lang.String createDN(javax.naming.directory.DirContext ctx,
                                        java.lang.String inDN)
                                 throws UtilException
Throws:
UtilException

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
Throws:
UtilException

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
Throws:
UtilException

printResults

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

getDefaultSubscriber

public static java.lang.String[] getDefaultSubscriber(java.util.logging.Logger lgr)

getDefaultSubscriber

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

getDomain

public static java.lang.String getDomain(java.util.logging.Logger lgr)

getDomain

public static java.lang.String getDomain()

subAndLoadLdif

public static void subAndLoadLdif(javax.naming.directory.DirContext ctx,
                                  java.lang.String filename,
                                  java.util.Vector subVector,
                                  java.util.logging.Logger lgr)
                           throws UtilException
Throws:
UtilException

subAndLoadLdif

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

getFQHN

public static java.lang.String getFQHN()
Returns the Fully Qualified Host Name of the local machine. By default, an Oracle Installation forces the proper setup on the local machine which should lead to a non-null value to be returned. If the operation fails for any reason, null is returned

getIAC_DNFromFQHN

public static java.lang.String getIAC_DNFromFQHN()
                                          throws UtilException
Returns a DN based on the fully qualified host name. This is used as the default value when creating the Identity Administration Context. For example, if fully qualified host name is "myhost.acme.com", "dc=acme, dc=com" will be returned. If the fully qualified host name has only the host name and no domain component, a UtilException will be thrown.
Throws:
UtilException

getParentDN

public static java.lang.String getParentDN(java.lang.String dn)
Returns the parent DN of the given DN For example, if dn is "dc=acme,dc=com", getParentDN returns "dc=com".
Parameters:
dn - a valid DN

getRDN

public static java.lang.String getRDN(java.lang.String dn)
Returns the RDN portion of the DN.
 For example, if dn is "dc=acme,dc=com", this returns "dc=acme".
 


Parameters:
dn - a valid DN


dnExists

public static boolean dnExists(javax.naming.directory.DirContext ctx,
                               java.lang.String dn)
                        throws UtilException
Returns true if the given DN exists
Parameters:
ctx - a valid DirContext
dn - the DN to be validated
Returns:
true if the DN exists
Throws:
UtilException

dnExists

public static PropertySetCollection dnExists(javax.naming.directory.DirContext ctx,
                                             java.lang.String dn,
                                             java.lang.String[] attrs)
                                      throws UtilException
Returns a non-null PropertySetCollection if DN exists. The PropertySetCollection contains the attribute values requested.
Parameters:
ctx - a valid DirContext
dn - the DN to be validated
attrs - an array of attributes to be returned
Throws:
UtilException

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

performLDAPOperation

public static void performLDAPOperation(javax.naming.directory.DirContext dirCtx,
                                        LDIFRecord ldifRecord)
                                 throws javax.naming.NamingException
Use this method to perform an LDAP operation.
Parameters:
oidCtx - the Directory context
ldifRecord - an LDIFRecord that needs to be added/changed/deleted to/from the dirctory.
Throws:
javax.naming.NamingException - If a naming exception is encountered

getEntryFromDirectory

public static LDIFRecord getEntryFromDirectory(javax.naming.directory.DirContext dirCtx,
                                               java.lang.String dn)
                                        throws javax.naming.NamingException
Use this method to retrieve the a particular entry from the directory.
Parameters:
dirCtx - directory context
dn - DN of the entry.
Throws:
javax.naming.NamingException - If a naming exception is encountered

getLDIFRecord

public static LDIFRecord getLDIFRecord(java.lang.String dn,
                                       javax.naming.directory.Attributes pAttrs)
                                throws javax.naming.NamingException
Use this method to convert a set of attributes and a DN into an LDIFRecord
Parameters:
dn - DN of the entry.
pAttrs - Attributes associated with the DN
Throws:
javax.naming.NamingException - If a naming exception is encountered

validateFile

public static void validateFile(java.lang.String fileName,
                                int checkFor)
                         throws InvalidParameterException
Use this method to validate the file properties. The following are the properties which could be checked for. Util.FILE_EXISTENCE - Checks Whether file exists Util.FILE_NOT_EXISTENCE - To make sure that file does not exist Util.FILE_READABLE - To make sure that file is readable Util.FILE_WRITABLE - To make sure that file is writable Util.FILE_NOT_EMPTY - To make sure that file is not zero byte file Util.FILE_CREATEABLE - To make sure whether the file could be created or not. All these options could be used together by '|' ing them. However Util.FILE_EXISTENCE and Util.FILE_NOT_EXISTENCE could be used together.
 
 for e.x

    // Make sure that input file is exists and it is readable
    // and also it is not empty 
    try {
       Util.validateFile(inFileObj, Util.FILE_EXISTENCE |
                      Util.FILE_READABLE | Util.FILE_NOT_EMPTY);
    }
    catch(InvalidParameterException ipe)
    {
       throw new MigrationException(ipe.getMessage());
    }
 
Parameters:
fileName - Name of the file
checkFor - Can contain any one of Util.FILE_EXISTENCE Util.FILE_NOT_EXISTENCE, Util.FILE_READABLE, Util.FILE_WRITABLE, Util.FILE_DATA, Util.FILE_CREATEABLE or a combination of them
Throws:
InvalidParameterException - When any of the above conditions are not met.

validateFile

public static void validateFile(java.io.File fileObj,
                                int checkFor)
                         throws InvalidParameterException
Throws:
InvalidParameterException

addUniquemember

public static void addUniquemember(javax.naming.directory.DirContext ctx,
                                   java.lang.String base,
                                   java.lang.String memberDn)
                            throws UtilException
Throws:
UtilException

removeUniquemember

public static void removeUniquemember(javax.naming.directory.DirContext ctx,
                                      Group[] groupArr,
                                      java.lang.String memberDn)
                               throws UtilException
Throws:
UtilException

removeUniquemember

public static void removeUniquemember(javax.naming.directory.DirContext ctx,
                                      Group group,
                                      java.lang.String memberDn)
                               throws UtilException
Throws:
UtilException

removeUniquemember

public static void removeUniquemember(javax.naming.directory.DirContext ctx,
                                      java.lang.String[] groupDNArr,
                                      java.lang.String memberDn)
                               throws UtilException
Throws:
UtilException

removeUniquemember

public static void removeUniquemember(javax.naming.directory.DirContext ctx,
                                      java.lang.String groupDN,
                                      java.lang.String memberDn)
                               throws UtilException
Throws:
UtilException

bulkDelete

public static void bulkDelete(javax.naming.directory.DirContext ctx,
                              java.lang.String base,
                              boolean deleteBaseDN)
                       throws javax.naming.NamingException
Deletes the entire sub-tree from the base DN. If deleteBaseDN is set to true, then the base DN itself is deleted also.
Parameters:
ctx - a valid DirContext
base - the base DN whose subtree is to be deleted
Throws:
javax.naming.NamingException - when it is encountered

getAttrOfRDN

public static java.lang.String getAttrOfRDN(java.lang.String rdn)
Returns the attribute part of the RDN For example, if rdn is "dc=acme", "dc" will be returned
Parameters:
rdn - a valid RDN

getAttrValueOfRDN

public static java.lang.String getAttrValueOfRDN(java.lang.String rdn)
Returns the value part of the RDN For example, if rdn is "dc=acme", "acme" will be retuned
Parameters:
rdn - a valid RDN

getParameterFromFile

public static java.lang.String getParameterFromFile(java.lang.String parameter,
                                                    java.lang.String fileName)
                                             throws java.io.IOException
Returns the value of the parameter from file. The file is expected to be in the following format <parameter1>=<value1> <parameter2>=<value1> If the value does not exist for the parameter or if the parameter does not exist at all, null is returned
Parameters:
parameter - the parameter to be looked up
fileName - the name of the parameter file
Throws:
java.io.IOException

getObjectClass

public static LDAPObjectClass getObjectClass(javax.naming.directory.DirContext ctx,
                                             java.lang.String inID)
                                      throws UtilException
Returns a LDAPObjectClass object representing the objectclass identified by inID. If inID contains ".", it is assumed to be an object ID. Otherwise, it is assumed to be the NAME.
Parameters:
inID - the OID or the NAME of the objectclass
Throws:
UtilException

ldapSearch

public static PropertySetCollection ldapSearch(javax.naming.directory.DirContext ctx,
                                               java.lang.String base,
                                               java.lang.String filter,
                                               int scope,
                                               java.lang.String[] attrList)
                                        throws UtilException
Performs an ldapsearch with the specified information.
Parameters:
ctx - a valid DirContext
base - a valid DN as the search base
filter - a valid LDAP search filter
scope - one of SearchControls.SUBTREE_SCOPE, SearchControls.OBJECT_SCOPE or SearchControls.ONELEVEL_SCOPE
attrList - a String array specifying the attributes to be returned
Throws:
UtilException

ldapAdd

public static void ldapAdd(javax.naming.directory.DirContext ctx,
                           java.lang.String base,
                           ModPropertySet ps)
                    throws UtilException
Performs ldapadd and creates a new entry specified by the base DN. The ModPropertySet must contain the needed objectclasses i as well as the attributes and values
Parameters:
ctx - a valid DirContext
base - the DN of the entry to be added
ModPropertySet - containing all the attributes and their values including the necessary objectclasses
Throws:
UtilException

ldapModify

public static void ldapModify(javax.naming.directory.DirContext ctx,
                              java.lang.String base,
                              ModPropertySet ps)
                       throws UtilException
Performs ldapmodify on the base DN using the ModPropertySet specified.
Parameters:
ctx - a valid DirContext
base - the DN of the entry to be modified
ModPropertySet - containing the modifications of the attributes
Throws:
UtilException

ldapModify

public static void ldapModify(javax.naming.directory.DirContext ctx,
                              java.util.logging.Logger lgr,
                              java.lang.String fileName,
                              java.util.Vector subVector,
                              boolean ignoreError)
                       throws UtilException
Performs ldapmodify using the specified LDIF file. The LDIF file can be in a template using variables in the form of %variable_name%. A substitution vector needs to be supplied to supply the run-time values for these variables

Here is an example. The LDIF template has the following entry:

 ----------------------------
 dn: dc=%s_myCompany%,dc=com
 changetype: replace
 replace: displayName
 displayName = %s_myDisplayName%
 ----------------------------

 The string "%s_mycompany%" and "s_myDisplayName" will be
 substituted at run-time by using the substitution
 vector.  The vector is in the form,

 Vector v = new Vector();
 v[0] = new String("variable_name1");
 v[1] = new String("variable1 value");
 v[2] = new String("variable_name2");
 v[3] = new String("variable2 value");
          .
          .
 To substitute "s_mycompany" with "acme" and "s_myDisplayName" with
 "My Acme", the vector should be defined as follows:

 Vector v = new Vector(4);
 v[0] = new String("s_mycompany");
 v[1] = new String("acme");
 v[2] = new String("s_myDisplayName");
 v[3] = new String("My Acme");
If a substitution variable-value pair is defined in the vector but does not exist in the LDIF template, it will go through. If a variable exists in the LDIF but the vector does not provide the substitution value for it, a UtilException is thrown.
Parameters:
ctx - a valid DirContext
fileName - the absolute path name of the LDIF file.
subVector - the substitution vector of Strings
ignoreError - set to true to ignore errors and proceed with the rest of the LDIF file.
Throws:
UtilException

ldapModify

public static void ldapModify(javax.naming.directory.DirContext ctx,
                              java.lang.String fileName,
                              java.util.Vector subVector,
                              boolean ignoreError)
                       throws UtilException
Throws:
UtilException

ldapModify

public static void ldapModify(javax.naming.directory.DirContext ctx,
                              java.util.logging.Logger lgr,
                              java.lang.String fileName,
                              java.util.Vector subVector,
                              boolean ignoreError,
                              java.io.PrintStream pStream)
                       throws UtilException
Performs ldapmodify using the specified LDIF file. The functionality is the same as the other Util.ldapModify. This method allows the redirection of the output to a particular PrintStream - useful for logging.
Parameters:
ctx - a valid DirContext
fileName - the absolute path name of the LDIF file.
subVector - the substitution vector of Strings
ignoreError - set to true to ignore errors and proceed with the rest of the LDIF file.
pStream - a PrintStream where the output is redirected
Throws:
UtilException

ldapModify

public static void ldapModify(javax.naming.directory.DirContext ctx,
                              java.lang.String fileName,
                              java.util.Vector subVector,
                              boolean ignoreError,
                              java.io.PrintStream pStream)
                       throws UtilException
Throws:
UtilException

ldapDelete

public static void ldapDelete(javax.naming.directory.DirContext ctx,
                              java.lang.String base)
                       throws UtilException
Performs ldapdelete of the base DN.
Parameters:
ctx - a valid DirContext
base - the DN of the entry to be deleted
Throws:
UtilException

ldapCompare

public static boolean ldapCompare(javax.naming.directory.DirContext ctx,
                                  java.lang.String baseDN,
                                  java.lang.String attr,
                                  java.lang.Object attrval)
                           throws UtilException
Performs ldapcompare on the specified baseDN comparing the attribute and its value as specified
Parameters:
ctx - a valid DirContext
base - the DN of the entry to be compared
attr - the attribute name
attrval - the attribute value
Throws:
UtilException

multiSearchBaseSearch

public static PropertySetCollection multiSearchBaseSearch(javax.naming.directory.DirContext ctx,
                                                          java.lang.String specifiedSearchBase,
                                                          java.lang.String[] allSearchBases,
                                                          java.lang.String filter,
                                                          java.lang.String[] attrList,
                                                          boolean returnONE)
                                                   throws UtilException
Throws:
UtilException

getSSODBInfo

public static java.lang.String[] getSSODBInfo(javax.naming.directory.DirContext ctx)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

makeFilter

public static java.lang.String makeFilter(java.lang.String attr,
                                          java.lang.String value)
makeFilter

handleSpecialChars

public static java.lang.String handleSpecialChars(java.lang.String originalString)
handleSpecialChars for the string value after '=' of a filter If the string value should contain one of the characters of this set { '*', ')', '(', '\', NULL}, this operation adds an escape '\' character (ASCII 0x5c) followed by the two hexadecimal digits representing the ASCII value of the encoded character.
See Also:
RFC-2254

handleSpecialFilterChars

public static java.lang.String handleSpecialFilterChars(java.lang.String originalString)

resolveDuplicateDN

public static java.lang.String resolveDuplicateDN(javax.naming.directory.DirContext ctx,
                                                  java.lang.String dnString)
                                           throws UtilException
Returns a unique DN whose value is guaranteed to be unique in the specified LDAP server. If the input DN already exists, the method with modify the RDN portion by appending "_#" as a suffix where # starts from 1. For example, if "cn=jdoe,dc=com" exists, it will then look for "cn=jdoe_1,dc=com", "cn=jdoe_2,dc=com", and so forth until a non-existing DN is found. * The value is returned. If the input DN itself, it will be returned as is.
Parameters:
ctx - a valid DirContext connected to an LDAP server
dnString - a String representing the DN
Returns:
a unique DN whose value is guaranteed to be unique in the specified LDAP server.
Throws:
UtilException

Skip navigation links

Oracle Internet Directory API Reference
11g Release 1 (11.1.1)

E10664-01


Copyright © 1999, 2009 Oracle. All Rights Reserved.