Class RemoteConsole

java.lang.Object
  extended byjava.lang.Thread
      extended byRemoteConsole
All Implemented Interfaces:
InputInterface, OutputInterface, Runnable

public class RemoteConsole
extends Thread
implements OutputInterface, InputInterface

A remote console listens on a port for a remote login to a running Juno system server.

Version:
10

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RemoteConsole(Juno system, boolean echo, int port)
          Construct a remote console to listen for users trying to connect to Juno.
RemoteConsole(Juno system, boolean echo, Socket clientSocket, PrintWriter junoLog, int sessionCount)
          Construct a remote console for a single remote user.
 
Method Summary
 void errPrintln(String str)
          Write a String followed by a newline to console error output location.
 boolean isEchoInput()
          Query what kind of console this is.
 boolean isGUI()
          Query what kind of console this is.
 boolean isRemote()
          Query what kind of console this is.
 void print(String str)
          Write a String to console socket.
 void println(String str)
          Write a String followed by a newline to console socket.
 String readLine(String promptString)
          Read a line (terminated by a newline) from console socket.
 void run()
          Action when the thread for this session starts.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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
 

Constructor Detail

RemoteConsole

public RemoteConsole(Juno system,
                     boolean echo,
                     int port)
Construct a remote console to listen for users trying to connect to Juno. Called from Juno main.

Parameters:
system - the Juno system setting up this console.
echo - whether or not input should be echoed.
port - the port on which to listen for requests.

RemoteConsole

public RemoteConsole(Juno system,
                     boolean echo,
                     Socket clientSocket,
                     PrintWriter junoLog,
                     int sessionCount)
Construct a remote console for a single remote user.

Parameters:
system - the Juno system to which the user is connecting.
echo - whether or not input should be echoed.
clientSocket - the socket for the user's connection
junoLog - track all user i/o
sessionCount - this session's number
Method Detail

errPrintln

public void errPrintln(String str)
Write a String followed by a newline to console error output location. That's just the socket.

Specified by:
errPrintln in interface OutputInterface
Parameters:
str - - the String to write

isEchoInput

public boolean isEchoInput()
Query what kind of console this is.

Specified by:
isEchoInput in interface OutputInterface
Returns:
true if and only if echoing input.

isGUI

public boolean isGUI()
Query what kind of console this is.

Specified by:
isGUI in interface OutputInterface
Returns:
false since it's not a GUI.

isRemote

public boolean isRemote()
Query what kind of console this is.

Specified by:
isRemote in interface OutputInterface
Returns:
true since it is remote.

print

public void print(String str)
Write a String to console socket. Log the output if required.

Parameters:
str - - the string to write

println

public void println(String str)
Write a String followed by a newline to console socket. Log the output if required.

Specified by:
println in interface OutputInterface
Parameters:
str - - the string to write

readLine

public String readLine(String promptString)
Read a line (terminated by a newline) from console socket. Log the input line before returning it if required.

Specified by:
readLine in interface InputInterface
Parameters:
promptString - output string to prompt for input
Returns:
the string (without the newline character)

run

public void run()
Action when the thread for this session starts.

Specified by:
run in interface Runnable