use of org.forgerock.openam.ldap.LDAPURL in project OpenAM by OpenRock.
the class DJLDAPv3Repo method getPSearchId.
/**
* This method constructs a persistent search "key", which will be used to
* figure out whether there is an existing persistent search for the same
* ldap server, base DN, filter, scope combination. By doing this we can
* "reuse" the results of other datastore implementations without the need
* of two or more persistent search connections with the same parameters.
*
* @return a unique ID based on the LDAP URLs, psearch base DN, filter and
* scope settings.
*/
private String getPSearchId() {
String psearchBase = CollectionHelper.getMapAttr(configMap, LDAP_PERSISTENT_SEARCH_BASE_DN);
String pfilter = CollectionHelper.getMapAttr(configMap, LDAP_PERSISTENT_SEARCH_FILTER);
String scope = CollectionHelper.getMapAttr(configMap, LDAP_PERSISTENT_SEARCH_SCOPE);
//creating a natural order of the ldap servers, so the "key" should be always the same regardless of the server
//order in the configuration.
LDAPURL[] servers = ldapServers.toArray(new LDAPURL[ldapServers.size()]);
Arrays.sort(servers);
String psIdKey = Arrays.toString(servers) + psearchBase + pfilter + scope + userSearchAttr;
return psIdKey;
}
Aggregations