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);
}
}