net.sf.colossus.webserver
Class GameManager

java.lang.Object
  extended by net.sf.colossus.webserver.GameManager
All Implemented Interfaces:
java.rmi.Remote, IGameManager

public class GameManager
extends java.lang.Object
implements IGameManager

This "manager" is accessible via RMI (served by the ColossusRegistry object) for the games started in own processes. Once a game comes up, it can register to here, telling it's game Id, and reporting anything that happens which is of interest to the server; for example, this could be things like player died etc. Additionally the server can communicate with the games, because it gets their game Id, and looks up the ManagedGame remote object for it. TODO: work just started (2011-04-24)

Author:
Clemens Katzer

Field Summary
private  java.util.HashMap<java.lang.String,IManagedGame> games
           
private static java.util.logging.Logger LOGGER
           
static java.lang.String OBJ_ID
           
private  ColossusRegistry r
           
private  java.rmi.registry.Registry registry
           
 
Constructor Summary
GameManager()
           
 
Method Summary
private  void doGetRegistry()
           
private static void exitOnReturn(GameManager gm)
           
 int getGameCount()
           
private  void initRegistryIfNeeded()
           
 void listRegistryContents()
           
private  IManagedGame lookupGameByRegid(java.lang.String gameId)
           
static void main(java.lang.String[] args)
          This is only for testing purposes.
 void registerGame(java.lang.String gameId)
           
private  void registerManager()
           
private static void sleepFor(long millis)
           
 void tellEvent(java.lang.String description)
           
 void unregisterGame(java.lang.String gameId)
           
 void unregisterManager()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

OBJ_ID

public static final java.lang.String OBJ_ID
See Also:
Constant Field Values

games

private final java.util.HashMap<java.lang.String,IManagedGame> games

r

private ColossusRegistry r

registry

private java.rmi.registry.Registry registry
Constructor Detail

GameManager

public GameManager()
Method Detail

initRegistryIfNeeded

private void initRegistryIfNeeded()

doGetRegistry

private void doGetRegistry()

listRegistryContents

public void listRegistryContents()

registerManager

private void registerManager()

unregisterManager

public void unregisterManager()

getGameCount

public int getGameCount()

tellEvent

public void tellEvent(java.lang.String description)
               throws java.rmi.RemoteException
Specified by:
tellEvent in interface IGameManager
Throws:
java.rmi.RemoteException

registerGame

public void registerGame(java.lang.String gameId)
                  throws java.rmi.RemoteException,
                         java.rmi.NotBoundException
Specified by:
registerGame in interface IGameManager
Throws:
java.rmi.RemoteException
java.rmi.NotBoundException

unregisterGame

public void unregisterGame(java.lang.String gameId)
                    throws java.rmi.AccessException,
                           java.rmi.NotBoundException,
                           java.rmi.RemoteException
Specified by:
unregisterGame in interface IGameManager
Throws:
java.rmi.AccessException
java.rmi.NotBoundException
java.rmi.RemoteException

lookupGameByRegid

private IManagedGame lookupGameByRegid(java.lang.String gameId)
                                throws java.rmi.AccessException,
                                       java.rmi.NotBoundException,
                                       java.rmi.RemoteException
Throws:
java.rmi.AccessException
java.rmi.NotBoundException
java.rmi.RemoteException

main

public static void main(java.lang.String[] args)
This is only for testing purposes. Normally the GameManager object is created by WebServer object.


sleepFor

private static void sleepFor(long millis)

exitOnReturn

private static void exitOnReturn(GameManager gm)