1: …… 2: public void f() { 3: Hashtable env = new Hashtable(); 4: env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); 5: env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=rootDir"); 6: try { 7: javax.naming.directory.DirContext ctx = new InitialDirContext(env); 8: Properties props = new Properties(); 9: String fileName = "ldap.properties"; 10: FileInputStream in = new FileInputStream(fileName); 11: 12: if (in == null || in.available() <= 0) return; 13: props.load(in); 14: 15: if (props == null || props.isEmpty()) return; 16: String name = props.getProperty("name"); 17: if (name == null || "".equals(name)) return; 18: // 읽어들인 name에 대해서 ‘*’ 문자열을 제거한다. 19: String filter = "(name =" + name.replaceAll("\\*", " " ) + ")"; 20: NamingEnumeration answer = 21: ctx.search("ou=NewHires", filter, new SearchControls()); 22: printSearchEnumeration(answer); 23: ctx.close(); 24: } catch (NamingException e) { …… } 25: ……