Java Reference
In-Depth Information
HashMap modifications = new HashMap();
modifications.put(“mail”, “”);
lm.modify(“uid=proy,ou=People,”, modifications,
catch (NamingException e) {
In this example we are replacing the existing value for the e-mail address with the new value of
“” . This change is made to the object specified by the DN “uid=proy,
ou=People,” . It is important to note that more than one attribute can be modi-
fied at the same time, however the attributes will all be bound by the same modification opera-
The full listing for the manager class we have been developing appears in Listing 11.2.
import java.util.Map;
import java.util.Vector;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
public class LDAPManager {
protected String factory = “com.sun.jndi.ldap.LdapCtxFactory”;
protected String serverName = “serverName”;
protected int port = 389;
protected String securityAuthentication = “simple”;
protected String dirManager = “cn=Directory Manager”;
protected String dirManagerPw = “directory”;
protected String searchBase = null;
protected int searchScope = SearchControls.SUBTREE_SCOPE;
public LDAPManager() {
Search WWH ::

Custom Search