com.planet_ink.coffee_mud.application
Class OffLine

java.lang.Object
  extended by java.lang.Thread
      extended by com.planet_ink.coffee_mud.application.OffLine
All Implemented Interfaces:
MudHost, java.lang.Runnable

public class OffLine
extends java.lang.Thread
implements MudHost


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 boolean acceptConnections
           
static DVector accessed
           
static java.util.Vector<java.lang.String> autoblocked
           
static java.lang.String bind
           
 java.lang.String host
           
static boolean isOK
           
static java.util.Vector<OffLine> mudThreads
           
 int port
           
static java.lang.String ports
           
static boolean serverIsRunning
           
protected  long startupTime
           
 int state
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.MudHost
MAIN_HOST, TIME_SAVETHREAD_SLEEP, TIME_UTILTHREAD_SLEEP
 
Constructor Summary
OffLine()
           
 
Method Summary
 void acceptConnection(java.net.Socket sock)
          Handles a connection from a user, and internal states
static void defaultShutdown()
           
 java.lang.String executeCommand(java.lang.String cmd)
          Flexible interface for tinkering with mud-host settings.
static void fatalStartupError(java.lang.Thread t, int type)
           
 java.lang.StringBuffer getFile(java.lang.String fileName)
           
 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
 void interrupt()
           
 boolean isAcceptingConnections()
          Sets whether this mud is accepting connections
static void main(java.lang.String[] a)
           
 void run()
           
 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.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mudThreads

public static java.util.Vector<OffLine> mudThreads

accessed

public static DVector accessed

autoblocked

public static java.util.Vector<java.lang.String> autoblocked

serverIsRunning

public static boolean serverIsRunning

isOK

public static boolean isOK

acceptConnections

public boolean acceptConnections

host

public java.lang.String host

bind

public static java.lang.String bind

ports

public static java.lang.String ports

port

public int port

state

public int state

startupTime

protected final long startupTime
Constructor Detail

OffLine

public OffLine()
Method Detail

threadGroup

public java.lang.ThreadGroup threadGroup()
Description copied from interface: MudHost
Because thread groups are used to track configurations, here is a way to get it.

Specified by:
threadGroup in interface MudHost
Returns:
the thread group this host was created under.

fatalStartupError

public static void fatalStartupError(java.lang.Thread t,
                                     int type)

getFile

public java.lang.StringBuffer getFile(java.lang.String fileName)

acceptConnection

public void acceptConnection(java.net.Socket sock)
                      throws java.net.SocketException,
                             java.io.IOException
Description copied from interface: MudHost
Handles a connection from a user, and internal states

Specified by:
acceptConnection in interface MudHost
Parameters:
sock - the socket the connection was made on
Throws:
java.net.SocketException - socket exceptions
java.io.IOException - io exceptions

run

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

getStatus

public java.lang.String getStatus()
Description copied from interface: MudHost
Retrieve a string telling the status of mud startup or shutdown

Specified by:
getStatus in interface MudHost
Returns:
status of mud startup or shutdown

shutdown

public void shutdown(Session S,
                     boolean keepItDown,
                     java.lang.String externalCommand)
Description copied from interface: MudHost
An order to permanently shutdown the entire mud system

Specified by:
shutdown in interface MudHost
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

defaultShutdown

public static void defaultShutdown()

interrupt

public void interrupt()
Overrides:
interrupt in class java.lang.Thread

getHost

public java.lang.String getHost()
Description copied from interface: MudHost
the hostname of the mud server

Specified by:
getHost in interface MudHost
Returns:
hostname or ip address

getPort

public int getPort()
Description copied from interface: MudHost
the port a given MUD server instance is listening on

Specified by:
getPort in interface MudHost
Returns:
the port numbered listened on by this mud instance

main

public static void main(java.lang.String[] a)

setAcceptConnections

public void setAcceptConnections(boolean truefalse)
Description copied from interface: MudHost
Sets whether this mud is accepting connections

Specified by:
setAcceptConnections in interface MudHost
Parameters:
truefalse - whether it is accepting connections
See Also:
MudHost.isAcceptingConnections()

isAcceptingConnections

public boolean isAcceptingConnections()
Description copied from interface: MudHost
Sets whether this mud is accepting connections

Specified by:
isAcceptingConnections in interface MudHost
Returns:
true/false whether it is accepting connections
See Also:
MudHost.setAcceptConnections(boolean)

getOverdueThreads

public java.util.List<java.lang.Runnable> getOverdueThreads()
Description copied from interface: MudHost
Return any internal threads that are a source of troubles

Specified by:
getOverdueThreads in interface MudHost
Returns:
a list of threads that need service or killing

getUptimeSecs

public long getUptimeSecs()
Description copied from interface: MudHost
Retrieve the number of seconds since startup

Specified by:
getUptimeSecs in interface MudHost
Returns:
number of seconds since startup

getLanguage

public java.lang.String getLanguage()
Description copied from interface: MudHost
Return the viewable name of the language supported by this host.

Specified by:
getLanguage in interface MudHost
Returns:
the language supported by this host.

executeCommand

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

Specified by:
executeCommand in interface MudHost
Parameters:
cmd - space-delimited (parsable) command/parm list
Returns:
any return variables
Throws:
java.lang.Exception - any exceptions

geWebHostUrl

public java.lang.String geWebHostUrl()
Description copied from interface: MudHost
The hostname, port of the most public web server for this host Includes trailing slash

Specified by:
geWebHostUrl in interface MudHost
Returns:
http://mydomain:myport/