封裝jndi操作ldap服務(wù)器的工具類
LDAP操作封裝類
目標(biāo):使用者只需要會使用List,Map 數(shù)據(jù)結(jié)構(gòu),將對LDAP的操作進行封裝
類:主要有三個類
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 ;
// 安全訪問需要的證書庫
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é)合具體實例形式分析了java針對線程的判斷與停止操作相關(guān)實現(xiàn)技巧,需要的朋友可以參考下2017-04-04quartz的簡單使用、SpringBoot使用和自定義數(shù)據(jù)源集成方式
這篇文章主要介紹了quartz的簡單使用、SpringBoot使用和自定義數(shù)據(jù)源集成方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教<BR>2024-01-01