public class LDAPUtils extends Object
LDAPUtils.prioritizeServers(java.util.Set, java.lang.String, java.lang.String)
, which will be prioritized based on the
current server's server ID/site ID.LDAPURL
objects, or you can pass in the list to the newPrioritized* methods.Modifier and Type | Method and Description |
---|---|
static void |
addAttributeToMapAsByteArray(org.forgerock.opendj.ldap.Attribute attribute,
Map<byte[][]> map)
Converts the Attribute to an attribute name, 2-dimensional byte array map and adds it to the map passed in.
|
static void |
addAttributeToMapAsString(org.forgerock.opendj.ldap.Attribute attribute,
Map<Set> map)
Converts the Attribute to an attribute name, set of String values map and adds it to the map passed in.
|
static Set |
convertToLDAPURLs(Set servers)
Converts the incoming set of URLs to
LDAPURL instances and returns them as a set. |
static Set |
getAttributeValuesAsStringSet(org.forgerock.opendj.ldap.Attribute attribute)
Converts all the attribute values to a String Set.
|
static String |
getName(org.forgerock.opendj.ldap.DN dn)
Returns the RDN without the attribute name from the passed in
DN object, for example:
uid=demo,ou=people,dc=example,dc=com will return demo . |
static org.forgerock.opendj.ldap.SearchScope |
getSearchScope(String scope,
org.forgerock.opendj.ldap.SearchScope defaultScope)
Converts string representation of scope (as defined in the configuration) to the corresponding
SearchScope object. |
static org.forgerock.opendj.ldap.ConnectionFactory |
newFailoverConnectionFactory(Set servers,
String username,
char[] password,
int heartBeatInterval,
String heartBeatTimeUnit,
org.forgerock.opendj.ldap.LDAPOptions ldapOptions)
Creates a new connection factory that is capable to failover to the servers defined in case there is an error.
|
static org.forgerock.opendj.ldap.ConnectionFactory |
newFailoverConnectionPool(Set servers,
String username,
char[] password,
int maxSize,
int heartBeatInterval,
String heartBeatTimeUnit,
org.forgerock.opendj.ldap.LDAPOptions ldapOptions)
Creates a new connection pool that is capable to failover to the servers defined in case there is an error.
|
static org.forgerock.opendj.ldap.ConnectionFactory |
newPrioritizedFailoverConnectionFactory(Set servers,
String hostServerId,
String hostSiteId,
String username,
char[] password,
int heartBeatInterval,
String heartBeatTimeUnit,
org.forgerock.opendj.ldap.LDAPOptions options)
Based on the incoming parameters prioritizes the LDAP server list, then creates a connection factory that is
capable to failover to the servers defined in case there is an error.
|
static org.forgerock.opendj.ldap.ConnectionFactory |
newPrioritizedFailoverConnectionPool(Set servers,
String hostServerId,
String hostSiteId,
String username,
char[] password,
int maxSize,
int heartBeatInterval,
String heartBeatTimeUnit,
org.forgerock.opendj.ldap.LDAPOptions ldapOptions)
Based on the incoming parameters prioritizes the LDAP server list, then creates a connection pool that is
capable to failover to the servers defined in case there is an error.
|
static org.forgerock.opendj.ldap.Filter |
parseFilter(String filter,
org.forgerock.opendj.ldap.Filter defaultFilter)
Parses the incoming filter, and in case of failure falls back to the default filter.
|
static Set |
prioritizeServers(Set servers,
String hostServerId,
String hostSiteId)
Prioritizes the incoming LDAP servers based on their assigned servers/sites.
|
public static org.forgerock.opendj.ldap.ConnectionFactory newPrioritizedFailoverConnectionPool(Set servers, String hostServerId, String hostSiteId, String username, char[] password, int maxSize, int heartBeatInterval, String heartBeatTimeUnit, org.forgerock.opendj.ldap.LDAPOptions ldapOptions)
servers
- The set of servers in the format defined in LDAPUtils.prioritizeServers(java.util.Set, java.lang.String, java.lang.String)
.hostServerId
- The server ID for this OpenAM server.hostSiteId
- The site ID for this OpenAM server.username
- The directory user's DN. May be null if this is an anonymous connection.password
- The directory user's password.maxSize
- The max size of the created pool.heartBeatInterval
- The interval for sending out heartbeat requests.heartBeatTimeUnit
- The timeunit for the heartbeat interval.ldapOptions
- Additional LDAP settings used to create the pool.public static org.forgerock.opendj.ldap.ConnectionFactory newFailoverConnectionPool(Set servers, String username, char[] password, int maxSize, int heartBeatInterval, String heartBeatTimeUnit, org.forgerock.opendj.ldap.LDAPOptions ldapOptions)
servers
- The set of LDAP URLs that will be used to set up the connection factory.username
- The directory user's DN. May be null if this is an anonymous connection.password
- The directory user's password.maxSize
- The max size of the created pool.heartBeatInterval
- The interval for sending out heartbeat requests.heartBeatTimeUnit
- The timeunit for the heartbeat interval.ldapOptions
- Additional LDAP settings used to create the poolpublic static org.forgerock.opendj.ldap.ConnectionFactory newPrioritizedFailoverConnectionFactory(Set servers, String hostServerId, String hostSiteId, String username, char[] password, int heartBeatInterval, String heartBeatTimeUnit, org.forgerock.opendj.ldap.LDAPOptions options)
servers
- The set of servers in the format defined in LDAPUtils.prioritizeServers(java.util.Set, java.lang.String, java.lang.String)
.hostServerId
- The server ID for this OpenAM server.hostSiteId
- The site ID for this OpenAM server.username
- The directory user's DN. May be null if this is an anonymous connection.password
- The directory user's password.heartBeatInterval
- The interval for sending out heartbeat requests.heartBeatTimeUnit
- The timeunit for the heartbeat interval.options
- Additional LDAP settings used to create the connection factory.public static org.forgerock.opendj.ldap.ConnectionFactory newFailoverConnectionFactory(Set servers, String username, char[] password, int heartBeatInterval, String heartBeatTimeUnit, org.forgerock.opendj.ldap.LDAPOptions ldapOptions)
servers
- The set of LDAP URLs that will be used to set up the connection factory.username
- The directory user's DN. May be null if this is an anonymous connection.password
- The directory user's password.heartBeatInterval
- The interval for sending out heartbeat requests.heartBeatTimeUnit
- The timeunit for the heartbeat interval.ldapOptions
- Additional LDAP settings used to create the connection factory.public static Set prioritizeServers(Set servers, String hostServerId, String hostSiteId)
host:port
- The LDAP server has no preferred
server/sitehost:port|serverid
- The LDAP server should be mainly
used by an OpenAM instance with the same serveridhost:port|serverid|siteid
- The LDAP server should be
mainly used by an OpenAM instance with the same serverid or with the same
siteidservers
- The Set of servers that needs to be prioritized in the previously described format.hostServerId
- This server's ID.hostSiteId
- This server's site ID.public static org.forgerock.opendj.ldap.SearchScope getSearchScope(String scope, org.forgerock.opendj.ldap.SearchScope defaultScope)
SearchScope
object.scope
- the string representation of the scope.defaultScope
- in case the coversion fail this default scope should be returned.SearchScope
object.public static org.forgerock.opendj.ldap.Filter parseFilter(String filter, org.forgerock.opendj.ldap.Filter defaultFilter)
filter
- The filter that needs to be parsed.defaultFilter
- If the parsing fails, this will be returned.public static String getName(org.forgerock.opendj.ldap.DN dn)
DN
object, for example:
uid=demo,ou=people,dc=example,dc=com
will return demo
.dn
- The DN that we need the name of.public static void addAttributeToMapAsByteArray(org.forgerock.opendj.ldap.Attribute attribute, Map<byte[][]> map)
attribute
- The attribute that needs to be converted.map
- The map where the converted attribute is added to.public static void addAttributeToMapAsString(org.forgerock.opendj.ldap.Attribute attribute, Map<Set> map)
attribute
- The attribute that needs to be converted.map
- The map where the converted attribute is added to.public static Set getAttributeValuesAsStringSet(org.forgerock.opendj.ldap.Attribute attribute)
attribute
- the attribute to be converted.public static Set convertToLDAPURLs(Set servers)
LDAPURL
instances and returns them as a set. The iteration order
of the originally passed in Set is retained.servers
- The LDAP server URLs that needs to be converted to LDAPURL
instances.Copyright © 2010-2013, ForgeRock All Rights Reserved.