edu.internet2.middleware.grouper
Class GrouperSourceAdapter

java.lang.Object
  extended by edu.internet2.middleware.subject.provider.BaseSourceAdapter
      extended by edu.internet2.middleware.grouper.GrouperSourceAdapter
All Implemented Interfaces:
Source

public class GrouperSourceAdapter
extends BaseSourceAdapter

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 sources.xml 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 $
Author:
blair christensen.

Constructor Summary
GrouperSourceAdapter()
          Allocates new GrouperSourceAdapter.
GrouperSourceAdapter(String id, String name)
          Allocates new GrouperSourceAdapter.
 
Method Summary
 void checkConfig()
          make sure the config is ok, and log descriptive errors if not
 Subject getSubject(String id)
          Deprecated. 
 Subject getSubject(String id, boolean exceptionIfNotFound)
          Get a Group subject by UUID.
 Subject getSubjectByIdentifier(String name)
          Deprecated. 
 Subject getSubjectByIdentifier(String name, boolean exceptionIfNull)
          Gets a Group subject by its name.
 Set getSubjectTypes()
          Gets the SubjectTypes supported by this source.
 void init()
          Initializes the Grouper source adapter.
 String printConfig()
          in the startup on this i2mi app, print helpful and brief info about this source
 Set<Subject> search(String searchValue)
          Searches for Group subjects by naming attributes.
 
Methods inherited from class edu.internet2.middleware.subject.provider.BaseSourceAdapter
addAttribute, addInitParam, addSubjectType, equals, getId, getInitParam, getInitParams, getName, getSubjectByIdOrIdentifier, getSubjectsByIdentifiers, getSubjectsByIds, getSubjectsByIdsOrIdentifiers, getSubjectType, hashCode, loadSearch, setId, setName
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrouperSourceAdapter

public GrouperSourceAdapter()
Allocates new GrouperSourceAdapter.


GrouperSourceAdapter

public GrouperSourceAdapter(String id,
                            String name)
Allocates new GrouperSourceAdapter.

Method Detail

getSubject

@Deprecated
public Subject getSubject(String id)
                   throws SubjectNotFoundException
Deprecated. 

Get a Group 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 interface Source
Specified by:
getSubject in class BaseSourceAdapter
Parameters:
id - Group UUID
Returns:
A Subject
Throws:
SubjectNotFoundException
See Also:
Source.getSubject(java.lang.String)

getSubject

public Subject getSubject(String id,
                          boolean exceptionIfNotFound)
                   throws SubjectNotFoundException
Get a Group 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 interface Source
Overrides:
getSubject in class BaseSourceAdapter
Parameters:
id - Group UUID
exceptionIfNotFound -
Returns:
A Subject
Throws:
SubjectNotFoundException
See Also:
Source.getSubject(java.lang.String, boolean)

getSubjectByIdentifier

@Deprecated
public Subject getSubjectByIdentifier(String name)
                               throws SubjectNotFoundException
Deprecated. 

Gets a Group 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 interface Source
Specified by:
getSubjectByIdentifier in class BaseSourceAdapter
Parameters:
name - Group name
Returns:
A Subject
Throws:
SubjectNotFoundException
See Also:
Source.getSubjectByIdentifier(java.lang.String)

getSubjectByIdentifier

public Subject getSubjectByIdentifier(String name,
                                      boolean exceptionIfNull)
                               throws SubjectNotFoundException
Gets a Group 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 interface Source
Overrides:
getSubjectByIdentifier in class BaseSourceAdapter
Parameters:
name - Group name
exceptionIfNull -
Returns:
A Subject
Throws:
SubjectNotFoundException
See Also:
Source.getSubjectByIdentifier(java.lang.String, boolean)

getSubjectTypes

public Set getSubjectTypes()
Gets the SubjectTypes supported by this source.
 SourceAdapter  sa    = new GrouperSourceAdapter();
 Set            types = sa.getSubjectTypes();
 

Specified by:
getSubjectTypes in interface Source
Overrides:
getSubjectTypes in class BaseSourceAdapter
Returns:
Subject types supported by this source.

init

public void init()
          throws SourceUnavailableException
Initializes the Grouper source adapter.

No initialization is currently performed by this adapter.

Specified by:
init in interface Source
Specified by:
init in class BaseSourceAdapter
Throws:
SourceUnavailableException

search

public Set<Subject> search(String searchValue)
                    throws IllegalArgumentException
Searches for Group subjects by naming attributes.

This method performs a fuzzy search on the stem, extension, displayExtension, name and displayName group attributes.

 // Use it within the Grouper API
 Set subjects = SubjectFactory.search("admins");

 // Use it directly
 Set subjects = source.search("admins");
 

Specified by:
search in interface Source
Specified by:
search in class BaseSourceAdapter
Returns:
set
Throws:
IllegalArgumentException - if searchValue is null.

checkConfig

public void checkConfig()
Description copied from interface: Source
make sure the config is ok, and log descriptive errors if not

See Also:
Source.checkConfig()

printConfig

public String 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:
Source.printConfig()