blather.model
Class SessionDB

java.lang.Object
  extended by blather.model.SessionDB

public class SessionDB
extends java.lang.Object

SessionDB models a database of all current user sessions. It keeps provides a method to log a user in (generating a new session ID), a method to check if a session


Constructor Summary
SessionDB()
           
 
Method Summary
 boolean isSessionValid(java.lang.String sessionKey)
          Returns true if sessionKey corresponds to a valid session, false otherwise.
 java.lang.String login(BlatherUserInterface u)
           
 void logout(java.lang.String sessionKey)
          Removes the session with the given key from the database, logging this user out.
 BlatherUserInterface userForSession(java.lang.String sessionKey)
          Returns the BlatherUser associated with a given session key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionDB

public SessionDB()
Method Detail

userForSession

public BlatherUserInterface userForSession(java.lang.String sessionKey)
Returns the BlatherUser associated with a given session key. Precondition: sessionKey is a valid session key.

Parameters:
sessionKey - a session key string
Returns:
a reference to a BlatherUser

isSessionValid

public boolean isSessionValid(java.lang.String sessionKey)
Returns true if sessionKey corresponds to a valid session, false otherwise.

Parameters:
sessionKey - a session key string
Returns:
true if sessionKey corresponds to a valid session, false otherwise.

logout

public void logout(java.lang.String sessionKey)
Removes the session with the given key from the database, logging this user out.

Parameters:
sessionKey - a session key string

login

public java.lang.String login(BlatherUserInterface u)
Parameters:
u - a BlatherUserInterface reference, corresponding to the active user for this session
Returns: