net.sf.colossus.webclient
Class CmdLineWebClient

java.lang.Object
  extended by net.sf.colossus.webclient.CmdLineWebClient
All Implemented Interfaces:
IWebClient

public class CmdLineWebClient
extends java.lang.Object
implements IWebClient

A first start to create a cmdline WebClient. For example for automated testing or for shutting down the server. Still "Work in Progress", just committing it to get my work copy clean...


Field Summary
private  java.util.HashMap<java.lang.String,GameInfo> gameHash
          NOTE: shared with SocketThread, because WCST needs it to restore game tokens to an GameInfo object
private  java.lang.String hostname
           
private static java.util.logging.Logger LOGGER
           
private  java.lang.String password
           
private  int port
           
private  IWebServer server
           
private  java.lang.String username
           
private  WebClientSocketThread wcst
           
 
Fields inherited from interface net.sf.colossus.webcommon.IWebClient
alreadyLoggedIn, chatDeliver, connectionClosed, didEnroll, didUnenroll, forcedLogout, gameCancelled, gameInfo, gameStarted, gameStartsNow, gameStartsSoon, generalMessage, grantAdmin, pingRequest, requestAttention, systemMessage, tooManyUsers, userInfo
 
Constructor Summary
CmdLineWebClient()
           
 
Method Summary
 void chatDeliver(java.lang.String chatId, long when, java.lang.String sender, java.lang.String message, boolean resent)
           
 void connectionReset(boolean forcedLogout)
           
 java.lang.String createLoginWebClientSocketThread(boolean force)
           
 void deliverGeneralMessage(long when, boolean error, java.lang.String title, java.lang.String message)
           
 void didEnroll(java.lang.String gameId, java.lang.String username)
           
 void didUnenroll(java.lang.String gameId, java.lang.String username)
           
 void gameCancelled(java.lang.String gameId, java.lang.String byUser)
           
 void gameInfo(GameInfo gi)
           
 void gameStartsNow(java.lang.String gameId, int port, java.lang.String hostingHost)
           
 void gameStartsSoon(java.lang.String gameId, java.lang.String byUser)
           
 int getClientVersion()
           
 void grantAdminStatus()
           
private  boolean logout()
           
static void main(java.lang.String[] args)
           
 void requestAttention(long when, java.lang.String byUser, boolean byAdmin, java.lang.String message, int beepCount, long beepInterval, boolean windows)
           
 void systemMessage(long when, java.lang.String message)
           
 void updateStatus(java.lang.String text, java.awt.Color color)
           
 void userInfo(int loggedin, int enrolled, int playing, int dead, long ago, java.lang.String text)
           
 
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

server

private IWebServer server

wcst

private WebClientSocketThread wcst

hostname

private final java.lang.String hostname
See Also:
Constant Field Values

port

private final int port
See Also:
Constant Field Values

username

private final java.lang.String username
See Also:
Constant Field Values

password

private final java.lang.String password
See Also:
Constant Field Values

gameHash

private final java.util.HashMap<java.lang.String,GameInfo> gameHash
NOTE: shared with SocketThread, because WCST needs it to restore game tokens to an GameInfo object

Constructor Detail

CmdLineWebClient

public CmdLineWebClient()
Method Detail

getClientVersion

public int getClientVersion()
Specified by:
getClientVersion in interface IWebClient

main

public static void main(java.lang.String[] args)
Parameters:
args -

createLoginWebClientSocketThread

public java.lang.String createLoginWebClientSocketThread(boolean force)

updateStatus

public void updateStatus(java.lang.String text,
                         java.awt.Color color)

logout

private boolean logout()

chatDeliver

public void chatDeliver(java.lang.String chatId,
                        long when,
                        java.lang.String sender,
                        java.lang.String message,
                        boolean resent)
Specified by:
chatDeliver in interface IWebClient

deliverGeneralMessage

public void deliverGeneralMessage(long when,
                                  boolean error,
                                  java.lang.String title,
                                  java.lang.String message)
Specified by:
deliverGeneralMessage in interface IWebClient

systemMessage

public void systemMessage(long when,
                          java.lang.String message)
Specified by:
systemMessage in interface IWebClient

requestAttention

public void requestAttention(long when,
                             java.lang.String byUser,
                             boolean byAdmin,
                             java.lang.String message,
                             int beepCount,
                             long beepInterval,
                             boolean windows)
Specified by:
requestAttention in interface IWebClient

connectionReset

public void connectionReset(boolean forcedLogout)
Specified by:
connectionReset in interface IWebClient

didEnroll

public void didEnroll(java.lang.String gameId,
                      java.lang.String username)
Specified by:
didEnroll in interface IWebClient

didUnenroll

public void didUnenroll(java.lang.String gameId,
                        java.lang.String username)
Specified by:
didUnenroll in interface IWebClient

gameCancelled

public void gameCancelled(java.lang.String gameId,
                          java.lang.String byUser)
Specified by:
gameCancelled in interface IWebClient

gameInfo

public void gameInfo(GameInfo gi)
Specified by:
gameInfo in interface IWebClient

gameStartsNow

public void gameStartsNow(java.lang.String gameId,
                          int port,
                          java.lang.String hostingHost)
Specified by:
gameStartsNow in interface IWebClient

gameStartsSoon

public void gameStartsSoon(java.lang.String gameId,
                           java.lang.String byUser)
Specified by:
gameStartsSoon in interface IWebClient

grantAdminStatus

public void grantAdminStatus()
Specified by:
grantAdminStatus in interface IWebClient

userInfo

public void userInfo(int loggedin,
                     int enrolled,
                     int playing,
                     int dead,
                     long ago,
                     java.lang.String text)
Specified by:
userInfo in interface IWebClient