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

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

public class MergingPersonAttributeDaoImpl
extends AbstractDefaultQueryPersonAttributeDao

A IPersonAttributeDao implementation which iterates over children IPersonAttributeDaos queries each with the same data and merges their reported attributes in a configurable way. The default merger is MultivaluedAttributeMerger.

Since:
uPortal 2.5
Version:
$Revision: 1.10 $ $Date: 2005/04/06 15:30:50 $
Author:
andrew.petro@yale.edu, Eric Dalquist edalquist@unicon.net

Field Summary
private  IAttributeMerger attrMerger
          Strategy for merging together the results from successive PersonAttributeDaos.
private  java.util.List personAttributeDaos
          A List of child IPersonAttributeDao instances which we will poll in order.
private  boolean recoverExceptions
          True if we should catch, log, and ignore Throwables propogated by individual DAOs.
 
Fields inherited from class org.jasig.portal.services.persondir.support.AbstractDefaultQueryPersonAttributeDao
log
 
Constructor Summary
MergingPersonAttributeDaoImpl()
           
 
Method Summary
 IAttributeMerger getMerger()
          Get the strategy whereby we accumulate attributes.
 java.util.List getPersonAttributeDaos()
          Get the List of delegates which we will poll for attributes.
 java.util.Set getPossibleUserAttributeNames()
          This implementation is not always correct.
 java.util.Map getUserAttributes(java.util.Map seed)
          Iterates through the configured List of IPersonAttributeDao instances.
 boolean isRecoverExceptions()
          True if this class will catch exceptions thrown by its delegate DAOs and fail to propogate them.
 void setMerger(IAttributeMerger merger)
          Set the strategy whereby we accumulate attributes from the results of polling our delegates.
 void setPersonAttributeDaos(java.util.List daos)
          Set the List of delegates which we will poll for attributes.
 void setRecoverExceptions(boolean recover)
          Set to true if you would like this class to swallow RuntimeExceptions thrown by its delegates.
 
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, toString, wait, wait, wait
 

Field Detail

personAttributeDaos

private java.util.List personAttributeDaos
A List of child IPersonAttributeDao instances which we will poll in order.


attrMerger

private IAttributeMerger attrMerger
Strategy for merging together the results from successive PersonAttributeDaos.


recoverExceptions

private boolean recoverExceptions
True if we should catch, log, and ignore Throwables propogated by individual DAOs.

Constructor Detail

MergingPersonAttributeDaoImpl

public MergingPersonAttributeDaoImpl()
Method Detail

getUserAttributes

public java.util.Map getUserAttributes(java.util.Map seed)
Iterates through the configured List of IPersonAttributeDao instances. The results from each DAO are merged into the result Map by the configured IAttributeMerger.

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()
This implementation is not always correct. It handles the basic case where the Set of attributes returned by this implementation is the union of the attributes declared by all of the underlying implementations to be merged. Of course, an IAttributeMerger might provide for a merging policy such that the attributes resulting from invoking this IPersonAttributeDao implementation are not the union of the attributes declared by the underlying PersonAttributeDaos.

Returns:
A {link Set} of possible attribute names for user queries.
See Also:
IPersonAttributeDao.getPossibleUserAttributeNames()

getMerger

public IAttributeMerger getMerger()
Get the strategy whereby we accumulate attributes.

Returns:
Returns the attrMerger.

setMerger

public void setMerger(IAttributeMerger merger)
Set the strategy whereby we accumulate attributes from the results of polling our delegates.

Parameters:
merger - The attrMerger to set.
Throws:
java.lang.IllegalArgumentException - If merger is null.

getPersonAttributeDaos

public java.util.List getPersonAttributeDaos()
Get the List of delegates which we will poll for attributes.

Returns:
Returns the personAttributeDaos.

setPersonAttributeDaos

public void setPersonAttributeDaos(java.util.List daos)
Set the List of delegates which we will poll for attributes.

Parameters:
daos - The personAttributeDaos to set.
Throws:
java.lang.IllegalArgumentException - If daos is null.

isRecoverExceptions

public boolean isRecoverExceptions()
True if this class will catch exceptions thrown by its delegate DAOs and fail to propogate them. False if this class will stop on failure.

Returns:
Returns the recoverExceptions.

setRecoverExceptions

public void setRecoverExceptions(boolean recover)
Set to true if you would like this class to swallow RuntimeExceptions thrown by its delegates. This allows it to recover if a particular attribute source fails, still considering previous and subsequent sources. Set to false if you would like this class to fail hard upon any Throwable thrown by its children. This is desirable in cases where your Portal will not function without attributes from all of its sources.

Parameters:
recover - The recoverExceptions to set.