Encapsulates the tool class _java for JNDI operations LDAP servers

Source: Internet
Author: User
Tags ldap map data structure log4j

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;
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.