org.jasig.portal.services.persondir.support
Class LdapPersonAttributeDaoImpl

java.lang.Object
  extended by org.jasig.portal.services.persondir.support.AbstractDefaultQueryPersonAttributeDao
      extended by org.jasig.portal.services.persondir.support.LdapPersonAttributeDaoImpl
All Implemented Interfaces:
IPersonAttributeDao

public class LdapPersonAttributeDaoImpl
extends AbstractDefaultQueryPersonAttributeDao

LDAP implementation of IPersonAttributeDao. This is code copied from uPortal 2.4 PersonDirectory and made to implement this DAO interface. Dependent upon JNDI. In the case of multi valued attributes, now stores a ArrayList rather than a Vector.

Since:
uPortal 2.5
Version:
$Revision: 1.11 $ $Date: 2005/04/26 16:34:30 $
Author:
andrew.petro@yale.edu, Eric Dalquist edalquist@unicon.net

Field Summary
private  java.util.Map attributeMappings
          Map from LDAP attribute names to uPortal attribute names.
private  ILdapServer ldapServer
          The ldap server to use to make the queries against.
private  java.lang.String query
          The query we should execute.
private  java.util.List queryAttributes
          List of names of uPortal attributes the values of which will be used, in order, to populate the parameters of the LDAP query.
private  int timeLimit
          Time limit, in milliseconds, for LDAP query.
private  java.util.Set userAttributes
          Set of attributes this DAO may provide when queried.
 
Fields inherited from class org.jasig.portal.services.persondir.support.AbstractDefaultQueryPersonAttributeDao
log
 
Constructor Summary
LdapPersonAttributeDaoImpl()
           
 
Method Summary
 java.util.Map getLdapAttributesToPortalAttributes()
          Get the mapping from LDAP attribute names to uPortal attribute names.
 ILdapServer getLdapServer()
           
 java.util.Set getPossibleUserAttributeNames()
          Gets a Set of attribute names that may be returned by the IPersonAttributeDao.getUserAttributes(Map).
 java.lang.String getQuery()
           
 java.util.List getQueryAttributes()
           
 int getTimeLimit()
           
 java.util.Map getUserAttributes(java.util.Map seed)
          Returned Map will have values of String or String[] or byte[]
 void setLdapAttributesToPortalAttributes(java.util.Map ldapAttributesToPortalAttributesArg)
          Set the Map to use for mapping from a ldap attribute name to a portal attribute name or Set of portal attribute names.
 void setLdapServer(ILdapServer ldapServer)
           
 void setQuery(java.lang.String uidQuery)
           
 void setQueryAttributes(java.util.List queryAttributes)
           
 void setTimeLimit(int timeLimit)
           
 java.lang.String toString()
           
 
Methods inherited from class org.jasig.portal.services.persondir.support.AbstractDefaultQueryPersonAttributeDao
getDefaultAttributeName, getUserAttributes, setDefaultAttributeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timeLimit

private int timeLimit
Time limit, in milliseconds, for LDAP query. Zero means wait indefinitely.


query

private java.lang.String query
The query we should execute.


attributeMappings

private java.util.Map attributeMappings
Map from LDAP attribute names to uPortal attribute names.


userAttributes

private java.util.Set userAttributes
Set of attributes this DAO may provide when queried.


queryAttributes

private java.util.List queryAttributes
List of names of uPortal attributes the values of which will be used, in order, to populate the parameters of the LDAP query.


ldapServer

private ILdapServer ldapServer
The ldap server to use to make the queries against.

Constructor Detail

LdapPersonAttributeDaoImpl

public LdapPersonAttributeDaoImpl()
Method Detail

getUserAttributes

public java.util.Map getUserAttributes(java.util.Map seed)
Returned Map will have values of String or String[] or byte[]

Parameters:
seed - immutable Map of attributes to values to seed the query
Returns:
Map from attribute names to values
See Also:
IPersonAttributeDao.getUserAttributes(java.util.Map)

getPossibleUserAttributeNames

public java.util.Set getPossibleUserAttributeNames()
Description copied from interface: IPersonAttributeDao
Gets a Set of attribute names that may be returned by the IPersonAttributeDao.getUserAttributes(Map). The names returned represent all possible names IPersonAttributeDao.getUserAttributes(Map) could return. If the dao doesn't have a way to know all possible attribute names this method should return null.
Returns an immutable Set.

Returns:
A {link Set} of possible attribute names for user queries.

getLdapAttributesToPortalAttributes

public java.util.Map getLdapAttributesToPortalAttributes()
Get the mapping from LDAP attribute names to uPortal attribute names. Mapping type is from String to [String | Set of String].

Returns:
Returns the ldapAttributesToPortalAttributes.

setLdapAttributesToPortalAttributes

public void setLdapAttributesToPortalAttributes(java.util.Map ldapAttributesToPortalAttributesArg)
Set the Map to use for mapping from a ldap attribute name to a portal attribute name or Set of portal attribute names. Ldap attribute names that are specified but have null mappings will use the ldap attribute name for the portal attribute name. Ldap attribute names that are not specified as keys in this Map will be ignored.
The passed Map must have keys of type String and values of type String or a Set of String.

Parameters:
ldapAttributesToPortalAttributesArg - Map from ldap attribute names to portal attribute names.
Throws:
java.lang.IllegalArgumentException - If the Map doesn't follow the rules stated above.
See Also:
MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping(Map)

getTimeLimit

public int getTimeLimit()
Returns:
Returns the timeLimit.

setTimeLimit

public void setTimeLimit(int timeLimit)
Parameters:
timeLimit - The timeLimit to set.

getQuery

public java.lang.String getQuery()
Returns:
Returns the query.

setQuery

public void setQuery(java.lang.String uidQuery)
Parameters:
uidQuery - The query to set.

getLdapServer

public ILdapServer getLdapServer()
Returns:
Returns the ldapServer.

setLdapServer

public void setLdapServer(ILdapServer ldapServer)
Parameters:
ldapServer - The ldapServer to set.

getQueryAttributes

public java.util.List getQueryAttributes()
Returns:
Returns the queryAttributes.

setQueryAttributes

public void setQueryAttributes(java.util.List queryAttributes)
Parameters:
queryAttributes - The queryAttributes to set.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object