edu.cuny.cat.server
Class TelnetConsole

java.lang.Object
  extended by edu.cuny.cat.server.TelnetConsole
All Implemented Interfaces:
AuctionEventListener, Console, edu.cuny.config.param.Parameterizable, java.lang.Runnable

public class TelnetConsole
extends java.lang.Object
implements Console, edu.cuny.config.param.Parameterizable, java.lang.Runnable

A console that enables to control the game through telnet.

Parameters

base.port
int (default: 9091)
(the port number the telnet console of the cat game server will be listening to)
base.code
string (default: cat)
(the security code required to log in through telnet to control the game)

Default Base

telnet

Version:
$Revision: 1.2 $
Author:
Jinzhong Niu

Nested Class Summary
static class TelnetConsole.ClockStatus
          records the status of the GameClock.
static class TelnetConsole.TelnetConnectionAdaptor
          processes a TelnetConnection from a remote user that monitors the game.
 
Field Summary
protected  java.util.Set<TelnetConsole.TelnetConnectionAdaptor> adaptors
           
protected  TelnetConsole.ClockStatus clockStatus
           
protected  java.lang.String code
           
static java.lang.String DEFAULT_CODE
           
static int DEFAULT_PORT
           
static java.lang.String P_CODE
           
static java.lang.String P_DEF_BASE
           
static java.lang.String P_PORT
           
protected  int port
           
protected  TelnetServerConnector serverConnector
           
protected  boolean stopAcceptingConnection
           
protected  java.lang.Thread thread
           
 
Constructor Summary
TelnetConsole()
           
 
Method Summary
 void dispose(TelnetConsole.TelnetConnectionAdaptor adaptor)
          disposes the TelnetConnection the adaptor works for.
 void eventOccurred(AuctionEvent event)
           
 java.lang.String getCode()
           
 boolean isInteractive()
           
 void run()
           
 void setup(edu.cuny.config.param.ParameterDatabase parameters, edu.cuny.config.param.Parameter base)
           
 void start()
          starts the console.
 void stop()
          stop the console.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

P_DEF_BASE

public static java.lang.String P_DEF_BASE

P_PORT

public static java.lang.String P_PORT

P_CODE

public static java.lang.String P_CODE

DEFAULT_PORT

public static int DEFAULT_PORT

DEFAULT_CODE

public static java.lang.String DEFAULT_CODE

port

protected int port

code

protected java.lang.String code

serverConnector

protected TelnetServerConnector serverConnector

stopAcceptingConnection

protected boolean stopAcceptingConnection

thread

protected java.lang.Thread thread

adaptors

protected java.util.Set<TelnetConsole.TelnetConnectionAdaptor> adaptors

clockStatus

protected TelnetConsole.ClockStatus clockStatus
Constructor Detail

TelnetConsole

public TelnetConsole()
Method Detail

setup

public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
Specified by:
setup in interface edu.cuny.config.param.Parameterizable

getCode

public java.lang.String getCode()

start

public void start()
Description copied from interface: Console
starts the console.

Specified by:
start in interface Console

stop

public void stop()
Description copied from interface: Console
stop the console.

Specified by:
stop in interface Console

isInteractive

public boolean isInteractive()
Specified by:
isInteractive in interface Console
Returns:
true if this console involves human interaction, and false otherwise.

run

public void run()
Specified by:
run in interface java.lang.Runnable

dispose

public void dispose(TelnetConsole.TelnetConnectionAdaptor adaptor)
disposes the TelnetConnection the adaptor works for.

Parameters:
adaptor -

eventOccurred

public void eventOccurred(AuctionEvent event)
Specified by:
eventOccurred in interface AuctionEventListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object