de.kosi
Class Server

java.lang.Object
  |
  +--de.kosi.Server
All Implemented Interfaces:
java.rmi.Remote, java.io.Serializable, ServerAdmin

public class Server
extends java.lang.Object
implements ServerAdmin, java.io.Serializable

The server class implements the KoSI Bridge Server.

ChangeLog:

 $Log: Server.java,v $
 Revision 1.11  2001/08/02 10:44:30  jiriki
 Worked on Tournament

 Revision 1.10  2001/07/16 12:47:02  jiriki
 Better fix fort 440966.

 Revision 1.9  2001/07/02 17:37:18  jiriki
 - New Implementation of SSL Authorization
 - Implemented Client-Side Persistence

 Revision 1.8  2001/06/14 14:41:00  jiriki
 Code maintanance
 (Updated docs, removed unused code, improved code style)

 Revision 1.7  2001/06/12 17:14:33  jiriki
 - Reimplemented DistributedList to make filters working
 - Made ServertestCase working.

 Revision 1.6  2001/06/04 14:21:09  jiriki
 Made source more comliant to coding guidelines.

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

 Revision 1.4  2001/05/04 21:26:01  jiriki
 Removed bug 421314.

 Revision 1.3  2001/05/02 19:47:55  jiriki
 Added  ShutdownHook to server.

 Revision 1.2  2001/04/29 18:14:44  jiriki
 Added CVS Tags to server again.

 Revision 1.20  2001/04/09 17:55:27  wombat
 Mail Interface Konfiguration eingefügt.

 Revision 1.19  2001/04/09 15:36:17  wombat
 Improved UserImpl, removed bugs

 Revision 1.18  2001/04/09 13:03:10  wombat
 Removed timeout from threadpool (did not work)

 Revision 1.17  2001/03/21 13:26:36  wombat
 - Removed bugs in Table
 - began implementation of stree client
 - updated documentation

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

 Revision 1.15  2001/03/20 16:01:59  wombat
 Introduced persistant tasks

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

 Revision 1.13  2001/03/18 18:10:26  wombat
 Updated Documentation

 Revision 1.12  2001/03/18 17:32:03  wombat
 Changed database concept

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

 Revision 1.10  2001/03/14 13:46:34  wombat
 Worked on Admin Tool. Removed deadlock while killing session

 Revision 1.9  2001/03/09 11:15:03  wombat
 Updated documentation.

 Revision 1.8  2001/03/07 14:15:06  wombat
 started database implementation

 Revision 1.7  2001/02/19 23:21:16  wombat
 Added SSL Support, Implement DistributedListFilter

 Revision 1.6  2001/02/19 16:56:27  wombat
 Removed some bugs in server and client configuration

 Revision 1.5  2001/02/06 14:57:32  wombat
 Updated documentation

 

Version:
$Revision: 1.11 $ ($Date: 2001/08/02 10:44:30 $)
Author:
Jan-Ole Janssen, Niklas Mehner, Time Sticher
See Also:
Serialized Form

Field Summary
static int IMMEDIATE
          Shutdown immietiatly.
static long serialVersionUID
          Serial version id.
static int SHUTDOWN
          Shutdown without caused by user interaction.
static int SHUTDOWN_RESTART
          Shutdown and restart the server.
static int SHUTDOWN_WITH_ERROR
          Shutdown because of an Exception.
 
Constructor Summary
Server()
          Create a new Server.
 
Method Summary
static void checkAdmin()
          Check if the calling user is an administrator, else throw an Exception.
 FoyerImpl getFoyer()
          Returns the foyer.
 int getMaxTables()
          Get the maximum number of tables allowed to concurrently exist in the server.
 int getMaxTournaments()
          Get the maximum number of tournaments allowed to concurrently exist in the server.
 int getMaxUsers()
          Return the maximum number of users allowed to be concurrently logged into the server.
 int getThreadPoolThreads()
          Return the number of threads in the thread pool
 void internalShutdown(long time, int returnCode)
          Shut down the server with a returnCode.
 boolean isPrintingRMI()
          Return if RMI calls are printed to standart IO.
static void main(java.lang.String[] args)
          Main method of the server
 void restart()
          Restarts the server.
 void setMaxTables(int maxTables)
          Set the maximum number of tables allowed to concurrently exist in the server.
 void setMaxTournaments(int maxTournaments)
          Set the maximum number of tournaments allowed to concurrently exist in the server.
 void setMaxUsers(int maxUsers)
          Set the maximum number of users allowed to be concurrently logged into the server.
 void setPrintingRMI(boolean printRMI)
          Set if RMI calls should be printed to standart IO.
 void setThreadPoolThreads(int threads)
          Set the number of threads in the thread pool.
 void shutdown()
          Shuts down the server.
static void testMain()
          Main method for the ServerTestCase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

SHUTDOWN

public static final int SHUTDOWN
Shutdown without caused by user interaction.

SHUTDOWN_WITH_ERROR

public static final int SHUTDOWN_WITH_ERROR
Shutdown because of an Exception.

SHUTDOWN_RESTART

public static final int SHUTDOWN_RESTART
Shutdown and restart the server.

IMMEDIATE

public static final int IMMEDIATE
Shutdown immietiatly.
Constructor Detail

Server

public Server()
       throws java.rmi.RemoteException
Create a new Server.
Method Detail

getFoyer

public FoyerImpl getFoyer()
Returns the foyer.
Returns:
The foyer.

checkAdmin

public static void checkAdmin()
                       throws KosiAccessException,
                              InvalidSessionException
Check if the calling user is an administrator, else throw an Exception.
Throws:
KosiAccessException - If not called by an user that has administrative rights.
InvalidSessionException - If called from an invalid session context.

shutdown

public void shutdown()
              throws KosiAccessException,
                     InvalidSessionException
Shuts down the server.
Specified by:
shutdown in interface ServerAdmin
Throws:
KosiAccessException - If not called by an user that has administrative rights.
InvalidSessionException - If called from an invalid session context.

restart

public void restart()
             throws KosiAccessException,
                    InvalidSessionException
Restarts the server.
Specified by:
restart in interface ServerAdmin
Throws:
KosiAccessException - If not called by an user that has administrative rights.
InvalidSessionException - If called from an invalid session context.

internalShutdown

public void internalShutdown(long time,
                             int returnCode)
Shut down the server with a returnCode.
Parameters:
time - in millis, until the server is shut dowdn
returnCode - Return code.

isPrintingRMI

public boolean isPrintingRMI()
                      throws KosiAccessException,
                             InvalidSessionException
Return if RMI calls are printed to standart IO.
Specified by:
isPrintingRMI in interface ServerAdmin
Returns:
true if RMI calls are printed to standart IO.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

setPrintingRMI

public void setPrintingRMI(boolean printRMI)
                    throws KosiAccessException,
                           InvalidSessionException
Set if RMI calls should be printed to standart IO.
Specified by:
setPrintingRMI in interface ServerAdmin
Parameters:
printRMI - true if RMI calls should be printed to standart IO.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

getThreadPoolThreads

public int getThreadPoolThreads()
                         throws KosiAccessException,
                                InvalidSessionException
Return the number of threads in the thread pool
Specified by:
getThreadPoolThreads in interface ServerAdmin
Returns:
number of threads in the threadpool.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

setThreadPoolThreads

public void setThreadPoolThreads(int threads)
                          throws KosiAccessException,
                                 InvalidSessionException
Set the number of threads in the thread pool.
Specified by:
setThreadPoolThreads in interface ServerAdmin
Parameters:
threads - Number of threads in the threadpool. This has to be a value > 0.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

getMaxUsers

public int getMaxUsers()
                throws KosiAccessException,
                       InvalidSessionException
Return the maximum number of users allowed to be concurrently logged into the server.
Specified by:
getMaxUsers in interface ServerAdmin
Returns:
Number of users allowed in the server.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

setMaxUsers

public void setMaxUsers(int maxUsers)
                 throws KosiAccessException,
                        InvalidSessionException
Set the maximum number of users allowed to be concurrently logged into the server.
Specified by:
setMaxUsers in interface ServerAdmin
Parameters:
maxUsers - Maximum users. This value has to be >= 0.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

getMaxTables

public int getMaxTables()
                 throws KosiAccessException,
                        InvalidSessionException
Get the maximum number of tables allowed to concurrently exist in the server.
Specified by:
getMaxTables in interface ServerAdmin
Returns:
Maximum number of tables.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

setMaxTables

public void setMaxTables(int maxTables)
                  throws KosiAccessException,
                         InvalidSessionException
Set the maximum number of tables allowed to concurrently exist in the server.
Specified by:
setMaxTables in interface ServerAdmin
Parameters:
maxTables - Maximum number of tables. This has to be >= 0.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

getMaxTournaments

public int getMaxTournaments()
                      throws KosiAccessException,
                             InvalidSessionException
Get the maximum number of tournaments allowed to concurrently exist in the server.
Specified by:
getMaxTournaments in interface ServerAdmin
Returns:
Maximum number of tournaments.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

setMaxTournaments

public void setMaxTournaments(int maxTournaments)
                       throws KosiAccessException,
                              InvalidSessionException
Set the maximum number of tournaments allowed to concurrently exist in the server.
Specified by:
setMaxTournaments in interface ServerAdmin
Parameters:
maxTournaments - Maximum number of tournaments.
Throws:
KosiAccessException - If called by an user, that has no administrative rights.
InvalidSessionException - If called from an invalid session context.

main

public static void main(java.lang.String[] args)
Main method of the server
Parameters:
args - command line arguments. Only one parameter (a configuration name) may be present.

testMain

public static void testMain()
Main method for the ServerTestCase. This method does not call System.exit(), when the server is shut down and uses the kosi_test properties.