Class LDAPUtility
- java.lang.Object
-
- org.silverpeas.core.admin.domain.driver.ldapdriver.LDAPUtility
-
public class LDAPUtility extends Object
This class contains some useful static functions to access to LDAP elements- Author:
- tleroi
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
closeConnection(String connectionId)
static String
dblBackSlashesForDNInFilters(String theDN)
static com.novell.ldap.LDAPConnection
getConnection(String connectionId)
static List<com.novell.ldap.LDAPEntry>
getEntriesFromSearch(String lds, String baseDN, int scope, String filter, String[] attrs)
Search and returns entries that match the parameters baseDN, scope and filterstatic String
getFirstAttributeValue(com.novell.ldap.LDAPEntry theEntry, String attributeName)
Returns the first value of a specific attribute from an entry.static com.novell.ldap.LDAPEntry
getFirstEntryFromSearch(String lds, String baseDN, int scope, String filter, String[] attrs)
Search and returns the first Entry that match the parameters baseDN, scope and filterstatic String
normalizeFilterValue(String theFilter)
static String
openConnection(LDAPSettings driverSettings)
-
-
-
Method Detail
-
openConnection
public static String openConnection(LDAPSettings driverSettings) throws AdminException
- Throws:
AdminException
-
getConnection
public static com.novell.ldap.LDAPConnection getConnection(String connectionId)
-
closeConnection
public static void closeConnection(String connectionId) throws AdminException
- Throws:
AdminException
-
getFirstAttributeValue
public static String getFirstAttributeValue(com.novell.ldap.LDAPEntry theEntry, String attributeName)
Returns the first value of a specific attribute from an entry. If this attribute have multiple values, only the first is returned- Parameters:
theEntry
- the LDAP entryattributeName
- the name of the attribute to retreive- Returns:
- the first value as a string
-
getFirstEntryFromSearch
public static com.novell.ldap.LDAPEntry getFirstEntryFromSearch(String lds, String baseDN, int scope, String filter, String[] attrs) throws AdminException
Search and returns the first Entry that match the parameters baseDN, scope and filter- Parameters:
lds
- the LDAP connection namebaseDN
- the base DN for the searchscope
- the scope (LDAPConnection.SCOPE_BASE, LDAPConnection.SCOPE_ONE or LDAPConnection.SCOPE_SUB)filter
- the filter for the search (if null, use '(objectClass=*)' )attrs
- hidden attributes- Returns:
- the first entry found
- Throws:
AdminException
- if a problem occur
-
getEntriesFromSearch
public static List<com.novell.ldap.LDAPEntry> getEntriesFromSearch(String lds, String baseDN, int scope, String filter, String[] attrs) throws AdminException
Search and returns entries that match the parameters baseDN, scope and filter- Parameters:
lds
- the LDAP connection namebaseDN
- the base DN for the searchscope
- the scope (LDAPConnection.SCOPE_BASE, LDAPConnection.SCOPE_ONE or LDAPConnection.SCOPE_SUB)filter
- the filter for the search (if null, use '(objectClass=*)' )attrs
- hidden attributes- Returns:
- list of entry matching the criteria
- Throws:
AdminException
- if a problem occur
-
-