com.planet_ink.coffee_mud.core.http
Class HTTPserver

java.lang.Object
  extended by java.lang.Thread
      extended by com.planet_ink.coffee_mud.core.http.HTTPserver
All Implemented Interfaces:
MudHost, java.lang.Runnable

public class HTTPserver
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
 DVector activeRequests
           
protected static float HOST_VERSION_MAJOR
           
protected static float HOST_VERSION_MINOR
           
protected  boolean isAdminServer
           
protected  boolean isOK
           
protected  CMProps page
           
protected  FileGrabber pageGrabber
           
protected  java.lang.String partialName
           
protected  java.lang.String serverDir
           
protected  java.lang.String serverTemplateDir
           
static java.lang.String ServerVersionString
           
protected  java.net.ServerSocket servsock
           
protected  FileGrabber templateGrabber
           
protected static CMProps webCommon
           
 
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
HTTPserver(MudHost a_mud, java.lang.String a_name, int num)
           
 
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.util.Properties getCommonPropPage()
           
 java.lang.String getHost()
          the hostname of the mud server
 MudHost getMUD()
           
 java.util.Vector getOverdueThreads()
          Return any internal threads that are a source of troubles
 java.lang.String getPartialName()
           
 int getPort()
          the port a given MUD server instance is listening on
 java.lang.String getPortStr()
           
 java.lang.String getServerDir()
           
 java.lang.String getServerTemplateDir()
           
 java.lang.String getStatus()
          Retreive a string telling the status of mud startup or shutdown
 java.util.Hashtable getVirtualDirectories()
           
protected  boolean initServer(int which)
           
 void interrupt()
           
 boolean isAcceptingConnections()
          Sets whether this mud is accepting connections
protected  boolean loadPropPage()
           
 void run()
           
 void setAcceptConnections(boolean truefalse)
          Sets whether this mud is accepting connections
 void shutdown()
           
 void shutdown(Session S)
           
 void shutdown(Session S, boolean keepItDown, java.lang.String externalCommand)
          An order to permanently shutdown the entire mud system
 int totalPorts()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

page

protected CMProps page

HOST_VERSION_MAJOR

protected static final float HOST_VERSION_MAJOR
See Also:
Constant Field Values

HOST_VERSION_MINOR

protected static final float HOST_VERSION_MINOR
See Also:
Constant Field Values

webCommon

protected static CMProps webCommon

ServerVersionString

public static final java.lang.String ServerVersionString
See Also:
Constant Field Values

isOK

protected boolean isOK

isAdminServer

protected boolean isAdminServer

servsock

protected java.net.ServerSocket servsock

partialName

protected java.lang.String partialName

serverDir

protected java.lang.String serverDir

serverTemplateDir

protected java.lang.String serverTemplateDir

pageGrabber

protected FileGrabber pageGrabber

templateGrabber

protected FileGrabber templateGrabber

activeRequests

public DVector activeRequests
Constructor Detail

HTTPserver

public HTTPserver(MudHost a_mud,
                  java.lang.String a_name,
                  int num)
Method Detail

getPartialName

public java.lang.String getPartialName()

getMUD

public MudHost getMUD()

getServerDir

public java.lang.String getServerDir()

getServerTemplateDir

public java.lang.String getServerTemplateDir()

getCommonPropPage

public java.util.Properties getCommonPropPage()

initServer

protected boolean initServer(int which)

getVirtualDirectories

public java.util.Hashtable getVirtualDirectories()

loadPropPage

protected boolean loadPropPage()

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
java.io.IOException

run

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

shutdown

public void shutdown(Session S)

shutdown

public void shutdown()

interrupt

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

totalPorts

public int totalPorts()

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

getPortStr

public java.lang.String getPortStr()

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

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

getStatus

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

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

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
See Also:
return true/false whether it is accepting connections

getOverdueThreads

public java.util.Vector 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

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