de.kosi.session
Class ServerSessionInformation

java.lang.Object
  |
  +--de.kosi.session.ServerSessionInformation
All Implemented Interfaces:
java.rmi.Remote, SessionAdminInterface

public class ServerSessionInformation
extends java.lang.Object
implements SessionAdminInterface

This class contains the information about current sessions on the server.

ChangeLog:

 $Log: ServerSessionInformation.java,v $
 Revision 1.3  2001/06/04 14:21:10  jiriki
 Made source more comliant to coding guidelines.

 Revision 1.2  2001/05/22 10:16:03  jiriki
 - Removed old unused Client class
 - Removed unused import statements.

 Revision 1.1.1.1  2001/04/29 18:05:19  jiriki
 Imported sources from zola.

 Revision 1.14  2001/04/11 12:34:32  wombat
 jar files restructured.

 Revision 1.13  2001/04/08 17:07:12  wombat
 Account Erstellung eingebaut

 Revision 1.12  2001/03/23 10:48:52  wombat
 - Table now restarts game
 - began GuestUser implementation

 Revision 1.11  2001/03/20 18:17:31  wombat
 Added logging support

 Revision 1.10  2001/03/19 21:50:49  wombat
 - Worked on admin client.
 - improved shutdown sequence
 - removed bugs in login/logout sequence

 Revision 1.9  2001/03/15 19:31:51  wombat
 Updated Documentation

 

Version:
$Revision: 1.3 $ ($Date: 2001/06/04 14:21:10 $)
Author:
Jan-Ole Janssen, Niklas Mehner, Time Sticher

Method Summary
static void addSession(Session session, UserImpl user)
          Registers a session with the server.
static void doAsLocalUser(java.lang.Runnable runnable)
          Execute a Runnable as the local user.
static Session getSession()
          Returns the session assigned to the current thread.
 java.util.List getSessions()
          Returns a list of currently active sessions.
static UserImpl getUser()
          Returns the current User.
 UserImpl getUser(Session session)
          Returns the user for a session.
static void remove(Session session)
          Removes a session from the session map
 void removeSession(Session session)
          Removes a session.
static void setSession(Session session)
          Sets the session for the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addSession

public static void addSession(Session session,
                              UserImpl user)
Registers a session with the server. This method is called after the user has logged on and a new session has been created.
Parameters:
session - the new session.
user - the user the session is created for.

remove

public static void remove(Session session)
Removes a session from the session map
Parameters:
session - Session to remove.

setSession

public static void setSession(Session session)
Sets the session for the current thread. This method should only be called by KosiUnicastServerRef.
Parameters:
session - the session assigned to the current thread.

getSession

public static Session getSession()
                          throws InvalidSessionException
Returns the session assigned to the current thread. Null, if there is no session assigned to the thread.
Returns:
the current session.
Throws:
InvalidSessionException - when not called from within a valid session context.

getUser

public static UserImpl getUser()
                        throws InvalidSessionException
Returns the current User. This method can be used to determine the user, that caused a remote call to happen. All classes, that assign different permissions to users should use this method to get the current user.
Returns:
the current user.
Throws:
InvalidSessionException - when not called from within a valid session context.

getUser

public UserImpl getUser(Session session)
Returns the user for a session.
Parameters:
session - Session the user should be returned for.
Returns:
User this session is mapped to.

getSessions

public java.util.List getSessions()
                           throws KosiAccessException,
                                  InvalidSessionException
Returns a list of currently active sessions.
Specified by:
getSessions in interface SessionAdminInterface
Returns:
List containing SessionListEntries.
Throws:
KosiAccessException - If not called by an administrator.
InvalidSessionException - If not called from a valid session context.

removeSession

public void removeSession(Session session)
                   throws KosiAccessException,
                          InvalidSessionException
Removes a session.
Specified by:
removeSession in interface SessionAdminInterface
Parameters:
session - Session to remove.
Throws:
KosiAccessException - If not called by an administrator.
InvalidSessionException - If not called from a valid session context.

doAsLocalUser

public static void doAsLocalUser(java.lang.Runnable runnable)
Execute a Runnable as the local user. This has to be used, when calling methods, that require a valid session context from local code.
Parameters:
runnable - Runnable to execute;