Class CmdLineWebClient
java.lang.Object
net.sf.colossus.webclient.CmdLineWebClient
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final StringNOTE: shared with SocketThread, because WCST needs it to restore game tokens to an GameInfo objectprivate final Stringprivate static final Loggerprivate final intprivate IWebServerprivate WebClientSocketThreadFields inherited from interface IWebClient
alreadyLoggedIn, chatDeliver, connectionClosed, didEnroll, didUnenroll, forcedLogout, gameCancelled, gameInfo, gameStarted, gameStartsNow, gameStartsSoon, generalMessage, grantAdmin, pingRequest, requestAttention, systemMessage, tooManyUsers, userInfo, watchGameInfo -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchatDeliver(String chatId, long when, String sender, String message, boolean resent) voidconnectionReset(boolean forcedLogout) voiddeliverGeneralMessage(long when, boolean error, String title, String message) voidvoiddidUnenroll(String gameId, String username) voidgameCancelled(String gameId, String byUser) voidvoidgameStartsNow(String gameId, int port, String hostingHost) voidgameStartsSoon(String gameId, String byUser) intprivate static Stringprivate Stringvoidprivate static voidinteractiveLoop(CmdLineWebClient cwClient) private booleanCreate a commandline client (CmdLineWebClient) and login with given parametersprivate booleanlogout()Logout the active CmdlineClientstatic voidvoidrequestAttention(long when, String byUser, boolean byAdmin, String message, int beepCount, long beepInterval, boolean windows) private voidprivate static voidsleepFor(long millis) voidsystemMessage(long when, String message) private voidtypedInChat(String message) voidupdateStatus(String text, Color color) voidvoidwatchGameInfo(String gameId, String host, int port)
-
Field Details
-
LOGGER
-
DEFAULT_USERNAME
- See Also:
-
DEFAULT_PASSWORD
- See Also:
-
server
-
wcst
-
hostname
- See Also:
-
port
private final int port- See Also:
-
gameHash
-
-
Constructor Details
-
CmdLineWebClient
public CmdLineWebClient()
-
-
Method Details
-
getClientVersion
public int getClientVersion()- Specified by:
getClientVersionin interfaceIWebClient
-
main
- Parameters:
args-
-
interactiveLoop
-
getOneLineFromStdin
- Throws:
IOException
-
sleepFor
private static void sleepFor(long millis) -
login
-
logout
private boolean logout()Logout the active CmdlineClient- Returns:
-
isLoggedIn
private boolean isLoggedIn() -
getUsername
-
shutdownServer
private void shutdownServer() -
typedInChat
-
updateStatus
-
chatDeliver
- Specified by:
chatDeliverin interfaceIWebClient
-
deliverGeneralMessage
- Specified by:
deliverGeneralMessagein interfaceIWebClient
-
systemMessage
- Specified by:
systemMessagein interfaceIWebClient
-
requestAttention
public void requestAttention(long when, String byUser, boolean byAdmin, String message, int beepCount, long beepInterval, boolean windows) - Specified by:
requestAttentionin interfaceIWebClient
-
connectionReset
public void connectionReset(boolean forcedLogout) - Specified by:
connectionResetin interfaceIWebClient
-
didEnroll
- Specified by:
didEnrollin interfaceIWebClient
-
didUnenroll
- Specified by:
didUnenrollin interfaceIWebClient
-
gameCancelled
- Specified by:
gameCancelledin interfaceIWebClient
-
gameInfo
- Specified by:
gameInfoin interfaceIWebClient
-
gameStartsNow
- Specified by:
gameStartsNowin interfaceIWebClient
-
gameStartsSoon
- Specified by:
gameStartsSoonin interfaceIWebClient
-
grantAdminStatus
public void grantAdminStatus()- Specified by:
grantAdminStatusin interfaceIWebClient
-
userInfo
- Specified by:
userInfoin interfaceIWebClient
-
watchGameInfo
- Specified by:
watchGameInfoin interfaceIWebClient
-