edu.internet2.middleware.grouper.subj
Class CachingResolver

java.lang.Object
  extended by edu.internet2.middleware.grouper.subj.SubjectResolverDecorator
      extended by edu.internet2.middleware.grouper.subj.CachingResolver
All Implemented Interfaces:
SubjectResolver

public class CachingResolver
extends SubjectResolverDecorator

Decorator that provides caching for SubjectResolver. TODO the caching of findAll should work based on group restricted to, not stem name

Since:
1.2.1
Version:
$Id: CachingResolver.java,v 1.8 2008-08-26 21:11:51 mchyzer Exp $
Author:
blair christensen.

Constructor Summary
CachingResolver(SubjectResolver resolver)
           
 
Method Summary
 Subject find(String id)
           
 Subject find(String id, String source)
           
 Set<Subject> findAll(String query)
           
 Set<Subject> findAll(String query, String source)
           
 Set<Subject> findAllInStem(String stemName, String query)
           
 Subject findByIdentifier(String id)
           
 Subject findByIdentifier(String id, String source)
           
 Subject findByIdOrIdentifier(String id)
           
 Subject findByIdOrIdentifier(String id, String source)
           
 void flushCache()
          flush the cache (e.g.
 Source getSource(String id)
           
 Set<Source> getSources()
           
 
Methods inherited from class edu.internet2.middleware.grouper.subj.SubjectResolverDecorator
getDecoratedResolver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingResolver

public CachingResolver(SubjectResolver resolver)
Since:
1.2.1
Method Detail

flushCache

public void flushCache()
flush the cache (e.g. for testing)


find

public Subject find(String id)
             throws IllegalArgumentException,
                    SubjectNotFoundException,
                    SubjectNotUniqueException
Parameters:
id - Subject id to search on.
Returns:
Subject matching search parameters.
Throws:
IllegalArgumentException - if any parameter is null.
SubjectNotFoundException - if no matching subject is found.
SubjectNotUniqueException - if more than one matching subject is found.
Since:
1.2.1
See Also:
SubjectResolver.find(String)

find

public Subject find(String id,
                    String source)
             throws IllegalArgumentException,
                    SourceUnavailableException,
                    SubjectNotFoundException,
                    SubjectNotUniqueException
Parameters:
id - Subject id to search on.
source - Source adapter to search within.
Returns:
Subject matching search parameters.
Throws:
IllegalArgumentException - if any parameter is null.
SourceUnavailableException - if source is unavailable.
SubjectNotFoundException - if no matching subject is found.
SubjectNotUniqueException - if more than one matching subject is found.
Since:
1.2.1
See Also:
SubjectResolver.find(String, String)

findAll

public Set<Subject> findAll(String query)
                     throws IllegalArgumentException
Parameters:
query - A source-appropraite query string.
Returns:
All subjects matching query.
Throws:
IllegalArgumentException - if any parameter is null.
Since:
1.2.1
See Also:
SubjectResolver.findAll(String)

findAll

public Set<Subject> findAll(String query,
                            String source)
                     throws IllegalArgumentException,
                            SourceUnavailableException
Parameters:
query - A source-appropriate query string.
source - Restrict query to within this source.
Returns:
All subjects matching query.
Throws:
IllegalArgumentException - if any parameter is null.
SourceUnavailableException - if source is unavailable.
Since:
1.2.1
See Also:
SubjectResolver.findAll(String, String)

findByIdentifier

public Subject findByIdentifier(String id)
                         throws IllegalArgumentException,
                                SubjectNotFoundException,
                                SubjectNotUniqueException
Parameters:
id - Subject identifier to search on.
Returns:
Subject matching search parameters.
Throws:
IllegalArgumentException - if any parameter is null.
SubjectNotFoundException - if no matching subject is found.
SubjectNotUniqueException - if more than one matching subject is found.
Since:
1.2.1
See Also:
SubjectResolver.findByIdentifier(String)

findByIdentifier

public Subject findByIdentifier(String id,
                                String source)
                         throws IllegalArgumentException,
                                SourceUnavailableException,
                                SubjectNotFoundException,
                                SubjectNotUniqueException
Parameters:
id - Subject identifier to search on.
source - Source adapter to search within.
Returns:
Subject matching search parameters.
Throws:
IllegalArgumentException - if any parameter is null.
SourceUnavailableException - if source is unavailable.
SubjectNotFoundException - if no matching subject is found.
SubjectNotUniqueException - if more than one matching subject is found.
Since:
1.2.1
See Also:
SubjectResolver.findByIdentifier(String, String)

getSource

public Source getSource(String id)
                 throws IllegalArgumentException,
                        SourceUnavailableException
Returns:
Subject source identified by id.
Throws:
IllegalArgumentException - if id is null.
SourceUnavailableException - if source cannot be returned.
Since:
1.2.1
See Also:
SubjectResolver.getSource(String)

getSources

public Set<Source> getSources()
Returns:
All Subject sources.
Since:
1.2.1
See Also:
SubjectResolver.getSources()

findByIdOrIdentifier

public Subject findByIdOrIdentifier(String id)
                             throws IllegalArgumentException,
                                    SubjectNotFoundException,
                                    SubjectNotUniqueException
Parameters:
id - Subject identifier to search on.
Returns:
Subject matching search parameters.
Throws:
IllegalArgumentException - if any parameter is null.
SubjectNotFoundException - if no matching subject is found.
SubjectNotUniqueException - if more than one matching subject is found.

findByIdOrIdentifier

public Subject findByIdOrIdentifier(String id,
                                    String source)
                             throws IllegalArgumentException,
                                    SourceUnavailableException,
                                    SubjectNotFoundException,
                                    SubjectNotUniqueException
Parameters:
id - Subject identifier to search on.
source - Source adapter to search within.
Returns:
Subject matching search parameters.
Throws:
IllegalArgumentException - if any parameter is null.
SourceUnavailableException - if source is unavailable.
SubjectNotFoundException - if no matching subject is found.
SubjectNotUniqueException - if more than one matching subject is found.
See Also:
SubjectResolver.findByIdOrIdentifier(String, String)

findAllInStem

public Set<Subject> findAllInStem(String stemName,
                                  String query)
                           throws IllegalArgumentException
Parameters:
stemName - name of stem we are querying
query - A source-appropriate query string.
Returns:
All subjects matching query.
Throws:
IllegalArgumentException - if any parameter is null.
See Also:
SubjectResolver.findAllInStem(java.lang.String, java.lang.String)