Class SourcesXmlResolver
java.lang.Object
edu.internet2.middleware.grouper.subj.SourcesXmlResolver
- All Implemented Interfaces:
SubjectResolver
Wrapper around Subject sources configured in
subject.properties
.
- Since:
- 1.2.1
- Version:
- $Id: SourcesXmlResolver.java,v 1.13 2009-10-19 19:01:55 mchyzer Exp $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
TODO merge this with GrouperCallable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfind subjects in a set of sourcesfindAllInStem
(String stemName, String query) note if stem name is blank, it means rootfindByIdentifier
(String id, boolean ignoreCachedSubjects) findByIdentifier
(String id, String source) findByIdentifier
(String id, String source, boolean ignoreCachedSubjects) findByIdentifiers
(Collection<String> identifiers) findByIdentifiers
(Collection<String> identifiers, String source) findByIdOrIdentifier
(String idOrIdentifier) findByIdOrIdentifier
(String idOrIdentifier, boolean ignoreCachedSubjects) findByIdOrIdentifier
(String id, String source) findByIdOrIdentifier
(String id, String source, boolean ignoreCachedSubjects) findByIds
(Collection<String> ids) findByIds
(Collection<String> ids, String source) findByIds
(Collection<String> ids, String source, boolean ignoreCachedSubjects) findByIdsOrIdentifiers
(Collection<String> idsOrIdentifiers) findByIdsOrIdentifiers
(Collection<String> idsOrIdentifiers, String source) findByIdsOrIdentifiers
(Collection<String> idsOrIdentifiers, Set<Source> sources) find a page of subjects in a set of sourcesfindPageInStem
(String stemName, String query) note if stem name is blank, it means rootfindPageInStem
(String stemName, String query, Set<Source> sources) note if stem name is blank, it means rootvoid
flush the cache (e.g.getSources
(String subjectType)
-
Constructor Details
-
SourcesXmlResolver
public SourcesXmlResolver()Initialize a new SourcesXmlResolver.- Since:
- 1.2.1
-
-
Method Details
-
flushCache
public void flushCache()flush the cache (e.g. for testing)- Specified by:
flushCache
in interfaceSubjectResolver
-
find
public Subject find(String id) throws IllegalArgumentException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
find
in interfaceSubjectResolver
- 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:
-
find
public Subject find(String id, boolean ignoreCachedSubjects) throws IllegalArgumentException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
find
in interfaceSubjectResolver
- 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.- See Also:
-
find
public Subject find(String id, String source) throws IllegalArgumentException, SourceUnavailableException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
find
in interfaceSubjectResolver
- 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)
-
find
public Subject find(String id, String source, boolean ignoreCachedSubjects) throws IllegalArgumentException, SourceUnavailableException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
find
in interfaceSubjectResolver
- Parameters:
id
-source
-ignoreCachedSubjects
-- 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.
-
findAll
- Specified by:
findAll
in interfaceSubjectResolver
- 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:
-
findAll
public Set<Subject> findAll(String query, String source) throws IllegalArgumentException, SourceUnavailableException - Specified by:
findAll
in interfaceSubjectResolver
- 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:
-
findByIdentifier
public Subject findByIdentifier(String id) throws IllegalArgumentException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
findByIdentifier
in interfaceSubjectResolver
- 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:
-
findByIdentifier
public Subject findByIdentifier(String id, boolean ignoreCachedSubjects) throws IllegalArgumentException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
findByIdentifier
in interfaceSubjectResolver
- 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.- See Also:
-
findByIdentifier
public Subject findByIdentifier(String id, String source) throws IllegalArgumentException, SourceUnavailableException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
findByIdentifier
in interfaceSubjectResolver
- 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)
-
findByIdentifier
public Subject findByIdentifier(String id, String source, boolean ignoreCachedSubjects) throws IllegalArgumentException, SourceUnavailableException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
findByIdentifier
in interfaceSubjectResolver
- 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#findByIdentifier(String, String, String, boolean)
-
getSource
- Specified by:
getSource
in interfaceSubjectResolver
- Returns:
- Subject source identified by id.
- Throws:
IllegalArgumentException
- if id is null.SourceUnavailableException
- if source cannot be returned.- Since:
- 1.2.1
- See Also:
-
getSources
- Specified by:
getSources
in interfaceSubjectResolver
- Returns:
- All Subject sources.
- Since:
- 1.2.1
- See Also:
-
getSources
- Parameters:
subjectType
-- Returns:
- the sources
- 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 interfaceSubjectResolver
- 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:
-
findByIdOrIdentifier
public Subject findByIdOrIdentifier(String idOrIdentifier, boolean ignoreCachedSubjects) throws IllegalArgumentException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
findByIdOrIdentifier
in interfaceSubjectResolver
- 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:
-
findByIdOrIdentifier
public Subject findByIdOrIdentifier(String id, String source) throws IllegalArgumentException, SourceUnavailableException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
findByIdOrIdentifier
in interfaceSubjectResolver
- 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:
-
findByIdOrIdentifier
public Subject findByIdOrIdentifier(String id, String source, boolean ignoreCachedSubjects) throws IllegalArgumentException, SourceUnavailableException, SubjectNotFoundException, SubjectNotUniqueException - Specified by:
findByIdOrIdentifier
in interfaceSubjectResolver
- 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:
-
findAllInStem
note if stem name is blank, it means root- Specified by:
findAllInStem
in interfaceSubjectResolver
- Parameters:
stemName
- name of stem we are queryingquery
- A source-appropriate query string.- Returns:
- All subjects matching query.
- Throws:
IllegalArgumentException
- if any parameter is null.- See Also:
-
findPage
- Specified by:
findPage
in interfaceSubjectResolver
- Parameters:
query
- A source-appropraite query string.- Returns:
- Paged subjects matching query.
- Throws:
IllegalArgumentException
- if any parameter is null.- Since:
- 1.2.1
- See Also:
-
findPage
public SearchPageResult findPage(String query, String source) throws IllegalArgumentException, SourceUnavailableException - Specified by:
findPage
in interfaceSubjectResolver
- Parameters:
query
- A source-appropriate query string.source
- Restrict query to within this source.- Returns:
- Page of subjects matching query.
- Throws:
IllegalArgumentException
- if any parameter is null.SourceUnavailableException
- if source is unavailable.- Since:
- 1.2.1
- See Also:
-
findPageInStem
public SearchPageResult findPageInStem(String stemName, String query) throws IllegalArgumentException note if stem name is blank, it means root- Specified by:
findPageInStem
in interfaceSubjectResolver
- Parameters:
stemName
- name of stem we are queryingquery
- A source-appropriate query string.- Returns:
- All subjects matching query.
- Throws:
IllegalArgumentException
- if any parameter is null.- See Also:
-
findPageInStem
public SearchPageResult findPageInStem(String stemName, String query, Set<Source> sources) throws IllegalArgumentException note if stem name is blank, it means root- Specified by:
findPageInStem
in interfaceSubjectResolver
- Parameters:
stemName
- name of stem we are queryingquery
- A source-appropriate query string.- Returns:
- All subjects matching query.
- Throws:
IllegalArgumentException
- if any parameter is null.- See Also:
-
edu.internet2.middleware.grouper.subj.SubjectResolver#findAllInStem(java.lang.String, java.lang.String, Set)
-
findAll
Description copied from interface:SubjectResolver
find subjects in a set of sources- Specified by:
findAll
in interfaceSubjectResolver
- Returns:
- the subjects
- See Also:
-
findPage
public SearchPageResult findPage(String query, Set<Source> sources) throws SourceUnavailableException Description copied from interface:SubjectResolver
find a page of subjects in a set of sources- Specified by:
findPage
in interfaceSubjectResolver
- Returns:
- the page of subjects
- Throws:
SourceUnavailableException
- See Also:
-
findByIdentifiers
public Map<String,Subject> findByIdentifiers(Collection<String> identifiers) throws IllegalArgumentException - Specified by:
findByIdentifiers
in interfaceSubjectResolver
- Returns:
- map of search param to subject
- Throws:
IllegalArgumentException
- if any parameter is null.- See Also:
-
findByIdentifiers
public Map<String,Subject> findByIdentifiers(Collection<String> identifiers, String source) throws IllegalArgumentException, SourceUnavailableException - Specified by:
findByIdentifiers
in interfaceSubjectResolver
source
- Source adapter to search within.- Returns:
- map of search param to subject
- Throws:
IllegalArgumentException
- if any parameter is null.SourceUnavailableException
- if source is unavailable.- See Also:
-
findByIds
- Specified by:
findByIds
in interfaceSubjectResolver
- Parameters:
ids
- Subject id to search on.- Returns:
- map of search param to subject
- Throws:
IllegalArgumentException
- if any parameter is null.- See Also:
-
findByIds
public Map<String,Subject> findByIds(Collection<String> ids, String source, boolean ignoreCachedSubjects) throws IllegalArgumentException, SourceUnavailableException - Specified by:
findByIds
in interfaceSubjectResolver
source
- Source adapter to search within.- Returns:
- map of search param to subject
- Throws:
IllegalArgumentException
- if any parameter is null.SourceUnavailableException
- if source is unavailable.- See Also:
-
findByIds
public Map<String,Subject> findByIds(Collection<String> ids, String source) throws IllegalArgumentException, SourceUnavailableException - Specified by:
findByIds
in interfaceSubjectResolver
source
- Source adapter to search within.- Returns:
- map of search param to subject
- Throws:
IllegalArgumentException
- if any parameter is null.SourceUnavailableException
- if source is unavailable.- See Also:
-
findByIdsOrIdentifiers
public Map<String,Subject> findByIdsOrIdentifiers(Collection<String> idsOrIdentifiers) throws IllegalArgumentException - Specified by:
findByIdsOrIdentifiers
in interfaceSubjectResolver
- Parameters:
idsOrIdentifiers
- Subject identifiers to search on.- Returns:
- map of search param to subject
- Throws:
IllegalArgumentException
- if any parameter is null.- See Also:
-
findByIdsOrIdentifiers
public Map<String,Subject> findByIdsOrIdentifiers(Collection<String> idsOrIdentifiers, Set<Source> sources) throws IllegalArgumentException - Specified by:
findByIdsOrIdentifiers
in interfaceSubjectResolver
sources
- Source adapters to search within.- Returns:
- map of search param to subject
- Throws:
IllegalArgumentException
- if any parameter is null.- See Also:
-
findByIdsOrIdentifiers
public Map<String,Subject> findByIdsOrIdentifiers(Collection<String> idsOrIdentifiers, String source) throws IllegalArgumentException, SourceUnavailableException - Specified by:
findByIdsOrIdentifiers
in interfaceSubjectResolver
source
- Source adapter to search within.- Returns:
- map of search param to subject
- Throws:
IllegalArgumentException
- if any parameter is null.SourceUnavailableException
- if source is unavailable.- See Also:
-