封裝jndi操作ldap服務(wù)器的工具類
LDAP操作封裝類
目標(biāo):使用者只需要會(huì)使用List,Map 數(shù)據(jù)結(jié)構(gòu),將對(duì)LDAP的操作進(jìn)行封裝
類:主要有三個(gè)類
1 Env類 包含LDAP的連接信息
2 LdapConnectionFactory類 ldap連接工廠,提供初始化及獲取ldap連接的方法
3 LdapOperUtils ldap的處理工具類,提供了各種操作ldap的方法。
連接LDAP的連接屬性類
package com.common.ldapconnection;
import org.apache.log4j.Logger;
/**
* <p>功能描述:連接LDAP的連接屬性</p>
* @author liaowufeng
* @version 1.0
*/
public class Env {
// 調(diào)用log4j的日志,用于輸出
private Logger log = Logger.getLogger(Env.class.getName());
// 無論用什么LDAP服務(wù)器的固定寫法,指定了JNDI服務(wù)提供者中工廠類
public String factory ;
// 服務(wù)連接地址
public String url ;
// 登陸LDAP的用戶名和密碼
public String adminUID ;
// 登陸LDAP用戶密碼
public String adminPWD ;
// 安全訪問需要的證書庫(kù)
public String sslTrustStore;
// 安全通道訪問
public String securityProtocol ;
// 連接TimeOut
public String timeOut;
/**
* 構(gòu)造函數(shù)
*/
public Env() {
}
/**
* 構(gòu)造函數(shù)
* @param factory LDAP工廠類
* @param url LDAP URL
* @param adminUID LDAP 用戶
* @param adminPWD LDAP 密碼
*/
public Env(String factory, String url, String adminUID, String adminPWD) {
this.factory = factory;
this.url = url;
this.adminUID = adminUID;
this.adminPWD = adminPWD;
}
/**
* 構(gòu)造函數(shù)
* @param factory LDAP 工廠類名
* @param url LDAP URL
* @param adminUID LDAP 用戶
* @param adminPWD LDAP 密碼
* @param sslTrustStore 安全訪問需要的證書
* @param securityProtocol 安全通道訪問
*/
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;
}
/**
* 構(gòu)造函數(shù)
* @param factory LDAP 工廠類名
* @param url LDAP URL
* @param adminUID LDAP 用戶
* @param adminPWD LDAP 密碼
* @param sslTrustStore 安全訪問需要的證書
* @param securityProtocol 安全通道訪問
*/
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;
}
}
相關(guān)文章
Java通過在主循環(huán)中判斷Boolean來停止線程的方法示例
這篇文章主要介紹了Java通過在主循環(huán)中判斷Boolean來停止線程的方法,結(jié)合具體實(shí)例形式分析了java針對(duì)線程的判斷與停止操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2017-04-04java實(shí)現(xiàn)文件讀寫與壓縮實(shí)例
這篇文章主要介紹了java實(shí)現(xiàn)文件讀寫與壓縮實(shí)例,有助于讀者加深對(duì)文件操作的理解,需要的朋友可以參考下2014-07-07quartz的簡(jiǎn)單使用、SpringBoot使用和自定義數(shù)據(jù)源集成方式
這篇文章主要介紹了quartz的簡(jiǎn)單使用、SpringBoot使用和自定義數(shù)據(jù)源集成方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教<BR>2024-01-01