Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Objects in IPlanet LDAP??????????? 1

Status
Not open for further replies.

nalanit

Programmer
Nov 29, 2002
6
BR

Hello,

If anyone have a source code that create an object(ex:User),please send to me.

I'm a code but it is does not work with the Iplanet LDAP.

TIA.

nalanit.
 
import netscape.ldap.*;
import java.util.*;

public class CreateObjectClasses {

//public void create() {
public static void main(String[] args) {

ResourceBundle messages = ResourceBundle.getBundle("MessageBundle");
LDAPConnection ld = new LDAPConnection();

try {
String hostname = messages.getString("HOST_NAME");
int portnumber = Integer.parseInt(messages.getString("PORT_NUMBER"));
String bindDN = messages.getString("BIND_DN");
String bindPW = messages.getString("BIND_PASSWORD");

/* Construct a new LDAPSchema object to hold the schema that you want to
retrieve. */
ld.connect(hostname, portnumber, bindDN, bindPW);

/* Add a new object class. */
/* Note you need Directory Server 4 or later for this part because of bug in
version 3 with adding an object class that is a subclass of an existing class. */

String[] requiredAttrs = new String[1];
String[] optionalAttrs = new String[9];

requiredAttrs[0] = "";

LDAPObjectClassSchema userObjectClass = new LDAPObjectClassSchema("userobj",
"userObj-oid", "top", "User Details", requiredAttrs,
optionalAttrs);

/* Add the new object class to the schema. */
userObjectClass.add(ld);
ld.disconnect();
} catch (Exception e) {
System.err.println(e.toString());
System.exit(1);
}
System.exit(0);
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top