de.oio.bugkilla.protocol
Class CommandInterpreter

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--de.oio.bugkilla.protocol.CommandInterpreter
All Implemented Interfaces:
java.lang.Runnable

public class CommandInterpreter
extends java.lang.Thread

A class waiting for incomming commads from a given InputStream to send these commands to its
given Commandable object. The CommandInterpreter is an instance of a Thread object. The only task is to wait on the given InputStream for receiving commands. There are three possible commands this class is able to interprete: start, stop and off. Respectively of the sended command, is has to inform the given Commandable.

Author:
swinkler

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CommandInterpreter(java.io.InputStream in, Commandable slave)
          Creates a new CommandInterpreter object to receive commands from the given InputStream and send these commands to the given Commandable object.
 
Method Summary
 java.io.BufferedReader getIn()
          Returns the BufferedReader wrapping the given InputStream.
 boolean isOn()
          Returns true while calling off.
 void printVerifyedCommand(java.lang.String command)
          Prints the verifyed command out
 void run()
          Calls Commandable methods respectively of the send command.
 void setIn(java.io.BufferedReader in)
          Sets the Reader for wrapping the given InputStream.
 void setOn(boolean on)
          Sets the on.
 
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

CommandInterpreter

public CommandInterpreter(java.io.InputStream in,
                          Commandable slave)
Creates a new CommandInterpreter object to receive commands from the given InputStream and send these commands to the given Commandable object.

Parameters:
in - - an InputStream sending the commands
slave - - a Commandable object receiving the incomming commands
Method Detail

run

public void run()
Calls Commandable methods respectively of the send command.
start is equivalent with startRecording from the Commandable interface.
ts is equivalent with startRecordingTestStep from the Commandable interface
stop is equivalent with stopRecording from the Commandable interface.
off is equivalent with stop from the Commandable interface.
Receiving the command off, the run method will terminate.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

printVerifyedCommand

public void printVerifyedCommand(java.lang.String command)
Prints the verifyed command out

Parameters:
command - String which represents users command

getIn

public java.io.BufferedReader getIn()
Returns the BufferedReader wrapping the given InputStream.

Returns:
in - a BufferedReader wrapping the given InputStream

setIn

public void setIn(java.io.BufferedReader in)
Sets the Reader for wrapping the given InputStream.

Parameters:
in - The Reader to set.

isOn

public boolean isOn()
Returns true while calling off.

Returns:
true, if the CommandInterpreter is still able to receive commands

setOn

public void setOn(boolean on)
Sets the on.

Parameters:
on - The on to set


Copyright © Orientation in Objects GmbH. All Rights Reserved.