com.planet_ink.coffee_mud.core.interfaces
Interface MudHost

All Known Implementing Classes:
MUD, OffLine

public interface MudHost

The interface implemented by the main mud application. Includes several timing constants.


Field Summary
static char MAIN_HOST
          for multi-host systems, the thread code denoting the main/first mud host
static long TIME_SAVETHREAD_SLEEP
          the number of milliseconds between each savethread execution
static long TIME_UTILTHREAD_SLEEP
          the number of milliseconds between each utilithread execution
 
Method Summary
 void acceptConnection(java.net.Socket sock)
          Handles a connection from a user, and internal states
 java.lang.String executeCommand(java.lang.String cmd)
          Flexible interface for tinkering with mud-host settings.
 java.lang.String getHost()
          the hostname of the mud server
 java.lang.String getLanguage()
          Return the viewable name of the language supported by this host.
 java.util.List<java.lang.Runnable> getOverdueThreads()
          Return any internal threads that are a source of troubles
 int getPort()
          the port a given MUD server instance is listening on
 java.lang.String getStatus()
          Retrieve a string telling the status of mud startup or shutdown
 long getUptimeSecs()
          Retrieve the number of seconds since startup
 java.lang.String geWebHostUrl()
          The hostname, port of the most public web server for this host Includes trailing slash
 boolean isAcceptingConnections()
          Sets whether this mud is accepting connections
 void setAcceptConnections(boolean truefalse)
          Sets whether this mud is accepting connections
 void shutdown(Session S, boolean keepItDown, java.lang.String externalCommand)
          An order to permanently shutdown the entire mud system
 java.lang.ThreadGroup threadGroup()
          Because thread groups are used to track configurations, here is a way to get it.
 

Field Detail

TIME_SAVETHREAD_SLEEP

static final long TIME_SAVETHREAD_SLEEP
the number of milliseconds between each savethread execution

See Also:
Constant Field Values

TIME_UTILTHREAD_SLEEP

static final long TIME_UTILTHREAD_SLEEP
the number of milliseconds between each utilithread execution

See Also:
Constant Field Values

MAIN_HOST

static final char MAIN_HOST
for multi-host systems, the thread code denoting the main/first mud host

See Also:
Constant Field Values
Method Detail

getHost

java.lang.String getHost()
the hostname of the mud server

Returns:
hostname or ip address

getPort

int getPort()
the port a given MUD server instance is listening on

Returns:
the port numbered listened on by this mud instance

geWebHostUrl

java.lang.String geWebHostUrl()
The hostname, port of the most public web server for this host Includes trailing slash

Returns:
http://mydomain:myport/

shutdown

void shutdown(Session S,
              boolean keepItDown,
              java.lang.String externalCommand)
An order to permanently shutdown the entire mud system

Parameters:
S - a player session to send status messages to. May be null.
keepItDown - true to shutdown, false to restart
externalCommand - if keepItDown is false, an external command to execute

getStatus

java.lang.String getStatus()
Retrieve a string telling the status of mud startup or shutdown

Returns:
status of mud startup or shutdown

getUptimeSecs

long getUptimeSecs()
Retrieve the number of seconds since startup

Returns:
number of seconds since startup

getOverdueThreads

java.util.List<java.lang.Runnable> getOverdueThreads()
Return any internal threads that are a source of troubles

Returns:
a list of threads that need service or killing

getLanguage

java.lang.String getLanguage()
Return the viewable name of the language supported by this host.

Returns:
the language supported by this host.

executeCommand

java.lang.String executeCommand(java.lang.String cmd)
                                throws java.lang.Exception
Flexible interface for tinkering with mud-host settings. Commands to be defined later, or now, or whatever.

Parameters:
cmd - space-delimited (parsable) command/parm list
Returns:
any return variables
Throws:
java.lang.Exception - any exceptions

threadGroup

java.lang.ThreadGroup threadGroup()
Because thread groups are used to track configurations, here is a way to get it.

Returns:
the thread group this host was created under.

setAcceptConnections

void setAcceptConnections(boolean truefalse)
Sets whether this mud is accepting connections

Parameters:
truefalse - whether it is accepting connections
See Also:
isAcceptingConnections()

acceptConnection

void acceptConnection(java.net.Socket sock)
                      throws java.net.SocketException,
                             java.io.IOException
Handles a connection from a user, and internal states

Parameters:
sock - the socket the connection was made on
Throws:
java.net.SocketException - socket exceptions
java.io.IOException - io exceptions

isAcceptingConnections

boolean isAcceptingConnections()
Sets whether this mud is accepting connections

Returns:
true/false whether it is accepting connections
See Also:
setAcceptConnections(boolean)