org.sakaiproject.component.legacy.user
Class SampleUserDirectoryProvider

java.lang.Object
  extended byorg.sakaiproject.component.legacy.user.SampleUserDirectoryProvider
All Implemented Interfaces:
UserDirectoryProvider, UsersShareEmailUDP

public class SampleUserDirectoryProvider
extends Object
implements UserDirectoryProvider, UsersShareEmailUDP

SampleUserDirectoryProvider is a samaple UserDirectoryProvider.

Version:
$Revision: 3865 $
Author:
University of Michigan, Sakai Software Development Team

Nested Class Summary
protected  class SampleUserDirectoryProvider.Info
           
 
Field Summary
protected  Hashtable m_info
          A collection of user ids/names.
 
Constructor Summary
SampleUserDirectoryProvider()
          Construct.
 
Method Summary
 boolean authenticateUser(String userId, UserEdit edit, String password)
          Authenticate a user / password.
 boolean authenticateWithProviderFirst(String id)
          Whether to check provider or internal data first when authenticating a user
 boolean createUserRecord(String id)
          If user record cannot be found in by UserDirectoryService, can the service create the user record?
 void destroy()
          Returns to uninitialized state.
 void destroyAuthentication()
          Remove any authentication traces for the current user / request
 boolean findUserByEmail(UserEdit edit, String email)
          Find a user object who has this email address.
 Collection findUsersByEmail(String email, UserFactory factory)
          Find all user objects which have this email address.
 boolean getUser(UserEdit edit)
          Access a user object.
 void getUsers(Collection users)
          Access a collection of UserEdit objects; if the user is found, update the information, otherwise remove the UserEdit object from the collection.
 void init()
          Final initialization, once all dependencies are set.
 boolean updateUserAfterAuthentication()
          Will this provider update user records on successfull authentication?
 boolean userExists(String userId)
          See if a user by this id exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_info

protected Hashtable m_info
A collection of user ids/names.

Constructor Detail

SampleUserDirectoryProvider

public SampleUserDirectoryProvider()
Construct.

Method Detail

init

public void init()
Final initialization, once all dependencies are set.


destroy

public void destroy()
Returns to uninitialized state. You can use this method to release resources thet your Service allocated when Turbine shuts down.


userExists

public boolean userExists(String userId)
See if a user by this id exists.

Specified by:
userExists in interface UserDirectoryProvider
Parameters:
userId - The user id string.
Returns:
true if a user by this id exists, false if not.

getUser

public boolean getUser(UserEdit edit)
Access a user object. Update the object with the information found.

Specified by:
getUser in interface UserDirectoryProvider
Parameters:
edit - The user object (id is set) to fill in.
Returns:
true if the user object was found and information updated, false if not.

getUsers

public void getUsers(Collection users)
Access a collection of UserEdit objects; if the user is found, update the information, otherwise remove the UserEdit object from the collection.

Specified by:
getUsers in interface UserDirectoryProvider
Parameters:
users - The UserEdit objects (with id set) to fill in or remove.

findUserByEmail

public boolean findUserByEmail(UserEdit edit,
                               String email)
Find a user object who has this email address. Update the object with the information found.
Note: this method won't be used, because we are a UsersShareEmailUPD.
This is the sort of method to provide if your external source has only a single user for any email address.

Specified by:
findUserByEmail in interface UserDirectoryProvider
Parameters:
email - The email address string.
Returns:
true if the user object was found and information updated, false if not.

findUsersByEmail

public Collection findUsersByEmail(String email,
                                   UserFactory factory)
Find all user objects which have this email address.

Specified by:
findUsersByEmail in interface UsersShareEmailUDP
Parameters:
email - The email address string.
factory - Use this factory's newUser() method to create all the UserEdit objects you populate and return in the return collection.
Returns:
Collection (UserEdit) of user objects that have this email address, or an empty Collection if there are none.

authenticateUser

public boolean authenticateUser(String userId,
                                UserEdit edit,
                                String password)
Authenticate a user / password. If the user edit exists it may be modified, and will be stored if...

Specified by:
authenticateUser in interface UserDirectoryProvider
Parameters:
edit - The UserEdit matching the id to be authenticated (and updated) if we have one.
password - The password.
userId - The user id.
Returns:
true if authenticated, false if not.

updateUserAfterAuthentication

public boolean updateUserAfterAuthentication()
Will this provider update user records on successfull authentication? If so, the UserDirectoryService will cause these updates to be stored.

Specified by:
updateUserAfterAuthentication in interface UserDirectoryProvider
Returns:
true if the user record may be updated after successfull authentication, false if not.

destroyAuthentication

public void destroyAuthentication()
Remove any authentication traces for the current user / request

Specified by:
destroyAuthentication in interface UserDirectoryProvider

authenticateWithProviderFirst

public boolean authenticateWithProviderFirst(String id)
Whether to check provider or internal data first when authenticating a user

Specified by:
authenticateWithProviderFirst in interface UserDirectoryProvider
Returns:
true if provider data is checked first, false if otherwise

createUserRecord

public boolean createUserRecord(String id)
If user record cannot be found in by UserDirectoryService, can the service create the user record?

Specified by:
createUserRecord in interface UserDirectoryProvider