edu.internet2.middleware.grouper.ldap
Class LdapSession

java.lang.Object
  extended by edu.internet2.middleware.grouper.ldap.LdapSession

public class LdapSession
extends Object

will handle the ldap config, and inverse of control for pooling

Author:
mchyzer

Constructor Summary
LdapSession()
           
 
Method Summary
static Object callbackLdapSession(String ldapServerId, LdapHandler ldapHandler)
          call this to send a callback for the ldap session object.
static
<R> List<R>
list(Class<R> returnType, String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String attributeName)
          run a filter, for one attribute, and return a list of that attribute typecast as a certain type note, if it is a multi-valued attributes, and there are multiple object results, it will be flattened into one list
static
<R> Map<String,List<R>>
listInObjects(Class<R> returnType, String ldapServerId, String searchDn, LdapSearchScope ldapSearchScope, String filter, String attributeName)
          run a filter, for one attribute, and return a map of the DN key to the value of list of that attribute typecast as a certain type
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapSession

public LdapSession()
Method Detail

callbackLdapSession

public static Object callbackLdapSession(String ldapServerId,
                                         LdapHandler ldapHandler)
call this to send a callback for the ldap session object.

Parameters:
ldapServerId - is the config id from the grouper-loader.properties
ldapHandler - is the logic of the ldap calls
Returns:
the result of the handler

list

public static <R> List<R> list(Class<R> returnType,
                               String ldapServerId,
                               String searchDn,
                               LdapSearchScope ldapSearchScope,
                               String filter,
                               String attributeName)
run a filter, for one attribute, and return a list of that attribute typecast as a certain type note, if it is a multi-valued attributes, and there are multiple object results, it will be flattened into one list

Type Parameters:
R -
Parameters:
returnType - note, only String.class is currently supported
ldapServerId -
searchDn -
ldapSearchScope -
filter -
attributeName -
Returns:
the list of results, never null

listInObjects

public static <R> Map<String,List<R>> listInObjects(Class<R> returnType,
                                                    String ldapServerId,
                                                    String searchDn,
                                                    LdapSearchScope ldapSearchScope,
                                                    String filter,
                                                    String attributeName)
run a filter, for one attribute, and return a map of the DN key to the value of list of that attribute typecast as a certain type

Type Parameters:
R -
Parameters:
returnType - note, only String.class is currently supported
ldapServerId -
searchDn -
ldapSearchScope -
filter -
attributeName -
Returns:
the list of results, never null