All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----edu.utah.janos.antsr.core.ConsoleWorker
Summary |
class ConsoleWorker extends java.lang.Object implements java.lang.Runnable { // Fields 4 private final Socket client; private LineNumberReader in; private final Node node; PrintWriter out; // Constructors 1 public ConsoleWorker(Node, Socket) throws IOException; // Methods 15 private void banner(); final void dumpStrings(String[]); private String[] getCommand() throws IOException; LineNumberReader getInputStream(); PrintWriter getOutputStream(); private void handleClient() throws IOException; void log(int, String); void logStackTrace(int, Throwable); void printStackTrace(Throwable); void println(String); private void prompt(); public void run(); private boolean runCommand(String[]); void shutdown(); public String toString(); // Inner Classes 8 private static final class ConsoleWorker.ExitCommand private static final class ConsoleWorker.DebugCommand private static final class ConsoleWorker.ShutdownCommand private static final class ConsoleWorker.GarbageCollectCommand private static final class ConsoleWorker.InfoCommand private static final class ConsoleWorker.AppCommand private static final class ConsoleWorker.UptimeCommand private static final class ConsoleWorker.HelpCommand }
A helper class for Console, it takes care of individual connections so that more than one person can be connected at a time.
Fields |
· node | Summary | Top |
private final Node node
The node we're executing on
· client | Summary | Top |
private final Socket client
The client socket object
· out | Summary | Top |
PrintWriter out
Output stream
· in | Summary | Top |
private LineNumberReader in
Input stream
Constructors |
· ConsoleWorker | Summary | Top |
public ConsoleWorker(Node node, Socket sock) throws IOException
Setup the input and output stream objects for the given client
Methods |
· getOutputStream | Summary | Top |
PrintWriter getOutputStream()
Returns the output stream for this console object, only really useful for external console commands.
· getInputStream | Summary | Top |
LineNumberReader getInputStream()
Returns the input stream for this console object, only really useful for external console commands.
· toString | Summary | Top |
public String toString()
- Overrides:
- toString in class Object
· run | Summary | Top |
public void run()
Set the event handler in motion
- Implements:
- run in interface Runnable
· handleClient | Summary | Top |
private void handleClient() throws IOException
Event handler for the console, just prints out a simple prompt and then accepts some simple commands from the user
· banner | Summary | Top |
private void banner()
Print out a welcome message for the user
· prompt | Summary | Top |
private void prompt()
Print out a meaningful prompt for the user
· getCommand | Summary | Top |
private String[] getCommand() throws IOException
Parse the command line entered by the user
- Returns:
- An array of strings corresponding to the arguments entered
· dumpStrings | Summary | Top |
final void dumpStrings(String[] s)
Print out an array of strings
· runCommand | Summary | Top |
private boolean runCommand(String[] args)
Execute whatever command the user entered. Return true if connection should close (i.e., exit was run).
Parameter Description args the command line (broken into one token per String)
- Returns:
- true if connection should close
· println | Summary | Top |
void println(String msg)
· printStackTrace | Summary | Top |
void printStackTrace(Throwable t)
· log | Summary | Top |
void log(int level, String msg)
· logStackTrace | Summary | Top |
void logStackTrace(int level, Throwable th)
· shutdown | Summary | Top |
void shutdown()
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7