airline
Class User

java.lang.Object
  extended by airline.User
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Administrator, Customer

public abstract class User
extends Object
implements Serializable

Represents a registered user for the airline system.

Author:
Michael Goldwasser
See Also:
Serialized Form

Field Summary
(package private)  String ID
          Unique ID for system User
(package private)  String password
          Password for the user
 
Constructor Summary
protected User(String userID, String pwd)
          Creates a new User instance with given credentials.
 
Method Summary
abstract  UserSession getSession(Connection connection)
          A factory function producing an appropriate UserSession for this user.
 String getUserID()
          Returns this customer's unique user ID
 boolean verifyPassword(String attempt)
          Compares a given password attempt to the underlying password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

String ID
Unique ID for system User


password

String password
Password for the user

Constructor Detail

User

protected User(String userID,
               String pwd)
Creates a new User instance with given credentials.

Parameters:
userID - A unique userID
pwd - The password for that user
Method Detail

getSession

public abstract UserSession getSession(Connection connection)
A factory function producing an appropriate UserSession for this user.

Returns:
the new UserSession.

getUserID

public String getUserID()
Returns this customer's unique user ID


verifyPassword

public boolean verifyPassword(String attempt)
Compares a given password attempt to the underlying password.

Parameters:
attempt - a potential match for the password
Returns:
true if parameter matches the password; false otherwise.