|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsg.edu.nus.peer.Session
public class Session
Implement a session during a user login the system. For each user, there exists an unique session. After logout the system, the session will be deleted.
This class is a singleton class. That is, for a user we do not allow the user to switch to another role during his own session.
NOTE: In the future, the password should be encrypted.
Method Summary | |
---|---|
static void |
clear()
Clear the current session. |
static Session |
getInstance()
Get the instance of the session. |
static Session |
getInstance(java.lang.String userID,
java.lang.String pwd)
Get the instance of the session. |
java.lang.String |
getPassword()
Get the password of the user. |
java.lang.String |
getUserID()
Get the identifier of the user. |
static boolean |
hasInstance()
Determine if the session has already been created. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Session getInstance(java.lang.String userID, java.lang.String pwd)
userID
- the identifier of the userpwd
- the password of the userpublic static Session getInstance() throws java.lang.RuntimeException
java.lang.RuntimeException
- if instance cannot be foundpublic static boolean hasInstance()
false
;
otherwise, return true
public static void clear()
public java.lang.String getUserID()
public java.lang.String getPassword()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |