org.starhope.appius.game
Class AdminProcessor

java.lang.Object
  extended by java.lang.Thread
      extended by org.starhope.appius.game.AdminProcessor
All Implemented Interfaces:
Runnable

public class AdminProcessor
extends Thread

Processing thread for an administrative connection (normally port 2772)

Author:
brpocock

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  BufferedReader in
          the input stream
private static int maxInputSize
          the maximum input line length accepted
private  PrintWriter out
          the output stream
private  Socket socket
          the socket against which we're acting
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AdminProcessor(Socket userSocket)
          create a new administrative processing thread
 
Method Summary
private  String grabInput()
           
private  String processInput(String inputLine)
           
 void run()
          This is an overriding method.
private  void setup()
          Set up this thread to execute
 
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, interrupt, 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

maxInputSize

private static final int maxInputSize
the maximum input line length accepted

See Also:
Constant Field Values

in

private BufferedReader in
the input stream


out

private PrintWriter out
the output stream


socket

private final Socket socket
the socket against which we're acting

Constructor Detail

AdminProcessor

public AdminProcessor(Socket userSocket)
create a new administrative processing thread

Parameters:
userSocket - the socket to which the remote user is connected
Method Detail

grabInput

private String grabInput()
Returns:
accept input from the admin

processInput

private String processInput(String inputLine)
                     throws PrivilegeRequiredException
Parameters:
inputLine - the input from the client
Returns:
output line to return to the client, or “null” to disconnect
Throws:
PrivilegeRequiredException - if the client doesn't specify the name of a Developer-level user

run

public void run()
This is an overriding method.

Specified by:
run in interface Runnable
Overrides:
run in class Thread
See Also:
Thread.run()

setup

private void setup()
            throws IOException,
                   UserDeadException
Set up this thread to execute

Throws:
IOException - if the I/O streams can't be initialized
UserDeadException - if the user disconnects before setup is complete