Package net.sf.colossus.webserver
Class GameManager
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,IManagedGame>gamesprivate static java.util.logging.LoggerLOGGERstatic java.lang.StringOBJ_IDprivate ColossusRegistryrprivate java.rmi.registry.Registryregistry
-
Constructor Summary
Constructors Constructor Description GameManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiddoGetRegistry()private static voidexitOnReturn(GameManager gm)intgetGameCount()private voidinitRegistryIfNeeded()voidlistRegistryContents()private IManagedGamelookupGameByRegid(java.lang.String gameId)static voidmain(java.lang.String[] args)This is only for testing purposes.voidregisterGame(java.lang.String gameId)private voidregisterManager()private static voidsleepFor(long millis)voidtellEvent(java.lang.String description)voidunregisterGame(java.lang.String gameId)voidunregisterManager()
-
-
-
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
-
-
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:
tellEventin interfaceIGameManager- Throws:
java.rmi.RemoteException
-
registerGame
public void registerGame(java.lang.String gameId) throws java.rmi.RemoteException, java.rmi.NotBoundException- Specified by:
registerGamein interfaceIGameManager- Throws:
java.rmi.RemoteExceptionjava.rmi.NotBoundException
-
unregisterGame
public void unregisterGame(java.lang.String gameId) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException- Specified by:
unregisterGamein interfaceIGameManager- Throws:
java.rmi.AccessExceptionjava.rmi.NotBoundExceptionjava.rmi.RemoteException
-
lookupGameByRegid
private IManagedGame lookupGameByRegid(java.lang.String gameId) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException
- Throws:
java.rmi.AccessExceptionjava.rmi.NotBoundExceptionjava.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)
-
-