|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.services.persondir.support.BasePersonAttributeDao
org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao
org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao
org.jasig.services.persondir.support.AbstractAggregatingDefaultQueryPersonAttributeDao
public abstract class AbstractAggregatingDefaultQueryPersonAttributeDao
Provides a base set of implementations and properties for IPersonAttributeDao
implementations that aggregate results from a sub List of IPersonAttributeDaos.
Configuration:
| Property | Description | Required | Default |
|---|---|---|---|
| personAttributeDaos |
A List of IPersonAttributeDaos to aggregate attributes from.
|
Yes | null |
| attrMerger |
A IAttributeMerger strategy to use for merging the attributes from
the List of IPersonAttributeDaos.
|
No | MultivaluedAttributeMerger |
| recoverExceptions |
Sets the action to be taken if one of the IPersonAttributeDaos in the
List fails with a RuntimeException. If set to true a warn level
log message and stack trace will be logged. If set to false an error level
message and stack trace will be logged and the exception will re-thrown.
|
No | true |
| stopOnSuccess | If true iteration of the child DAOs will stop after the first one that returns without throwing an exception. This is intended to provide fail-over among attribute sources. The recoverExceptions should be set to true for this to function as expected | No | false |
| Field Summary | |
|---|---|
protected IAttributeMerger |
attrMerger
Strategy for merging together the results from successive PersonAttributeDaos. |
protected List<IPersonAttributeDao> |
personAttributeDaos
A List of child IPersonAttributeDao instances which we will poll in order. |
protected boolean |
recoverExceptions
True if we should catch, logger, and ignore Throwables propogated by individual DAOs. |
protected boolean |
stopOnSuccess
|
| Fields inherited from class org.jasig.services.persondir.support.BasePersonAttributeDao |
|---|
logger |
| Fields inherited from interface org.jasig.services.persondir.IPersonAttributeDao |
|---|
WILDCARD, WILDCARD_PATTERN |
| Constructor Summary | |
|---|---|
AbstractAggregatingDefaultQueryPersonAttributeDao()
|
|
| Method Summary | |
|---|---|
protected abstract Set<IPersonAttributes> |
getAttributesFromDao(Map<String,List<Object>> seed,
boolean isFirstQuery,
IPersonAttributeDao currentlyConsidering,
Set<IPersonAttributes> resultPeople)
Call to execute the appropriate query on the current IPersonAttributeDao. |
Set<String> |
getAvailableQueryAttributes()
Merges the results of calling IPersonAttributeDao.getAvailableQueryAttributes() on each child dao using
the configured IAttributeMerger.mergeAvailableQueryAttributes(Set, Set). |
IAttributeMerger |
getMerger()
Get the strategy whereby we accumulate attributes. |
Set<IPersonAttributes> |
getPeopleWithMultivaluedAttributes(Map<String,List<Object>> query)
Iterates through the configured List of IPersonAttributeDao
instances. |
List<IPersonAttributeDao> |
getPersonAttributeDaos()
Get an unmodifiable List of delegates which we will poll for attributes. |
Set<String> |
getPossibleUserAttributeNames()
Merges the results of calling IPersonAttributeDao.getPossibleUserAttributeNames() on each child dao using
the configured IAttributeMerger.mergePossibleUserAttributeNames(Set, Set). |
boolean |
isRecoverExceptions()
True if this class will catch exceptions thrown by its delegate DAOs and fail to propogate them. |
boolean |
isStopOnSuccess()
|
void |
setMerger(IAttributeMerger merger)
Set the strategy whereby we accumulate attributes from the results of polling our delegates. |
void |
setPersonAttributeDaos(List<IPersonAttributeDao> 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. |
void |
setStopOnSuccess(boolean stopOnSuccess)
If true iteration of the child DAOs will stop after the first one that returns without throwing an exception. |
| Methods inherited from class org.jasig.services.persondir.support.AbstractDefaultAttributePersonAttributeDao |
|---|
getPerson, getUsernameAttributeProvider, setUsernameAttributeProvider, toSeedMap |
| Methods inherited from class org.jasig.services.persondir.support.AbstractFlatteningPersonAttributeDao |
|---|
getPeople, toMultivaluedSeed |
| Methods inherited from class org.jasig.services.persondir.support.BasePersonAttributeDao |
|---|
flattenResults, getMultivaluedUserAttributes, getMultivaluedUserAttributes, getUserAttributes, getUserAttributes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected List<IPersonAttributeDao> personAttributeDaos
protected IAttributeMerger attrMerger
protected boolean recoverExceptions
protected boolean stopOnSuccess
| Constructor Detail |
|---|
public AbstractAggregatingDefaultQueryPersonAttributeDao()
| Method Detail |
|---|
public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(Map<String,List<Object>> query)
List of IPersonAttributeDao
instances. The results from each DAO are merged into the result Map
by the configured IAttributeMerger.
IPersonAttributeDao.getPeopleWithMultivaluedAttributes(java.util.Map)
protected abstract Set<IPersonAttributes> getAttributesFromDao(Map<String,List<Object>> seed,
boolean isFirstQuery,
IPersonAttributeDao currentlyConsidering,
Set<IPersonAttributes> resultPeople)
IPersonAttributeDao. Provides extra information
beyond the seed for the state of the query chain and previous results.
seed - The seed for the original query.isFirstQuery - If this is the first query, this will stay true until a call to this method returns (does not throw an exception).currentlyConsidering - The IPersonAttributeDao to execute the query on.resultAttributes - The Map of results from all previous queries, may be null.
IPersonAttributeDao.getUserAttributes(Map).public final Set<String> getPossibleUserAttributeNames()
IPersonAttributeDao.getPossibleUserAttributeNames() on each child dao using
the configured IAttributeMerger.mergePossibleUserAttributeNames(Set, Set). If all children return null
this method returns null as well. If any child does not return null this method will not return null.
IPersonAttributeDao.getPossibleUserAttributeNames()public Set<String> getAvailableQueryAttributes()
IPersonAttributeDao.getAvailableQueryAttributes() on each child dao using
the configured IAttributeMerger.mergeAvailableQueryAttributes(Set, Set). If all children return null this
method returns null as well. If any child does not return null this method will not return null.
IPersonAttributeDao.getAvailableQueryAttributes()public final IAttributeMerger getMerger()
public final void setMerger(IAttributeMerger merger)
merger - The attrMerger to set.
IllegalArgumentException - If merger is null.public final List<IPersonAttributeDao> getPersonAttributeDaos()
List of delegates which we will poll for attributes.
public final void setPersonAttributeDaos(List<IPersonAttributeDao> daos)
List of delegates which we will poll for attributes.
daos - The personAttributeDaos to set.
IllegalArgumentException - If daos is null.public final boolean isRecoverExceptions()
public final void setRecoverExceptions(boolean recover)
recover - whether you would like exceptions recovered internallypublic boolean isStopOnSuccess()
public void setStopOnSuccess(boolean stopOnSuccess)
stopOnSuccess - If the first valid results should be returned, defaults to false
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||