Package edu.internet2.middleware.grouper
Class GrouperSourceAdapter
java.lang.Object
edu.internet2.middleware.subject.provider.BaseSourceAdapter
edu.internet2.middleware.grouper.GrouperSourceAdapter
- All Implemented Interfaces:
Source
- Direct Known Subclasses:
EntitySourceAdapter
Source adapter for using Grouper groups as I2MI Subjects.
This is an adapter I2MI Subjects of type group. It allows groups within a Group Groups Registry to be referenced as I2MI Subjects.
To use, add the following to your subject.properties file:
<source adapterClass="edu.internet2.middleware.grouper.GrouperSourceAdapter"> <id>g:gsa</id> <name>Grouper: Grouper Source Adapter</name> <type>group</type> </source>
- Version:
- $Id: GrouperSourceAdapter.java,v 1.31 2009-08-12 04:52:21 mchyzer Exp $
-
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
for testing if we should fail on testingFields inherited from class edu.internet2.middleware.subject.provider.BaseSourceAdapter
attributes, descriptionAttributeName, id, internalAttributes, name, nameAttributeName, params, searchAttributes, searches, sortAttributes, subjectIdentifierAttributes, subjectIdentifierAttributesAll, type, types
-
Constructor Summary
ConstructorDescriptionAllocates new GrouperSourceAdapter.GrouperSourceAdapter
(String id, String name) Allocates new GrouperSourceAdapter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
make sure the config is ok, and log descriptive errors if notstatic void
put this in a finally block to clear that we are searching for groups with certain privilegesmax Page sizegetSubject
(String id) Deprecated.getSubject
(String id, boolean exceptionIfNotFound) Get aGroup
subject by UUID.getSubjectByIdentifier
(String name) Deprecated.getSubjectByIdentifier
(String name, boolean exceptionIfNull) Gets aGroup
subject by its name.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.getSubjectsByIds
(Collection<String> ids) Get subjects by ids.Gets the SubjectTypes supported by this source.static String
return the group source idvoid
init()
Initializes the Grouper source adapter.static GrouperSession
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.static boolean
if searching for groups with read privilegestatic void
searchForGroupsWithReadPrivilege
(boolean searchForRead) when doing a subject search, search for groups with privilegessearchPage
(String searchValue) Unstructured search for Subjects.type of groups to search onMethods inherited from class edu.internet2.middleware.subject.provider.BaseSourceAdapter
addAttribute, addInitParam, addInternalAttribute, addSubjectType, attributeNameToViewerGroupName, convertSourceAttributeToSubjectAttribute, convertSubjectAttributeToSourceAttribute, createSubject, equals, exportLabelToAttributeName, getAttributes, getConfigId, getId, getInitParam, getInternalAttributes, getName, getSearch, getSearchAttributes, getSearches, getSortAttributes, getSourceAttributesToLowerCase, getSubject, getSubjectByIdentifier, getSubjectByIdOrIdentifier, getSubjectByIdOrIdentifier, getSubjectsByIdentifiers, getSubjectsByIds, getSubjectsByIdsOrIdentifiers, getSubjectsByIdsOrIdentifiers, getSubjectStatusConfig, getSubjectType, hashCode, initParams, isEditable, isEnabled, loadSearch, removeInitParam, resultSetLimit, search, searchPage, setConfigId, setId, setName, setSearchAttributes, setSearches, setSortAttributes, setSubjectIdentifierAttributes, setSubjectIdentifierAttributesAll, virtualAttributesForSource, virtualAttributesForSourceLegacy, virtualAttributeVariablesForSourceLegacy
-
Field Details
-
failOnSearchForTesting
public static boolean failOnSearchForTestingfor testing if we should fail on testing
-
-
Constructor Details
-
GrouperSourceAdapter
public GrouperSourceAdapter()Allocates new GrouperSourceAdapter. -
GrouperSourceAdapter
Allocates new GrouperSourceAdapter.- Parameters:
id
-name
-
-
-
Method Details
-
loggingStart
public void loggingStart()Description copied from interface:Source
start logging the source low level actions -
loggingStop
Description copied from interface:Source
stop logging and get the output -
retrieveAllSubjectIds
Description copied from interface:Source
get all subject ids- Specified by:
retrieveAllSubjectIds
in interfaceSource
- Overrides:
retrieveAllSubjectIds
in classBaseSourceAdapter
- Returns:
- all subjectIds
- See Also:
-
searchForGroupsWithReadPrivilege
public static void searchForGroupsWithReadPrivilege(boolean searchForRead) when doing a subject search, search for groups with privileges- Parameters:
privileges1
-
-
searchForGroupsWithReadPrivilege
public static boolean searchForGroupsWithReadPrivilege()if searching for groups with read privilege- Returns:
- if searching
-
clearSearchForGroupsWithReadPrivilege
public static void clearSearchForGroupsWithReadPrivilege()put this in a finally block to clear that we are searching for groups with certain privileges -
getSubject
Deprecated.Get aGroup
subject by UUID.// Use it within the Grouper API try { Subject subj = SubjectFinder.getSubject(uuid, "group"); } catch (SubjectNotFoundException e) { // Subject not found } // Use it directly try { Subject subj = source.getSubject(uuid, "group"); } catch (SubjectNotFoundException e) { // Subject not found }
- Specified by:
getSubject
in interfaceSource
- Specified by:
getSubject
in classBaseSourceAdapter
- Parameters:
id
- Group UUID- Returns:
- A
Subject
- Throws:
SubjectNotFoundException
- See Also:
-
getSubject
Get aGroup
subject by UUID.// Use it within the Grouper API try { Subject subj = SubjectFinder.getSubject(uuid, "group"); } catch (SubjectNotFoundException e) { // Subject not found } // Use it directly try { Subject subj = source.getSubject(uuid, "group"); } catch (SubjectNotFoundException e) { // Subject not found }
- Specified by:
getSubject
in interfaceSource
- Overrides:
getSubject
in classBaseSourceAdapter
- Parameters:
id
- Group UUIDexceptionIfNotFound
-- Returns:
- A
Subject
- Throws:
SubjectNotFoundException
- See Also:
-
getSubjectByIdentifier
Deprecated.Gets aGroup
subject by its name.// Use it within the Grouper API try { Subject subj = SubjectFinder.getSubjectByIdentifier(name, "group"); } catch (SubjectNotFoundException e) { // Subject not found } // Use it directly try { Subject subj = source.getSubjectByIdentifier(name, "group"); } catch (SubjectNotFoundException e) { // Subject not found }
- Specified by:
getSubjectByIdentifier
in interfaceSource
- Specified by:
getSubjectByIdentifier
in classBaseSourceAdapter
- Parameters:
name
- Group name- Returns:
- A
Subject
- Throws:
SubjectNotFoundException
- 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
- Overrides:
getSubjectsByIdentifiers
in classBaseSourceAdapter
- 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
- Overrides:
getSubjectsByIds
in classBaseSourceAdapter
- Returns:
- a map of results never null indexed by the id
- See Also:
-
getSubjectByIdentifier
public Subject getSubjectByIdentifier(String name, boolean exceptionIfNull) throws SubjectNotFoundException Gets aGroup
subject by its name.// Use it within the Grouper API try { Subject subj = SubjectFinder.getSubjectByIdentifier(name, "group"); } catch (SubjectNotFoundException e) { // Subject not found } // Use it directly try { Subject subj = source.getSubjectByIdentifier(name, "group"); } catch (SubjectNotFoundException e) { // Subject not found }
- Specified by:
getSubjectByIdentifier
in interfaceSource
- Overrides:
getSubjectByIdentifier
in classBaseSourceAdapter
- Parameters:
name
- Group nameexceptionIfNull
-- Returns:
- A
Subject
- Throws:
SubjectNotFoundException
- See Also:
-
getSubjectTypes
Gets the SubjectTypes supported by this source.SourceAdapter sa = new GrouperSourceAdapter(); Set types = sa.getSubjectTypes();
- Specified by:
getSubjectTypes
in interfaceSource
- Overrides:
getSubjectTypes
in classBaseSourceAdapter
- Returns:
- Subject types supported by this source.
-
init
Initializes the Grouper source adapter.No initialization is currently performed by this adapter.
- Specified by:
init
in interfaceSource
- Specified by:
init
in classBaseSourceAdapter
- Throws:
SourceUnavailableException
-
groupSourceId
return the group source id- Returns:
- the source id for the group source
-
typeOfGroups
type of groups to search on- Returns:
- type of groups
-
internal_getSessionOrRootForSubjectFinder
- Returns:
- session
-
checkConfig
public void checkConfig()Description copied from interface:Source
make sure the config is ok, and log descriptive errors if not- See Also:
-
printConfig
Description copied from interface:Source
in the startup on this i2mi app, print helpful and brief info about this source- Returns:
- the info
- See Also:
-
getMaxPage
max Page size- Returns:
- the maxPage
-
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- Specified by:
search
in interfaceSource
- Specified by:
search
in classBaseSourceAdapter
- Returns:
- set
-
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
- Overrides:
searchPage
in classBaseSourceAdapter
- Returns:
- results and if there are too many, never return null!!!
- 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
- Overrides:
getSubjectIdentifierAttributes
in classBaseSourceAdapter
- 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
- Overrides:
getSubjectIdentifierAttributesAll
in classBaseSourceAdapter
- Returns:
- subject identifiers
- See Also:
-