ibspan.tss.agents.sha.session
Class Session

java.lang.Object
  extended by ibspan.tss.agents.sha.session.Session

public class Session
extends Object

This class represent Session concept to setup multi-stepped interaction with the user. Each session is assiociated with Session.SessionData. Each session is identified by sessionID generated on the base of peerID (usually IP of the user machine), current time and pseudo-random numberSince, since there can be many independent sessions started from one machine.

Author:
Maciej Gawinecki

Nested Class Summary
 class Session.SessionData
          This class simply do notihngs, but extends map and can be used in the future for providing additional functionality for operating on session data.
 
Constructor Summary
Session(String peerID)
          Constructs the session object on the base of the given peerID
 
Method Summary
 Session.SessionData getData()
          Returns the data bound with this session.
 String getPeerID()
          Returns ID of the machine, at which the user connects with the system, usually IP number.
 String getSessionID()
          Returns unique ID of this session.
 Date getStartTime()
          Returns the time, at which this session was started.
 Date getUpdateTime()
          Determines the last moment the systems accessed this object.
 long getUserID()
          Returns ID of the logged user.
 boolean isLoggedIn()
          Checks whether logged in this session and is still logged.
 void loginUser(int userID)
           
 void logoutUser()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Session

public Session(String peerID)
Constructs the session object on the base of the given peerID

Parameters:
peerID - is unique ID of the machine, at which the user connects with the system, usually IP number.
Method Detail

getPeerID

public String getPeerID()
Returns ID of the machine, at which the user connects with the system, usually IP number.

Returns:
user's machine ID.

getUserID

public long getUserID()
Returns ID of the logged user.

Returns:
ID of the user, if logged in this session; otherwise - ViewParams.UNKNOWN_USER_ID.

getSessionID

public String getSessionID()
Returns unique ID of this session.

Returns:
session ID.

getStartTime

public Date getStartTime()
Returns the time, at which this session was started.

Returns:
the start time.

getUpdateTime

public Date getUpdateTime()
Determines the last moment the systems accessed this object. Could be used to remove dead sessions or log out the user after certain time-out period.

Returns:
the last update time.

isLoggedIn

public boolean isLoggedIn()
Checks whether logged in this session and is still logged.

Returns:
true if user is logged in.

getData

public Session.SessionData getData()
Returns the data bound with this session.

Returns:
session data.

loginUser

public void loginUser(int userID)

logoutUser

public void logoutUser()