edu.internet2.middleware.grouper.subj
Class SourcesXmlResolver

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

public class SourcesXmlResolver
extends Object
implements SubjectResolver

Wrapper around Subject sources configured in sources.xml.

Since:
1.2.1
Version:
$Id: SourcesXmlResolver.java,v 1.13 2009-10-19 19:01:55 mchyzer Exp $
Author:
blair christensen.

Constructor Summary
SourcesXmlResolver()
          Initialize a new SourcesXmlResolver.
 
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)
          note if stem name is blank, it means root
 Subject findByIdentifier(String id)
           
 Subject findByIdentifier(String id, String source)
           
 Subject findByIdOrIdentifier(String idOrIdentifier)
           
 Subject findByIdOrIdentifier(String id, String source)
           
 void flushCache()
          flush the cache (e.g.
 Source getSource(String id)
           
 Set<Source> getSources()
           
 Set<Source> getSources(String subjectType)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourcesXmlResolver

public SourcesXmlResolver()
Initialize a new SourcesXmlResolver.

Since:
1.2.1
Method Detail

flushCache

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

Specified by:
flushCache in interface SubjectResolver

find

public Subject find(String id)
             throws IllegalArgumentException,
                    SubjectNotFoundException,
                    SubjectNotUniqueException
Specified by:
find in interface SubjectResolver
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
Specified by:
find in interface SubjectResolver
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, String)

findAll

public Set<Subject> findAll(String query)
                     throws IllegalArgumentException
Specified by:
findAll in interface SubjectResolver
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
Specified by:
findAll in interface SubjectResolver
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
Specified by:
findByIdentifier in interface SubjectResolver
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
Specified by:
findByIdentifier in interface SubjectResolver
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, String)

getSource

public Source getSource(String id)
                 throws IllegalArgumentException,
                        SourceUnavailableException
Specified by:
getSource in interface SubjectResolver
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()
Specified by:
getSources in interface SubjectResolver
Returns:
All Subject sources.
Since:
1.2.1
See Also:
SubjectResolver.getSources()

getSources

public Set<Source> getSources(String subjectType)
                       throws IllegalArgumentException
Throws:
IllegalArgumentException
Since:
1.2.1
See Also:
SubjectResolver#getSources(String)

findByIdOrIdentifier

public Subject findByIdOrIdentifier(String idOrIdentifier)
                             throws IllegalArgumentException,
                                    SubjectNotFoundException,
                                    SubjectNotUniqueException
Specified by:
findByIdOrIdentifier in interface SubjectResolver
Parameters:
idOrIdentifier - 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.
See Also:
SubjectResolver.findByIdOrIdentifier(String)

findByIdOrIdentifier

public Subject findByIdOrIdentifier(String id,
                                    String source)
                             throws IllegalArgumentException,
                                    SourceUnavailableException,
                                    SubjectNotFoundException,
                                    SubjectNotUniqueException
Specified by:
findByIdOrIdentifier in interface SubjectResolver
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
note if stem name is blank, it means root

Specified by:
findAllInStem in interface SubjectResolver
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)