protected LDAPAttributeSet getAttributeSet(String objectclass, String dn, boolean extra, boolean person) {
protected LDAPAttributeSet getAttributeSet(Certificate cert, String objectclass, String dn, boolean extra, boolean person, String password, ExtendedInformation extendedinformation) {
    protected LDAPAttributeSet getAttributeSet(String objectclass, String dn, boolean extra, boolean person) {    	log.debug(">getAttributeSet()");        LDAPAttributeSet attributeSet = new LDAPAttributeSet();        LDAPAttribute attr = new LDAPAttribute("objectclass");        // The full LDAP object tree is divided with ; in the objectclass        StringTokenizer token = new StringTokenizer(objectclass,";");        while (token.hasMoreTokens()) {            String value = token.nextToken();            log.debug("Adding objectclass value: "+value);            attr.addValue(value);        }        attributeSet.add(attr);        /* To Add an entry to the directory,         *   -- Create the attributes of the entry and add them to an attribute set         *   -- Specify the DN of the entry to be created         *   -- Create an LDAPEntry object with the DN and the attribute set         *   -- Call the LDAPConnection add method to add it to the directory         */        if (extra) {        	String cn = CertTools.getPartFromDN(dn, "CN");        	if (cn != null) {        		attributeSet.add(new LDAPAttribute("cn", cn));        	}        	String l = CertTools.getPartFromDN(dn, "L");        	if (l != null) {        		attributeSet.add(new LDAPAttribute("l", l));        	}        	String ou = CertTools.getPartFromDN(dn, "OU");        	if (ou != null) {        		attributeSet.add(new LDAPAttribute("ou", ou));        	}        	// Only persons have (normally) all these extra attributes.         	// A CA might have them if you don't use the default objectClass, but we don't        	// handle that case.        	if (person) {        		// sn means surname in LDAP, and is required for persons        		String sn = CertTools.getPartFromDN(dn, "SURNAME");        		if ( (sn == null) && (cn != null) ) {        			// Take surname to be the last part of the cn        			int index = cn.lastIndexOf(' ');        			if (index <=0) {        				// If there is no natural sn, use cn since sn is required        				sn = cn;        			} else {        				if (index < cn.length()) sn = cn.substring(index+1);        			}        		}        		if (sn != null) {        			attributeSet.add(new LDAPAttribute("sn", sn));        		}        		// gn means givenname in LDAP, and is required for persons        		String gn = CertTools.getPartFromDN(dn, "GIVENNAME");        		if ( (gn == null) && (cn != null) ) {        			// Take givenname to be the first part of the cn        			int index = cn.indexOf(' ');        			if (index <=0) {        				// If there is no natural gn/sn, ignore gn if we are using sn        				if (sn == null) gn = cn;        			} else {        				gn = cn.substring(0, index);        			}        		}        		if (gn != null) {        			attributeSet.add(new LDAPAttribute("givenName", gn));        		}        		String st = CertTools.getPartFromDN(dn, "ST");        		if (st != null) {        			attributeSet.add(new LDAPAttribute("st", st));        		}        		String o = CertTools.getPartFromDN(dn, "O");        		if (o != null) {        			attributeSet.add(new LDAPAttribute("o", o));        		}        		String uid = CertTools.getPartFromDN(dn, "uid");        		if (uid != null) {        			attributeSet.add(new LDAPAttribute("uid", uid));        		}                		String initials = CertTools.getPartFromDN(dn, "initials");        		if (initials != null) {        			attributeSet.add(new LDAPAttribute("initials", initials));        		}                		String title = CertTools.getPartFromDN(dn, "T");        		if (title != null) {        			attributeSet.add(new LDAPAttribute("title", title));        		}        	}        }    	log.debug("<getAttributeSet()");        return attributeSet;    } // getAttributeSet