public class LdapClient
extends java.lang.Object
Constructor and Description |
---|
LdapClient()
Constructor for the LdapClient object.
|
Modifier and Type | Method and Description |
---|---|
void |
connect(java.lang.String host,
java.lang.String port,
java.lang.String rootdn,
java.lang.String username,
java.lang.String password)
Connect to server.
|
void |
createTest(javax.naming.directory.BasicAttributes basicattributes,
java.lang.String string)
Create the attribute in the ldap directory for the given string.
|
void |
deleteTest(java.lang.String string)
Delete the attribute from the ldap directory.
|
void |
disconnect()
Disconnect from the server.
|
void |
modifyTest(javax.naming.directory.ModificationItem[] mods,
java.lang.String string)
Modify the attribute in the ldap directory for the given string.
|
boolean |
searchTest(java.lang.String searchBase,
java.lang.String searchFilter)
Filter the data in the ldap directory for the given search base.
|
public void connect(java.lang.String host, java.lang.String port, java.lang.String rootdn, java.lang.String username, java.lang.String password) throws javax.naming.NamingException
host
- name of the ldap serverport
- port of the ldap serverrootdn
- base dn to start ldap operations fromusername
- user name to use for bindingpassword
- password to use for bindingjavax.naming.NamingException
- if InitialDirContext
can not be build using the above
parameterspublic void disconnect()
public boolean searchTest(java.lang.String searchBase, java.lang.String searchFilter) throws javax.naming.NamingException
searchBase
- where the search should startsearchFilter
- filter this value from the basetrue
when the search yields results,
false
otherwisejavax.naming.NamingException
- when searching failspublic void modifyTest(javax.naming.directory.ModificationItem[] mods, java.lang.String string) throws javax.naming.NamingException
mods
- list of all ModificationItem
s to applystring
- dn of the object to modifyjavax.naming.NamingException
- when modification failspublic void createTest(javax.naming.directory.BasicAttributes basicattributes, java.lang.String string) throws javax.naming.NamingException
basicattributes
- add all the entry in to the basicattributestring
- the string (dn) valuejavax.naming.NamingException
- when creating subcontext failspublic void deleteTest(java.lang.String string) throws javax.naming.NamingException
string
- the string (dn) valuejavax.naming.NamingException
- when destroying sub context failsCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.