public static LdifEntry getUserAddLdif( String dnstr, byte[] password, String cn, String sn )
throws LdapException
{
DN dn = new DN( dnstr );
LdifEntry ldif = new LdifEntry();
ldif.setDn( dnstr );
ldif.setChangeType( ChangeType.Add );
EntryAttribute attr = new DefaultClientAttribute( "objectClass",
"top", "person", "organizationalPerson", "inetOrgPerson" );
ldif.addAttribute( attr );
attr = new DefaultClientAttribute( "ou", "Engineering", "People" );
ldif.addAttribute( attr );
String uid = ( String ) dn.getRdn().getNormValue();
ldif.putAttribute( "uid", uid );
ldif.putAttribute( "l", "Bogusville" );
ldif.putAttribute( "cn", cn );
ldif.putAttribute( "sn", sn );
ldif.putAttribute( "mail", uid + "@apache.org" );
ldif.putAttribute( "telephoneNumber", "+1 408 555 4798" );
ldif.putAttribute( "facsimileTelephoneNumber", "+1 408 555 9751" );
ldif.putAttribute( "roomnumber", "4612" );
ldif.putAttribute( "userPassword", password );
String givenName = cn.split( " " )[0];
ldif.putAttribute( "givenName", givenName );
return ldif;
}