com.msi.network.server
Class CommandProcessor

java.lang.Object
  extended bycom.msi.network.server.RequestHandler
      extended bycom.msi.network.server.CommandProcessor
All Implemented Interfaces:
java.lang.Runnable

public class CommandProcessor
extends RequestHandler

Control the flow of processing server commands. These commands are considered to arrive one line at a time, but may span multiple lines. Access to lines of data are provided by the Connection object and termination of multi-line commands is implemented by each command.

Commands are processed sequentially until a match is made. A match indicates that command processing is complete and the response has been sent.

Setup requires:

Version:
1.0
Author:
Ken Thompson

Field Summary
protected  java.util.Vector _commands
          Describe variable _commands here.
protected  java.lang.String hello
          When a client connects, this String is returned.
protected  java.lang.String noCommand
          If the client sends an unsupported command, this String is returned.
protected  long readTO
          Milliseconds to wait before closing the connection.
 
Fields inherited from class com.msi.network.server.RequestHandler
conn
 
Constructor Summary
CommandProcessor()
           
 
Method Summary
 void addCommand(Command c)
          Adds the specified command to the end of the list.
 java.lang.String getCommandHelp()
          Scan the list of commands retrieving each help string.
 java.lang.String getHello()
          Get the value of hello.
 java.lang.String getNoCommand()
          Get the value of noCommand.
 long getReadTO()
          Get the value of readTO.
 void insertCommand(Command c)
          Insert the specified command at the beginning of the list.
 void processRequest()
          Read a client command line and step through the command array.
 void setHello(java.lang.String v)
          Set the value of hello.
 void setNoCommand(java.lang.String v)
          Set the value of noCommand.
 void setReadTO(long v)
          Set the value of readTO.
 java.lang.String toString()
          Provide a debug string.
 
Methods inherited from class com.msi.network.server.RequestHandler
run, setConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

readTO

protected long readTO
Milliseconds to wait before closing the connection.


hello

protected java.lang.String hello
When a client connects, this String is returned. If set to null, then no response is given.


noCommand

protected java.lang.String noCommand
If the client sends an unsupported command, this String is returned. If set to null, then no response is given.


_commands

protected java.util.Vector _commands
Describe variable _commands here.

Constructor Detail

CommandProcessor

public CommandProcessor()
Method Detail

addCommand

public void addCommand(Command c)
Adds the specified command to the end of the list.

Parameters:
c - command to be added to the end of the list.

insertCommand

public void insertCommand(Command c)
Insert the specified command at the beginning of the list.

Parameters:
c - command to be added to the end of the list.

processRequest

public void processRequest()
                    throws RHException
Read a client command line and step through the command array. Upon indication of command success, the output is returned to the client. The command is checked to determine if the connection should be closed.

Overrides:
processRequest in class RequestHandler
Throws:
RHException - if an error occurs

getHello

public java.lang.String getHello()
Get the value of hello. If the sign-on string should contain the date or other variable information, this function should be over-ridden to include these elements. It is recommended that the setHello function and associated String still be used for the non-variable elements whenever possible.

Returns:
value of hello.

setHello

public void setHello(java.lang.String v)
Set the value of hello.

Parameters:
v - Value to assign to hello.

getNoCommand

public java.lang.String getNoCommand()
Get the value of noCommand.

Returns:
value of noCommand.

setNoCommand

public void setNoCommand(java.lang.String v)
Set the value of noCommand.

Parameters:
v - Value to assign to noCommand.

getCommandHelp

public java.lang.String getCommandHelp()
Scan the list of commands retrieving each help string.

Returns:
String representing command help information.

toString

public java.lang.String toString()
Provide a debug string.


getReadTO

public long getReadTO()
Get the value of readTO.

Returns:
value of readTO.

setReadTO

public void setReadTO(long v)
Set the value of readTO.

Parameters:
v - Value to assign to readTO.


Copyright © 2001-2002 MileStone Solutions, Inc. All Rights Reserved.