com.waveset.util
Class Console

java.lang.Object
  extended bycom.waveset.util.Console
Direct Known Subclasses:
WavesetConsole

public class Console
extends java.lang.Object

A simple console interpreter for administration and testing. This is normally subclassed by something that adds more commands.


Field Summary
static java.lang.String code_id
           
 
Constructor Summary
Console()
           
 
Method Summary
 void addCommand(java.lang.String name, java.lang.String help, java.lang.String function)
           
protected  void cmdVersion(java.util.Vector args, java.io.PrintWriter out)
           
 java.lang.String doCommand(java.lang.String cmd)
          Execute a command and return its value as a string.
 boolean doCommand(java.lang.String line, java.io.PrintWriter out)
           
 java.lang.String fullpath(java.lang.String file)
          There is similar logic in Util.findFile, but that also searches the classpath.
protected  boolean isInteractive()
          Are we running in interactive mode?
static void main(java.lang.String[] args)
           
 boolean preCommand(java.lang.String name)
           
 void print(java.lang.Object p)
           
 void println(java.lang.Object p)
           
protected  java.lang.String readLine()
          Reads the next line of input
 java.util.Hashtable readPropertyFile(java.lang.String file)
          Read a file of XML properties and convert into a hashtable.
 void run(java.lang.String[] args)
           
 void setPrompt(java.lang.String p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values
Constructor Detail

Console

public Console()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

run

public void run(java.lang.String[] args)

println

public void println(java.lang.Object p)

print

public void print(java.lang.Object p)

setPrompt

public void setPrompt(java.lang.String p)

addCommand

public void addCommand(java.lang.String name,
                       java.lang.String help,
                       java.lang.String function)

isInteractive

protected boolean isInteractive()
Are we running in interactive mode?


readLine

protected java.lang.String readLine()
Reads the next line of input


doCommand

public boolean doCommand(java.lang.String line,
                         java.io.PrintWriter out)

doCommand

public java.lang.String doCommand(java.lang.String cmd)
Execute a command and return its value as a string. Added for the SOAP interface.


preCommand

public boolean preCommand(java.lang.String name)
                   throws java.lang.Exception
Throws:
java.lang.Exception

cmdVersion

protected void cmdVersion(java.util.Vector args,
                          java.io.PrintWriter out)
                   throws java.lang.Exception
Throws:
java.lang.Exception

fullpath

public java.lang.String fullpath(java.lang.String file)
There is similar logic in Util.findFile, but that also searches the classpath.


readPropertyFile

public java.util.Hashtable readPropertyFile(java.lang.String file)
                                     throws java.lang.Exception
Read a file of XML properties and convert into a hashtable. Note that this isn't a "Java properties" file, its an XML representation. Might want to allow Java properties files here, too for convenience.

Throws:
java.lang.Exception