LDAP Operation Encapsulation Class
Objective: The user only needs to use the LIST,MAP data structure to encapsulate the operation of the LDAP
Class: There are three main classes
1 env class contains connection information for LDAP
2 Ldapconnectionfactory class LDAP connection factory, providing methods for initializing and obtaining LDAP connections
The 3 ldapoperutils LDAP Processing tool class provides a variety of ways to manipulate LDAP.
Connection attribute classes that connect to LDAP
Copy Code code as follows:
Package com.common.ldapconnection;
Import Org.apache.log4j.Logger;
/**
* <p> Function Description: Connect LDAP connection Properties </p>
* @author Liaowufeng
* @version 1.0
*/
public class Env {
Call the log4j log for output
Private Logger log = Logger.getlogger (Env.class.getName ());
Specifies the factory class in the Jndi service provider, regardless of the fixed wording of the LDAP server
Public String Factory;
Service Connection Address
public String URL;
Login LDAP username and password
Public String Adminuid;
Login LDAP User Password
Public String adminpwd;
Secure access to the required certificate library
Public String Ssltruststore;
Secure channel access
Public String SecurityProtocol;
Connect Timeout
Public String TimeOut;
/**
* Constructor
*/
Public Env () {
}
/**
* Constructor
* @param factory LDAP factory class
* @param url LDAP URL
* @param adminuid LDAP User
* @param adminpwd LDAP Password
*/
Public Env (String factory, String URL, String adminuid, String adminpwd) {
This.factory = Factory;
This.url = URL;
This.adminuid = Adminuid;
This.adminpwd = adminpwd;
}
/**
* Constructor
* @param factory LDAP factory class name
* @param url LDAP URL
* @param adminuid LDAP User
* @param adminpwd LDAP Password
* @param ssltruststore security access required certificates
* @param securityprotocol Secure channel access
*/
Public Env (String factory, String URL, String adminuid, String adminpwd,
String Ssltruststore,
String SecurityProtocol) {
This.factory = Factory;
This.url = URL;
This.adminuid = Adminuid;
This.adminpwd = adminpwd;
This.ssltruststore = Ssltruststore;
This.securityprotocol = SecurityProtocol;
}
/**
* Constructor
* @param factory LDAP factory class name
* @param url LDAP URL
* @param adminuid LDAP User
* @param adminpwd LDAP Password
* @param ssltruststore security access required certificates
* @param securityprotocol Secure channel access
*/
Public Env (String factory, String URL, String adminuid, String adminpwd,
String TimeOut,
String Ssltruststore,
String SecurityProtocol) {
This.factory = Factory;
This.url = URL;
This.adminuid = Adminuid;
This.adminpwd = adminpwd;
This.timeout = TimeOut;
This.ssltruststore = Ssltruststore;
This.securityprotocol = SecurityProtocol;
}
}