apollo.Session
Class SessionManager

java.lang.Object
  |
  +--apollo.Session.SessionManager
All Implemented Interfaces:
java.io.Serializable

public class SessionManager
extends java.lang.Object
implements java.io.Serializable

This is the SessionManager. It provides the managing services of the persistant WebSession objects. It will issues, expires, returns session information. It supports POST and GET. COOKIES are not implemented. The sessions can be made persistant between server start and stop cycles using the provided serialization methods.

See Also:
Serialized Form

Constructor Summary
SessionManager(ManagerTracker MT, int timeout, boolean logoutDup)
          The initializer for the SessionManger.
SessionManager(ManagerTracker MT, int timeout, boolean logoutDup, java.lang.String sessionFilename)
          Initializes the sessionManager, will attempt to read serialized sessions off disk.
 
Method Summary
 void destroy()
          This serializes the sessions to disk.
 int getDefaultTimeout()
           
 WebSession getSession(java.lang.String sessionID)
          This retrives the session object.
 WebSession getSession(java.lang.String sessionID, boolean returnInvalid)
          This retrives the session object.
 java.util.Enumeration getSessions()
           
 WebSession newSession()
           
 WebSession newSession(int timeout)
           
 WebSession newSession(java.lang.String username)
           
 WebSession newSession(java.lang.String username, int timeout)
           
 void remoteNewSession(java.lang.String username, int timeout, WebSession thisSession)
           
 void serialize()
           
 void setDefaultTimeout(int i)
          This sets the default Timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionManager

public SessionManager(ManagerTracker MT,
                      int timeout,
                      boolean logoutDup)
The initializer for the SessionManger. This must be called before you can access the SessionManager.
Parameters:
timeout - The default maximum number of seconds that can elapse between transactions before session expiration
logoutDup - If true will expire sessions for existing userIDs in the database, false will ignore duplicates

SessionManager

public SessionManager(ManagerTracker MT,
                      int timeout,
                      boolean logoutDup,
                      java.lang.String sessionFilename)
Initializes the sessionManager, will attempt to read serialized sessions off disk. If the sessions are corrupt or missing, blank tables will be used.
Parameters:
timeout - The default maximum number of seconds that can elapse between transactions before session expiration
sessionFilename - The filename which should be used to read serialized sessions from disk
logoutDup - If true will expire sessions for existing userIDs in the database, false will ignore duplicates
Method Detail

setDefaultTimeout

public void setDefaultTimeout(int i)
This sets the default Timeout. Which is the maximum number of seconds which may elapse before the session becomes expired.
Parameters:
i - Number of seconds for the default Timeout

getDefaultTimeout

public int getDefaultTimeout()
Returns:
Default Timeout

destroy

public void destroy()
This serializes the sessions to disk. This should normally be called any time the boat is going down. Fortunatly with servlets this is usually only in destroy().

serialize

public void serialize()
               throws java.io.IOException

getSession

public WebSession getSession(java.lang.String sessionID)
                      throws InvalidSessionID,
                             SessionExpired
This retrives the session object. If it does not exist or is invalid, an exception is thrown
Parameters:
sessionID - The sessionID of the session you want returned
Returns:
WebSession The current Session
Throws:
InvalidSessionID - The sessionID was not in the database
SessionExpired - The Session was expired

getSession

public WebSession getSession(java.lang.String sessionID,
                             boolean returnInvalid)
                      throws InvalidSessionID,
                             SessionExpired
This retrives the session object. It will throw an exception if the session does not exist, and will throw an exception if returnInvalid is false
Parameters:
sessionID - The sessionID of the session you want returned
returnInvalid - Will return invalid sessions without an exception
Returns:
WebSession The current Session
Throws:
InvalidSessionID - The sessionID was not in the database
SessionExpired - The Session was expired

newSession

public WebSession newSession(java.lang.String username,
                             int timeout)

newSession

public WebSession newSession(int timeout)

newSession

public WebSession newSession(java.lang.String username)

newSession

public WebSession newSession()

remoteNewSession

public void remoteNewSession(java.lang.String username,
                             int timeout,
                             WebSession thisSession)

getSessions

public java.util.Enumeration getSessions()