drcl.ruv
Class ShellContract
java.lang.Object
drcl.comp.Contract
drcl.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:
- an integer of value 0 (the "execute file" command),
- the name of the script file (String).
- 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:
- an integer of value 1 (the "execute commands" command) and
- the commands (String).
In response, the reactor executes the command and replies "CommandFinished".
-
Autocomplete
- The initiator sends a request that consists of:
- an integer of value 2 (the "autocomplete" command),
- The command in construction (String) and
- 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:
- an integer of value 3 (the "command finished" command), and
- a new prompt (String), may be null.
-
SetCommand
- The initiator sends a message that consists of:
- an integer of value 4 (the "set command" command),
- The command in construction (String) and
- The current position in the command (int).
-
PrintResult
- The initiator sends a message that consists of:
- an integer of value 5 (the "result" command), and
- The result (String).
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
ShellContract
public ShellContract()
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_)
Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved. ~ To J-Sim Home ~