J-Sim v1.2.1-p7 API

drcl.ruv
Class ShellContract

java.lang.Object
  extended bydrcl.comp.Contract
      extended bydrcl.ruv.ShellContract

public class ShellContract
extends Contract

The Shell contract. This contract defines the following services at the reactor:

ExecuteFile
The initiator sends a request that consists of:
  1. an integer of value 0 (the "execute file" command),
  2. the name of the script file (String).
  3. arguments (String[]), may be null.
In response, the reactor opens the file and executes the scripts in the file.
ExecuteCommands
The initiator sends a request that consists of:
  1. an integer of value 1 (the "execute commands" command) and
  2. the commands (String).
In response, the reactor executes the command and replies "CommandFinished".
Autocomplete
The initiator sends a request that consists of:
  1. an integer of value 2 (the "autocomplete" command),
  2. The command in construction (String) and
  3. The position in the command for autocomplete (int).
In response, the reactor sends back the result by "SetCommand" and "CommandFinished".
Interrupt
The initiator sends a request that consists of only a field of integer 3 (the "interrupt" command). In response, the reactor interrupts the command that is currently being executed or the partial command that is currently being constructed, and replies with "CommandFinished".
The reactor may send back the following replies in response of a request:
CommandFinished
The initiator sends a message that consists of:
  1. an integer of value 3 (the "command finished" command), and
  2. a new prompt (String), may be null.
SetCommand
The initiator sends a message that consists of:
  1. an integer of value 4 (the "set command" command),
  2. The command in construction (String) and
  3. The current position in the command (int).
PrintResult
The initiator sends a message that consists of:
  1. an integer of value 5 (the "result" command), and
  2. The result (String).


Nested Class Summary
static class ShellContract.Message
           
 
Field Summary
static int AUTOCOMPLETE
           
static int COMMAND_FINISHED
           
static int EXECUTE_COMMANDS
           
static int EXECUTE_FILE
           
static ShellContract INSTANCE
           
static int INTERRUPT
           
static int PRINT_RESULT
           
static java.lang.String REPLY
           
static java.lang.String REQUEST
           
static int SET_COMMAND
           
 
Fields inherited from class drcl.comp.Contract
Role_INITIATOR, Role_PEER, Role_REACTOR
 
Constructor Summary
ShellContract()
           
 
Method Summary
static void commandFinished(java.lang.String prompt_, Port p_, boolean lastSend_)
           
static ShellContract.Message createAutocompleteRequest(java.lang.String cmd_, int pos_)
           
static ShellContract.Message createCommandFinishedReply(java.lang.String prompt_)
           
static ShellContract.Message createExecuteCommandsRequest(java.lang.String cmd_)
           
static ShellContract.Message createExecuteFileRequest(java.lang.String fname_, java.lang.String[] args_)
           
static ShellContract.Message createInterruptRequest()
           
static ShellContract.Message createPrintResultReply(java.lang.String result_)
           
static ShellContract.Message createSetCommandReply(java.lang.String cmd_, int pos_)
           
 java.lang.Object getContractContent()
          Returns the content of this contract (format?).
 java.lang.String getName()
           
static void printResult(java.lang.String result_, Port p_, boolean lastSend_)
           
static void setCommand(java.lang.String cmd_, int pos_, Port p_, boolean lastSend_)
           
 
Methods inherited from class drcl.comp.Contract
getRole, match, setRole
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ShellContract INSTANCE

REQUEST

public static final java.lang.String REQUEST
See Also:
Constant Field Values

REPLY

public static final java.lang.String REPLY
See Also:
Constant Field Values

EXECUTE_FILE

public static final int EXECUTE_FILE
See Also:
Constant Field Values

EXECUTE_COMMANDS

public static final int EXECUTE_COMMANDS
See Also:
Constant Field Values

AUTOCOMPLETE

public static final int AUTOCOMPLETE
See Also:
Constant Field Values

INTERRUPT

public static final int INTERRUPT
See Also:
Constant Field Values

COMMAND_FINISHED

public static final int COMMAND_FINISHED
See Also:
Constant Field Values

SET_COMMAND

public static final int SET_COMMAND
See Also:
Constant Field Values

PRINT_RESULT

public static final int PRINT_RESULT
See Also:
Constant Field Values
Constructor Detail

ShellContract

public ShellContract()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class Contract

getContractContent

public java.lang.Object getContractContent()
Description copied from class: Contract
Returns the content of this contract (format?).

Specified by:
getContractContent in class Contract

createExecuteFileRequest

public static ShellContract.Message createExecuteFileRequest(java.lang.String fname_,
                                                             java.lang.String[] args_)

createExecuteCommandsRequest

public static ShellContract.Message createExecuteCommandsRequest(java.lang.String cmd_)

createInterruptRequest

public static ShellContract.Message createInterruptRequest()

createAutocompleteRequest

public static ShellContract.Message createAutocompleteRequest(java.lang.String cmd_,
                                                              int pos_)

createSetCommandReply

public static ShellContract.Message createSetCommandReply(java.lang.String cmd_,
                                                          int pos_)

createCommandFinishedReply

public static ShellContract.Message createCommandFinishedReply(java.lang.String prompt_)

createPrintResultReply

public static ShellContract.Message createPrintResultReply(java.lang.String result_)

setCommand

public static void setCommand(java.lang.String cmd_,
                              int pos_,
                              Port p_,
                              boolean lastSend_)

commandFinished

public static void commandFinished(java.lang.String prompt_,
                                   Port p_,
                                   boolean lastSend_)

printResult

public static void printResult(java.lang.String result_,
                               Port p_,
                               boolean lastSend_)

J-Sim v1.2.1-p7 API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~