Class BaseSourceAdapter
java.lang.Object
edu.internet2.middleware.subject.provider.BaseSourceAdapter
- All Implemented Interfaces:
Source
- Direct Known Subclasses:
GrouperSourceAdapter
,InternalSourceAdapter
,JDBCSourceAdapter
,JNDISourceAdapterLegacy
,LdapSourceAdapter
,NullSourceAdapter
Base Source adapter. Developers note: you should implement the getSubject and getSubjectByIdentifier methods (that take boolean) since the base class method will soon become abstract, and the method overloads which are deprecated and dont take booleans will go away.
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected String
internal attributes.protected String
protected String
protected Properties
The three different kinds of searches:protected SubjectType
protected Set<SubjectType>
-
Constructor Summary
ConstructorDescriptionDefault constructor.BaseSourceAdapter
(String id1, String name1) Allocates adapter with ID and name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(String attributeName) void
addInitParam
(String name1, String value) (non-javadoc)void
addInternalAttribute
(String attributeName) void
addSubjectType
(String type1) (non-javadoc)return the attribute nameconvertSourceAttributeToSubjectAttribute
(String nameOfSourceAttribute) convertSubjectAttributeToSourceAttribute
(String nameOfSubjectAttribute) protected Subject
createSubject
(Map<String, Object> sourceAttributesToValues, String subjectID) boolean
Compares this source against the specified source.return export label to attribute name (if there are overrides)protected Set
getId()
Returns the ID of this source.getInitParam
(String name1) (non-javadoc)Get a set of attributes that are marked as being internal attributes.getName()
Returns the name of this source.protected Search
Get the names of attributes used for searching.Get the names of attributes used for sorting.abstract Subject
getSubject
(String id1) Deprecated.use the overload insteadgetSubject
(String id1, boolean exceptionIfNull) Gets a Subject by its ID.getSubject
(String id1, boolean exceptionIfNull, String realm) Gets a Subject by its ID.abstract Subject
Deprecated.use the overload insteadgetSubjectByIdentifier
(String id1, boolean exceptionIfNull) note, you should implement this method since this implementation will become abstract at some pointgetSubjectByIdentifier
(String id1, boolean exceptionIfNull, String realm) Gets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.getSubjectByIdOrIdentifier
(String idOrIdentifier, boolean exceptionIfNull) find by id or identifiergetSubjectByIdOrIdentifier
(String idOrIdentifier, boolean exceptionIfNull, String realm) find by id or identifier.Get the names of attributes that are subject identifiers.Get all the names of attributes that are subject identifiers.getSubjectsByIdentifiers
(Collection<String> identifiers) Get subjects by identifiers.getSubjectsByIdentifiers
(Collection<String> identifiers, String realm) Get subjects by identifiers.getSubjectsByIds
(Collection<String> ids) Get subjects by ids.getSubjectsByIds
(Collection<String> ids, String realm) Get subjects by ids.getSubjectsByIdsOrIdentifiers
(Collection<String> idsOrIdentifiers) Get subjects by ids or identifiers.getSubjectsByIdsOrIdentifiers
(Collection<String> idsOrIdentifiers, String realm) Get subjects by ids or identifiers.get the config bean for this sourceGets the SubjectTypes supported by this source.int
hashCode()
abstract void
init()
Called by SourceManager when it loads this source.(non-javadoc)boolean
boolean
void
loadSearch
(Search search) void
removeInitParam
(String name1) static Integer
resultSetLimit
(boolean firstPageOnly, Integer pageSize, Integer theMaxResults) see what the result set limit should be (dont add one yet)get all subject idsUnstructured search for Subjects.Unstructured search for Subjects.searchPage
(String searchValue) Unstructured search for Subjects.searchPage
(String searchValue, String realm) Unstructured search for Subjects.void
setConfigId
(String configId) set config id for this sourcevoid
Sets the ID of this source.void
Sets the name of this source.void
setSearchAttributes
(Map<Integer, String> searchAttributes) protected void
setSearches
(HashMap<String, Search> searches1) void
setSortAttributes
(Map<Integer, String> sortAttributes) void
setSubjectIdentifierAttributes
(Map<Integer, String> subjectIdentifierAttributes) void
setSubjectIdentifierAttributesAll
(Map<Integer, String> subjectIdentifierAttributesAll) virtualAttributesForSource
(Source source) get the ordered list of virtual attributes for a source (new style)get the ordered list of virtual attributes for a sourceget the ordered list of virtual attributes for a sourceMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.internet2.middleware.subject.Source
checkConfig, loggingStart, loggingStop, printConfig
-
Field Details
-
nameAttributeName
-
descriptionAttributeName
-
id
-
name
-
types
-
type
-
params
-
searches
The three different kinds of searches: -
attributes
-
internalAttributes
internal attributes. -
subjectIdentifierAttributes
-
subjectIdentifierAttributesAll
-
sortAttributes
-
searchAttributes
-
-
Constructor Details
-
BaseSourceAdapter
public BaseSourceAdapter()Default constructor. -
BaseSourceAdapter
Allocates adapter with ID and name.- Parameters:
id1
-name1
-
-
-
Method Details
-
createSubject
-
getSourceAttributesToLowerCase
-
convertSubjectAttributeToSourceAttribute
- Specified by:
convertSubjectAttributeToSourceAttribute
in interfaceSource
-
exportLabelToAttributeName
return export label to attribute name (if there are overrides)- Returns:
- empty if no overrides, otherwise the attribute name to export label
-
attributeNameToViewerGroupName
return the attribute name- Returns:
- empty if no overrides, otherwise the attribute name to export label
-
convertSourceAttributeToSubjectAttribute
- Specified by:
convertSourceAttributeToSubjectAttribute
in interfaceSource
-
retrieveAllSubjectIds
Description copied from interface:Source
get all subject ids- Specified by:
retrieveAllSubjectIds
in interfaceSource
- Returns:
- all subjectIds
- See Also:
-
getSubject
public Subject getSubject(String id1, boolean exceptionIfNull, String realm) throws SubjectNotFoundException, SubjectNotUniqueException Description copied from interface:Source
Gets a Subject by its ID.- Specified by:
getSubject
in interfaceSource
exceptionIfNull
- if SubjectNotFoundException should be throws if the subject is null, or if null should be returnedrealm
- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String id1, boolean exceptionIfNull, String realm) throws SubjectNotFoundException, SubjectNotUniqueException Description copied from interface:Source
Gets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.- Specified by:
getSubjectByIdentifier
in interfaceSource
realm
- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectByIdOrIdentifier
public Subject getSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull, String realm) throws SubjectNotFoundException, SubjectNotUniqueException Description copied from interface:Source
find by id or identifier. pass in either an id or an identifier- Specified by:
getSubjectByIdOrIdentifier
in interfaceSource
exceptionIfNull
- if SubjectNotFoundException or nullrealm
- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- the subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectsByIdentifiers
Description copied from interface:Source
Get subjects by identifiers. Note, if the subjects arent found or arent unique, they wont be returned. Identifiers are unique ways to refer to a subject that isnt its id (e.g. netid). Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdentifiers
in interfaceSource
realm
- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- a map of results never null indexed by the identifiers
- See Also:
-
getSubjectsByIds
Description copied from interface:Source
Get subjects by ids. Note, if the subjects arent found or arent unique, they wont be returned. Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIds
in interfaceSource
realm
- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- a map of results never null indexed by the id
- See Also:
-
getSubjectsByIdsOrIdentifiers
public Map<String,Subject> getSubjectsByIdsOrIdentifiers(Collection<String> idsOrIdentifiers, String realm) Description copied from interface:Source
Get subjects by ids or identifiers. Note, if the subjects arent found or arent unique, they wont be returned. Identifiers are unique ways to refer to a subject that isnt its id (e.g. netid). Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdsOrIdentifiers
in interfaceSource
- Parameters:
idsOrIdentifiers
- each string could be a subject id or identifierrealm
- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- a map of results never null indexed by the id or identifier that was passed in. Note, the same subject could be returned twice if looked up by id and identifier (two inputs)
- See Also:
-
search
Description copied from interface:Source
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions -
searchPage
Description copied from interface:Source
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions if maxPageSize is set in subject.properties, then only return max that many, and if there are more, set the tooManyResults flag- Specified by:
searchPage
in interfaceSource
realm
- string value that sets the realm for the search. The source can implement various realms to account for permissions of the calling user- Returns:
- results and if there are too many, never return null!!!
- See Also:
-
getSubjectStatusConfig
Description copied from interface:Source
get the config bean for this source- Specified by:
getSubjectStatusConfig
in interfaceSource
- Returns:
- the config bean for this source
- See Also:
-
resultSetLimit
public static Integer resultSetLimit(boolean firstPageOnly, Integer pageSize, Integer theMaxResults) see what the result set limit should be (dont add one yet)- Parameters:
firstPageOnly
-pageSize
-theMaxResults
-- Returns:
- the limit or null if none
-
searchPage
Description copied from interface:Source
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions if maxPageSize is set in subject.properties, then only return max that many, and if there are more, set the tooManyResults flag- Specified by:
searchPage
in interfaceSource
- Returns:
- results and if there are too many, never return null!!!
- See Also:
-
getSubjectsByIdentifiers
Description copied from interface:Source
Get subjects by identifiers. Note, if the subjects arent found or arent unique, they wont be returned. Identifiers are unique ways to refer to a subject that isnt its id (e.g. netid). Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdentifiers
in interfaceSource
- Returns:
- a map of results never null indexed by the identifiers
- See Also:
-
getSubjectsByIds
Description copied from interface:Source
Get subjects by ids. Note, if the subjects arent found or arent unique, they wont be returned. Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIds
in interfaceSource
- Returns:
- a map of results never null indexed by the id
- See Also:
-
getSubjectByIdOrIdentifier
public Subject getSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull) throws SubjectNotFoundException, SubjectNotUniqueException find by id or identifier- Specified by:
getSubjectByIdOrIdentifier
in interfaceSource
- Parameters:
idOrIdentifier
-exceptionIfNull
- if SubjectNotFoundException or null- Returns:
- the subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
-
getSubjectsByIdsOrIdentifiers
Description copied from interface:Source
Get subjects by ids or identifiers. Note, if the subjects arent found or arent unique, they wont be returned. Identifiers are unique ways to refer to a subject that isnt its id (e.g. netid). Duplicates are ok on the input, but will return one output.- Specified by:
getSubjectsByIdsOrIdentifiers
in interfaceSource
- Parameters:
idsOrIdentifiers
- each string could be a subject id or identifier- Returns:
- a map of results never null indexed by the id or identifier that was passed in. Note, the same subject could be returned twice if looked up by id and identifier (two inputs)
- See Also:
-
getId
Returns the ID of this source. -
setId
Sets the ID of this source. -
getName
Returns the name of this source. -
setName
Sets the name of this source. -
getSubjectTypes
Gets the SubjectTypes supported by this source.- Specified by:
getSubjectTypes
in interfaceSource
- Returns:
- set
-
getSubjectType
- Returns:
- subject type
-
getSubject
@Deprecated public abstract Subject getSubject(String id1) throws SubjectNotFoundException, SubjectNotUniqueException Deprecated.use the overload insteadDescription copied from interface:Source
Gets a Subject by its ID.- Specified by:
getSubject
in interfaceSource
- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubject
public Subject getSubject(String id1, boolean exceptionIfNull) throws SubjectNotFoundException, SubjectNotUniqueException Description copied from interface:Source
Gets a Subject by its ID.- Specified by:
getSubject
in interfaceSource
exceptionIfNull
- if SubjectNotFoundException should be throws if the subject is null, or if null should be returned- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectByIdentifier
@Deprecated public abstract Subject getSubjectByIdentifier(String id1) throws SubjectNotFoundException, SubjectNotUniqueException Deprecated.use the overload insteadDescription copied from interface:Source
Gets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.- Specified by:
getSubjectByIdentifier
in interfaceSource
- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String id1, boolean exceptionIfNull) throws SubjectNotFoundException, SubjectNotUniqueException note, you should implement this method since this implementation will become abstract at some point- Specified by:
getSubjectByIdentifier
in interfaceSource
- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
search
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema. Note if config param: throwErrorOnFindAllFailure is false, then swallow and log exceptions -
init
Called by SourceManager when it loads this source.- Specified by:
init
in interfaceSource
- Throws:
SourceUnavailableException
-
equals
Compares this source against the specified source. Returns true if the IDs of both sources are equal. -
hashCode
public int hashCode() -
addSubjectType
(non-javadoc)- Parameters:
type1
-
-
addInitParam
(non-javadoc)- Parameters:
name1
-value
-
-
removeInitParam
- Parameters:
name1
-
-
getInitParam
(non-javadoc)- Specified by:
getInitParam
in interfaceSource
- Parameters:
name1
-- Returns:
- param
-
initParams
(non-javadoc)- Specified by:
initParams
in interfaceSource
- Returns:
- params
-
addAttribute
- Parameters:
attributeName
-
-
addInternalAttribute
- Parameters:
attributeName
-
-
getAttributes
- Returns:
- set
-
getInternalAttributes
Description copied from interface:Source
Get a set of attributes that are marked as being internal attributes. Note, these will be in lower case- Specified by:
getInternalAttributes
in interfaceSource
- Returns:
- set
-
setSearches
- Parameters:
searches1
-
-
getSearches
- Returns:
- map
-
getSearch
- Parameters:
searchType
-- Returns:
- search
-
loadSearch
- Parameters:
search
-
-
setSubjectIdentifierAttributes
- Parameters:
subjectIdentifierAttributes
-
-
setSubjectIdentifierAttributesAll
- Parameters:
subjectIdentifierAttributesAll
-
-
setSortAttributes
- Parameters:
sortAttributes
-
-
setSearchAttributes
- Parameters:
searchAttributes
-
-
getSubjectIdentifierAttributes
Description copied from interface:Source
Get the names of attributes that are subject identifiers. This only returns the first- Specified by:
getSubjectIdentifierAttributes
in interfaceSource
- Returns:
- subject identifiers
- See Also:
-
getSubjectIdentifierAttributesAll
Description copied from interface:Source
Get all the names of attributes that are subject identifiers.- Specified by:
getSubjectIdentifierAttributesAll
in interfaceSource
- Returns:
- subject identifiers
- See Also:
-
getSortAttributes
Description copied from interface:Source
Get the names of attributes used for sorting.- Specified by:
getSortAttributes
in interfaceSource
- Returns:
- sort attributes in lower case
- See Also:
-
getSearchAttributes
Description copied from interface:Source
Get the names of attributes used for searching.- Specified by:
getSearchAttributes
in interfaceSource
- Returns:
- search attributes in lower case
- See Also:
-
isEditable
public boolean isEditable()- Specified by:
isEditable
in interfaceSource
- Returns:
- true if the source is editable otherwise false
-
getConfigId
- Specified by:
getConfigId
in interfaceSource
- Returns:
- configId for this source
-
setConfigId
Description copied from interface:Source
set config id for this source- Specified by:
setConfigId
in interfaceSource
-
isEnabled
public boolean isEnabled() -
virtualAttributesForSource
get the ordered list of virtual attributes for a source (new style)- Parameters:
source
-- Returns:
- the ordered list
-
virtualAttributesForSourceLegacy
get the ordered list of virtual attributes for a source- Parameters:
source
-- Returns:
- the ordered list
-
virtualAttributeVariablesForSourceLegacy
get the ordered list of virtual attributes for a source- Parameters:
source
-- Returns:
- the ordered list
-