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 type)
           
 Subject find(String id, String type, String source)
           
 Set<Subject> findAll(String query)
           
 Set<Subject> findAll(String query, String source)
           
 Subject findByIdentifier(String id)
           
 Subject findByIdentifier(String id, String type)
           
 Subject findByIdentifier(String id, String type, 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 type)
             throws IllegalArgumentException,
                    SubjectNotFoundException,
                    SubjectNotUniqueException
Specified by:
find in interface SubjectResolver
Parameters:
id - Subject id to search on.
type - Subject type 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, String)

find

public Subject find(String id,
                    String type,
                    String source)
             throws IllegalArgumentException,
                    SourceUnavailableException,
                    SubjectNotFoundException,
                    SubjectNotUniqueException
Specified by:
find in interface SubjectResolver
Parameters:
id - Subject id to search on.
type - Subject type 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 type)
                         throws IllegalArgumentException,
                                SubjectNotFoundException,
                                SubjectNotUniqueException
Specified by:
findByIdentifier in interface SubjectResolver
Parameters:
id - Subject identifier to search on.
type - Subject type 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, String)

findByIdentifier

public Subject findByIdentifier(String id,
                                String type,
                                String source)
                         throws IllegalArgumentException,
                                SourceUnavailableException,
                                SubjectNotFoundException,
                                SubjectNotUniqueException
Specified by:
findByIdentifier in interface SubjectResolver
Parameters:
id - Subject identifier to search on.
type - Subject type 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
Specified by:
getSources in interface SubjectResolver
Parameters:
subjectType - Only return sources that provide this type.
Returns:
All Subject sources that provide subjectType.
Throws:
IllegalArgumentException - if subjectType is null or invalid.
Since:
1.2.1
See Also:
SubjectResolver.getSources(String)