net.sf.colossus.server
Class NotifyWebServerViaFile

java.lang.Object
  extended by net.sf.colossus.server.NotifyWebServerViaFile
All Implemented Interfaces:
INotifyWebServer

public class NotifyWebServerViaFile
extends java.lang.Object
implements INotifyWebServer

For communication between Game/Server and WebServer. Perhaps later replaced with a two-way socket connection? Class is always created, no matter whether we have a web server ( => active == true) or not ( => active == false); but this way, we can have all the "if (we have a web server) { } " checking done inside this class and do not clutter the main server code.


Field Summary
private  boolean active
           
private  java.io.File flagFile
           
private  java.lang.String flagFilename
           
private static java.util.logging.Logger LOGGER
           
private  java.io.PrintWriter out
           
 
Fields inherited from interface net.sf.colossus.server.INotifyWebServer
ALL_CLIENTS_CONNECTED, GAME_STARTUP_COMPLETED, GAME_STARTUP_FAILED
 
Constructor Summary
NotifyWebServerViaFile(java.lang.String name)
           
 
Method Summary
 void allClientsConnected()
           
private  void createFlagfile()
           
 void gameStartupCompleted()
           
 void gameStartupFailed(java.lang.String reason)
           
 void gotClient(java.lang.String playerName, boolean remote)
           
 boolean isActive()
           
 void readyToAcceptClients()
           
private  void removeFlagfile()
           
 void serverStoppedRunning()
           
 
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

flagFilename

private final java.lang.String flagFilename

out

private java.io.PrintWriter out

flagFile

private java.io.File flagFile

active

private final boolean active
Constructor Detail

NotifyWebServerViaFile

public NotifyWebServerViaFile(java.lang.String name)
Method Detail

isActive

public boolean isActive()
Specified by:
isActive in interface INotifyWebServer

readyToAcceptClients

public void readyToAcceptClients()
Specified by:
readyToAcceptClients in interface INotifyWebServer

gotClient

public void gotClient(java.lang.String playerName,
                      boolean remote)
Specified by:
gotClient in interface INotifyWebServer

allClientsConnected

public void allClientsConnected()
Specified by:
allClientsConnected in interface INotifyWebServer

gameStartupCompleted

public void gameStartupCompleted()
Specified by:
gameStartupCompleted in interface INotifyWebServer

gameStartupFailed

public void gameStartupFailed(java.lang.String reason)
Specified by:
gameStartupFailed in interface INotifyWebServer

serverStoppedRunning

public void serverStoppedRunning()
Specified by:
serverStoppedRunning in interface INotifyWebServer

createFlagfile

private void createFlagfile()

removeFlagfile

private void removeFlagfile()