Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.services.persondir.support
Class CachingPersonAttributeDaoImpl

    java.lang.Object
      org.jasig.portal.services.persondir.support.AbstractDefaultQueryPersonAttributeDao
          org.jasig.portal.services.persondir.support.CachingPersonAttributeDaoImpl

All Implemented Interfaces:
  IPersonAttributeDao

    public class CachingPersonAttributeDaoImpl

extends AbstractDefaultQueryPersonAttributeDao

A configurable caching implementation of `IPersonAttributeDao` which caches results from a wrapped IPersonAttributeDao.
Configuration:

Property | Description | Required | Default
--- | --- | --- | ---
cachedPersonAttributesDao | The `IPersonAttributeDao` to delegate queries to on cache misses. | Yes | null
userInfoCache | The `Map` to use for result caching. This class does no cache maintenence. It is assumed the underlying Map implementation will ensure the cache is in a good state at all times. | No | Value returned by 'CacheFactoryLocator.getCacheFactory().getCache(CacheFactory.USER_INFO_CACHE)'
cacheKeyAttributes | A Set of attribute names to use when building the cache key. The default implementation generates the key as a Map of attributeNames to values retrieved from the seed for the query. Zero length sets are treaded as null. | No | null

Version:
  $Id
Author:
  dgrimwood@unicon.net, Eric Dalquist edalquist@unicon.net

Field Summary
`private IPersonAttributeDao` | `cachedPersonAttributesDao`
`private java.util.Set` | `cacheKeyAttributes`
`private long` | `misses`
`private long` | `queries`
`private java.util.Map` | `userInfoCache`

Fields inherited from class org.jasig.portal.services.persondir.support.AbstractDefaultQueryPersonAttributeDao
`log`

Constructor Summary
`CachingPersonAttributeDaoImpl()`

Method Summary
`IPersonAttributeDao` | `getCachedPersonAttributesDao()`
`protected java.io.Serializable` | `getCacheKey(java.util.Map querySeed)` Generates a Serializable cache key from the seed parameters according to the documentation of this class.
`java.util.Set` | `getCacheKeyAttributes()`
`long` | `getMisses()`
`java.util.Set` | `getPossibleUserAttributeNames()` Gets a `Set` of attribute names that may be returned by the `IPersonAttributeDao.getUserAttributes(Map)`.
`long` | `getQueries()`
`java.util.Map` | `getUserAttributes(java.util.Map seed)` Wraps the call to the specified cachedPersonAttributesDao IPersonAttributeDao delegate with a caching layer.
`java.util.Map` | `getUserInfoCache()`
`void` | `setCachedPersonAttributesDao(IPersonAttributeDao cachedPersonAttributesDao)`
`void` | `setCacheKeyAttributes(java.util.Set cacheKeyAttributes)`
`void` | `setUserInfoCache(java.util.Map userInfoCache)`

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

### queries

    private long queries

### misses

    private long misses

### cachedPersonAttributesDao

    private IPersonAttributeDao cachedPersonAttributesDao

### userInfoCache

    private java.util.Map userInfoCache

### cacheKeyAttributes

    private java.util.Set cacheKeyAttributes

Constructor Detail

### CachingPersonAttributeDaoImpl

    public CachingPersonAttributeDaoImpl()

Method Detail

### getCachedPersonAttributesDao

    public IPersonAttributeDao getCachedPersonAttributesDao()

  Returns:
    Returns the cachedPersonAttributesDao.

### setCachedPersonAttributesDao

    public void setCachedPersonAttributesDao(IPersonAttributeDao cachedPersonAttributesDao)

  Parameters:
    `cachedPersonAttributesDao` - The cachedPersonAttributesDao to set.

### getCacheKeyAttributes

    public java.util.Set getCacheKeyAttributes()

  Returns:
    Returns the cacheKeyAttributes.

### setCacheKeyAttributes

    public void setCacheKeyAttributes(java.util.Set cacheKeyAttributes)

  Parameters:
    `cacheKeyAttributes` - The cacheKeyAttributes to set.

### getUserInfoCache

    public java.util.Map getUserInfoCache()

  Returns:
    Returns the userInfoCache.

### setUserInfoCache

    public void setUserInfoCache(java.util.Map userInfoCache)

  Parameters:
    `userInfoCache` - The userInfoCache to set.

### getMisses

    public long getMisses()

  Returns:
    Returns the number of cache misses.

### getQueries

    public long getQueries()

  Returns:
    Returns the number of queries.

### getUserAttributes

    public java.util.Map getUserAttributes(java.util.Map seed)

  Wraps the call to the specified cachedPersonAttributesDao IPersonAttributeDao delegate with a caching layer. Results are cached using keys generated by `getCacheKey(Map)`.

  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.
  See Also:
    `IPersonAttributeDao.getPossibleUserAttributeNames()`

### getCacheKey

    protected java.io.Serializable getCacheKey(java.util.Map querySeed)

  Generates a Serializable cache key from the seed parameters according to the documentation of this class. If the return value is NULL caching will be disabled for this query.

  Parameters:
    `querySeed` - The query to base the key on.
  Returns:
    A Serializable cache key.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD