edu.mssm.crover.scentral
Class UserDirectory_Serialization_Impl

java.lang.Object
  |
  +--edu.mssm.crover.scentral.UserDirectory_Serialization_Impl
All Implemented Interfaces:
UserDirectory

public class UserDirectory_Serialization_Impl
extends java.lang.Object
implements UserDirectory


Constructor Summary
UserDirectory_Serialization_Impl()
           
 
Method Summary
 UserRecord getRecord(java.lang.String recordID)
          Returns the record that match the given recordID, or null if none does.
 UserRecord getRecord(java.lang.String userID, java.lang.String password)
          Returns the record authentified by the userID and password.
 RestrictedUserRecord getRecordByEmail(java.lang.String email)
          Gets a restricted interface to the user record.
 void hasChanged(UserRecord record)
          Instructs this directory that the user record state has changed and need to be stored.
 void initialize(Log log)
          Reads the hastable from disk.
 boolean isRegistered(java.lang.String userID, java.lang.String password)
          Returns wether a record exists that match a userID and password.
 void register(java.lang.String userID, UserRecord record)
          Registers a user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDirectory_Serialization_Impl

public UserDirectory_Serialization_Impl()
Method Detail

initialize

public void initialize(Log log)
Reads the hastable from disk.

Specified by:
initialize in interface UserDirectory

getRecord

public UserRecord getRecord(java.lang.String userID,
                            java.lang.String password)
Description copied from interface: UserDirectory
Returns the record authentified by the userID and password.

Specified by:
getRecord in interface UserDirectory
Parameters:
userID - The user id for which the record is requested.
password - The password associated with the userID.

getRecord

public UserRecord getRecord(java.lang.String recordID)
Returns the record that match the given recordID, or null if none does. Unsuccessful attempts are logged.

Specified by:
getRecord in interface UserDirectory

isRegistered

public boolean isRegistered(java.lang.String userID,
                            java.lang.String password)
Description copied from interface: UserDirectory
Returns wether a record exists that match a userID and password.

Specified by:
isRegistered in interface UserDirectory

register

public void register(java.lang.String userID,
                     UserRecord record)
              throws BadUserID,
                     RegistrationFailure
Registers a user. Adds the user to the directory and saves the directory to disk.

Specified by:
register in interface UserDirectory
Throws:
BadUserID - Thrown when the userID is already used in this directory.
RegistrationFailure - Thrown when anything went wront during the storage of the user record in the directory.

hasChanged

public void hasChanged(UserRecord record)
Instructs this directory that the user record state has changed and need to be stored. This implementation saves all the record at once each time one record changed. This is not efficient, but this implementation is just a poor man solution...

Specified by:
hasChanged in interface UserDirectory

getRecordByEmail

public RestrictedUserRecord getRecordByEmail(java.lang.String email)
Gets a restricted interface to the user record. This form can only be used to send an email to the user telling him/her about his/her forgotten password. The restricted interface does not allow to obtain personnal information from the record.

Specified by:
getRecordByEmail in interface UserDirectory
Returns:
null when no such record is found, the restricted record otherwise.


Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.