Package edu.internet2.middleware.subject
Class LazySource
java.lang.Object
edu.internet2.middleware.subject.LazySource
- All Implemented Interfaces:
Source
,Serializable
if the id or sources might not be known, dont resolve until you need it
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
make sure the config is ok, and log descriptive errors if notconvertSourceAttributeToSubjectAttribute
(String nameOfSourceAttribute) convertSubjectAttributeToSourceAttribute
(String nameOfSubjectAttribute) getId()
Returns the ID of this source.getInitParam
(String name1) get the init param e.g.Get a set of attributes that are marked as being internal attributes.getName()
Returns the name of this source.Get the names of attributes used for searching.Get the names of attributes used for sorting.getSubject
(String id) Gets a Subject by its ID.getSubject
(String id, boolean exceptionIfNull) Gets a Subject by its ID.getSubject
(String id, boolean exceptionIfNull, String realm) Gets a Subject by its ID.Gets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.getSubjectByIdentifier
(String id, boolean exceptionIfNull) Gets a Subject by other well-known identifiers, aside from the subject ID, for example, login ID.getSubjectByIdentifier
(String id, 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 identifier.getSubjectByIdOrIdentifier
(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.id of underlying sourcevoid
init()
Called by SourceManager when it loads this source.get the init params e.g.boolean
boolean
void
start logging the source low level actionsstop logging and get the outputin the startup on this i2mi app, print helpful and brief info about this sourceget 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
setUnderlyingSourceId
(String sourceId1) id of underlying source
-
Constructor Details
-
LazySource
public LazySource()default constructor -
LazySource
construct with source id- Parameters:
theSourceId
-
-
-
Method Details
-
loggingStart
public void loggingStart()Description copied from interface:Source
start logging the source low level actions- Specified by:
loggingStart
in interfaceSource
-
loggingStop
Description copied from interface:Source
stop logging and get the output- Specified by:
loggingStop
in interfaceSource
-
retrieveAllSubjectIds
Description copied from interface:Source
get all subject ids- Specified by:
retrieveAllSubjectIds
in interfaceSource
- Returns:
- all subjectIds
- 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:
-
getUnderlyingSourceId
id of underlying source- Returns:
- the sourceId
-
setUnderlyingSourceId
id of underlying source- Parameters:
sourceId1
- the sourceId to set
-
getSource
- Returns:
- source
-
checkConfig
public void checkConfig()Description copied from interface:Source
make sure the config is ok, and log descriptive errors if not- Specified by:
checkConfig
in interfaceSource
- See Also:
-
getId
Description copied from interface:Source
Returns the ID of this source. -
getName
Description copied from interface:Source
Returns the name of this source. -
getSubject
Description copied from interface:Source
Gets a Subject by its ID.- Specified by:
getSubject
in interfaceSource
- Parameters:
id
-- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
-
getSubject
public Subject getSubject(String id, 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:
-
getSubjectByIdOrIdentifier
public Subject getSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull) 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 null- Returns:
- the subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String id) 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
- Parameters:
id
-- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String id, boolean exceptionIfNull) 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
- Returns:
- subject
- Throws:
SubjectNotFoundException
SubjectNotUniqueException
- See Also:
-
getSubjectTypes
Description copied from interface:Source
Gets the SubjectTypes supported by this source.- Specified by:
getSubjectTypes
in interfaceSource
- Returns:
- set
- 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:
-
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:
-
init
Description copied from interface:Source
Called by SourceManager when it loads this source.- Specified by:
init
in interfaceSource
- Throws:
SourceUnavailableException
- See Also:
-
printConfig
Description copied from interface:Source
in the startup on this i2mi app, print helpful and brief info about this source- Specified by:
printConfig
in interfaceSource
- Returns:
- the info
- See Also:
-
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:
-
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 -
setId
Description copied from interface:Source
Sets the ID of this source. -
setName
Description copied from interface:Source
Sets the name of this source. -
getInitParam
Description copied from interface:Source
get the init param e.g. from the subject.properties- Specified by:
getInitParam
in interfaceSource
- Returns:
- param
- See Also:
-
initParams
Description copied from interface:Source
get the init params e.g. from the subject.properties- Specified by:
initParams
in interfaceSource
- Returns:
- params
- See Also:
-
edu.internet2.middleware.subject.Source#getInitParams()
-
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:
-
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:
-
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 to lower case
- See Also:
-
getSubject
public Subject getSubject(String id, 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:
-
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:
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String id, 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:
-
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:
-
isEditable
public boolean isEditable()- Specified by:
isEditable
in interfaceSource
- Returns:
- true if the source is editable otherwise false
-
isEnabled
public boolean isEnabled() -
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
-
convertSubjectAttributeToSourceAttribute
- Specified by:
convertSubjectAttributeToSourceAttribute
in interfaceSource
-
convertSourceAttributeToSubjectAttribute
- Specified by:
convertSourceAttributeToSubjectAttribute
in interfaceSource
-