Modifying the UserMappingRepositoryLDAP sample file (Java programming language)

The file for the Java™ plug-in contains the functions for connecting to the LDAP server, retrieving user mappings, and disconnecting. Modify the sample code to match the object classes that are defined in the directory structure of your LDAP server.

About this task

To retrieve the user mappings from the LDAP server, the plug-in must search the directory for the user entries that have the attributes that define the user mapping. The following information is stored as attributes of a user:
  • Remote server name
  • Instance name
  • Database name
  • Remote user name
  • Remote user password

The sample code assumes that the user entry is identified by the inetOrgPerson object class and that the user mapping entry is identified by the IIUserMapping object class. The Lightweight Directory Interchange Format (LDIF) sample files, schema.ldif and entry.ldif, load the sample schema and sample entries into the LDAP server.

The code in the file assumes that the schema.ldif file contains the LDIF code for objects and attributes that have the following names:
  • IIUserMapping object
    • IIRemoteServerName attribute
    • IIInstanceName attribute
    • IIDatabaseName attribute
    • IIRemotePassword attribute
    • uid attribute
You modify the file to match the schema that the LDAP server uses. The file searches for and retrieves the user mapping entries from the LDAP server. The LDIF files are provided as a sample schema and as a sample method of storing user mapping entries.

To modify the schema that the file uses:


  1. Locate the code: private String UserObjectClassName = "inetOrgPerson" and replace the inetOrgPerson value with the name of the object class that your LDAP server uses for user entries.
  2. Optional: Change the attribute names that the plug-in uses. Replace the values for the IIRemoteServerAttrName, IIInstanceAttrName, IIDatabaseAttrName, and IIRemotePasswordAttrName variables with the attribute names that you choose.
  3. Optional: If you use the LDIF files, ensure that the schema in the LDIF files matches the structure that the file searches.