LDAP operation encapsulation class
Author: Liao Wufeng
MSN: liaowufeng1111@hotmail.com
QQ: 38773367
Email: moaihe1111@163.com
I am the author's original. If you resend the post, please keep the author's signature. Thank you!
LDAP operation encapsulation class
Target: users only need to use the list and map data structures to encapsulate LDAP operations.
Class: There are three main types
1 env class contains LDAP connection information
2 ldapconnectionfactory LDAP connection factory, provides methods for initializing and obtaining LDAP connections
3 ldapoperutils the LDAP processing tool class provides various LDAP operations.
Connection attribute class for connecting to LDAP
Java code
Package COM. common. ldapconnection; import Org. apache. log4j. logger;/*** <p> function description: connect to the LDAP connection attribute </P> * @ author liaowufeng * @ version 1.0 */public class env {// call the log4j log to output private logger log = logger. getlogger (Env. class. getname (); // no matter which LDAP server is used, the factory class public string factory in the JNDI service provider is specified; // The Public String URL of the service connection address; // log on to the LDAP user name and password Public String adminuid; // log on to the LDAP User Password Public String adminpwd; // securely access the required certificate library Public String ssltruststore; // Security Channel Access Public String securityprotocol; // connection 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 required for secure access certificate * @ 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 required for secure access certificate * @ 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 ;}}