Search in sources :

Example 6 with LDAPURL

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;
}
Also used : LDAPURL(org.forgerock.openam.ldap.LDAPURL) ByteString(org.forgerock.opendj.ldap.ByteString)

Aggregations

LDAPURL (org.forgerock.openam.ldap.LDAPURL)6 Server (com.iplanet.services.ldap.Server)3 ServerGroup (com.iplanet.services.ldap.ServerGroup)2 ServerInstance (com.iplanet.services.ldap.ServerInstance)2 LinkedHashSet (java.util.LinkedHashSet)2 Test (org.testng.annotations.Test)2 ServerEntryNotFoundException (com.iplanet.services.naming.ServerEntryNotFoundException)1 IdRepoException (com.sun.identity.idm.IdRepoException)1 ByteString (org.forgerock.opendj.ldap.ByteString)1 LDAPConnectionFactory (org.forgerock.opendj.ldap.LDAPConnectionFactory)1 SSLContextBuilder (org.forgerock.opendj.ldap.SSLContextBuilder)1 Options (org.forgerock.util.Options)1 Duration (org.forgerock.util.time.Duration)1