edu.internet2.middleware.subject.provider
Class BaseSourceAdapter

java.lang.Object
  extended by edu.internet2.middleware.subject.provider.BaseSourceAdapter
All Implemented Interfaces:
Source
Direct Known Subclasses:
GrouperSourceAdapter, InternalSourceAdapter, JDBCSourceAdapter, JNDISourceAdapter, NullSourceAdapter

public abstract class BaseSourceAdapter
extends Object
implements Source

 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.
 
 


Constructor Summary
BaseSourceAdapter()
          Default constructor.
BaseSourceAdapter(String id1, String name1)
          Allocates adapter with ID and name.
 
Method Summary
 void addAttribute(String attributeName)
           
 void addInitParam(String name1, String value)
          (non-javadoc)
 void addSubjectType(String type1)
          (non-javadoc)
 boolean equals(Object other)
          Compares this source against the specified source.
 String getId()
          Returns the ID of this source.
 String getInitParam(String name1)
          (non-javadoc)
 Properties getInitParams()
          (non-javadoc)
 String getName()
          Returns the name of this source.
abstract  Subject getSubject(String id1)
          Deprecated. use the overload instead
 Subject getSubject(String id1, boolean exceptionIfNull)
          Gets a Subject by its ID.
abstract  Subject getSubjectByIdentifier(String id1)
          Deprecated. use the overload instead
 Subject getSubjectByIdentifier(String id1, boolean exceptionIfNull)
          note, you should implement this method since this implementation will become abstract at some point
 Subject getSubjectByIdOrIdentifier(String idOrIdentifier, boolean exceptionIfNull)
          find by id or identifier
 Map<String,Subject> getSubjectsByIdentifiers(Collection<String> identifiers)
          Get subjects by identifiers.
 Map<String,Subject> getSubjectsByIds(Collection<String> ids)
          Get subjects by ids.
 Map<String,Subject> getSubjectsByIdsOrIdentifiers(Collection<String> idsOrIdentifiers)
          Get subjects by ids or identifiers.
 SubjectType getSubjectType()
           
 Set<SubjectType> getSubjectTypes()
          Gets the SubjectTypes supported by this source.
 int hashCode()
           
abstract  void init()
          Called by SourceManager when it loads this source.
 void loadSearch(Search search)
           
abstract  Set<Subject> search(String searchValue)
          Unstructured search for Subjects.
 void setId(String id1)
          Sets the ID of this source.
 void setName(String name1)
          Sets the name of this source.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.internet2.middleware.subject.Source
checkConfig, printConfig
 

Constructor Detail

BaseSourceAdapter

public BaseSourceAdapter()
Default constructor.


BaseSourceAdapter

public BaseSourceAdapter(String id1,
                         String name1)
Allocates adapter with ID and name.

Parameters:
id1 -
name1 -
Method Detail

getSubjectsByIdentifiers

public Map<String,Subject> getSubjectsByIdentifiers(Collection<String> identifiers)
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 interface Source
Returns:
a map of results never null indexed by the identifiers
See Also:
Source.getSubjectsByIdentifiers(java.util.Collection)

getSubjectsByIds

public Map<String,Subject> getSubjectsByIds(Collection<String> ids)
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 interface Source
Returns:
a map of results never null indexed by the id
See Also:
Source.getSubjectsByIds(java.util.Collection)

getSubjectByIdOrIdentifier

public Subject getSubjectByIdOrIdentifier(String idOrIdentifier,
                                          boolean exceptionIfNull)
                                   throws SubjectNotFoundException,
                                          SubjectNotUniqueException
find by id or identifier

Specified by:
getSubjectByIdOrIdentifier in interface Source
Parameters:
idOrIdentifier -
exceptionIfNull - if SubjectNotFoundException or null
Returns:
the subject
Throws:
SubjectNotFoundException
SubjectNotUniqueException

getSubjectsByIdsOrIdentifiers

public Map<String,Subject> getSubjectsByIdsOrIdentifiers(Collection<String> idsOrIdentifiers)
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 interface Source
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:
Source.getSubjectsByIdsOrIdentifiers(java.util.Collection)

getId

public String getId()
Returns the ID of this source.

Specified by:
getId in interface Source
Returns:
id

setId

public void setId(String id1)
Sets the ID of this source.

Specified by:
setId in interface Source

getName

public String getName()
Returns the name of this source.

Specified by:
getName in interface Source
Returns:
name

setName

public void setName(String name1)
Sets the name of this source.

Specified by:
setName in interface Source

getSubjectTypes

public Set<SubjectType> getSubjectTypes()
Gets the SubjectTypes supported by this source.

Specified by:
getSubjectTypes in interface Source
Returns:
set

getSubjectType

public SubjectType getSubjectType()
Returns:
subject type

getSubject

@Deprecated
public abstract Subject getSubject(String id1)
                            throws SubjectNotFoundException,
                                   SubjectNotUniqueException
Deprecated. use the overload instead

Description copied from interface: Source
Gets a Subject by its ID.

Specified by:
getSubject in interface Source
Returns:
subject
Throws:
SubjectNotFoundException
SubjectNotUniqueException
See Also:
Source.getSubject(java.lang.String)

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 interface Source
exceptionIfNull - if SubjectNotFoundException should be throws if the subject is null, or if null should be returned
Returns:
subject
Throws:
SubjectNotFoundException
SubjectNotUniqueException
See Also:
Source.getSubject(java.lang.String, boolean)

getSubjectByIdentifier

@Deprecated
public abstract Subject getSubjectByIdentifier(String id1)
                                        throws SubjectNotFoundException,
                                               SubjectNotUniqueException
Deprecated. use the overload instead

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 interface Source
Returns:
subject
Throws:
SubjectNotFoundException
SubjectNotUniqueException
See Also:
Source.getSubjectByIdentifier(java.lang.String)

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 interface Source
Returns:
subject
Throws:
SubjectNotFoundException
SubjectNotUniqueException
See Also:
Source.getSubjectByIdentifier(java.lang.String, boolean)

search

public abstract Set<Subject> search(String searchValue)
Unstructured search for Subjects. Each implementation utilizes its own search algorithm tailored to the Subject repository and schema.

Specified by:
search in interface Source
Returns:
set

init

public abstract void init()
                   throws SourceUnavailableException
Called by SourceManager when it loads this source.

Specified by:
init in interface Source
Throws:
SourceUnavailableException

equals

public boolean equals(Object other)
Compares this source against the specified source. Returns true if the IDs of both sources are equal.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

addSubjectType

public void addSubjectType(String type1)
(non-javadoc)

Parameters:
type1 -

addInitParam

public void addInitParam(String name1,
                         String value)
(non-javadoc)

Parameters:
name1 -
value -

getInitParam

public String getInitParam(String name1)
(non-javadoc)

Specified by:
getInitParam in interface Source
Parameters:
name1 -
Returns:
param

getInitParams

public Properties getInitParams()
(non-javadoc)

Specified by:
getInitParams in interface Source
Returns:
params

addAttribute

public void addAttribute(String attributeName)
Parameters:
attributeName -

loadSearch

public void loadSearch(Search search)
Parameters:
search -