Package adams.scripting.command
Interface RemoteCommand
-
- All Superinterfaces:
Destroyable,LoggingSupporter,OptionHandler,Serializable
- All Known Subinterfaces:
FlowAwareRemoteCommand,RemoteCommandOnFlow,RemoteCommandWithErrorMessage,RemoteCommandWithResponse
- All Known Implementing Classes:
AbstractCommand,AbstractCommandWithFlowStopping,AbstractCommandWithResponse,AbstractFlowAwareCommand,AbstractFlowAwareCommandWithResponse,AbstractRemoteCommandOnFlowWithResponse,DeregisterWorker,GetFlow,JobRunner,Kill,KillWorkers,ListFlows,MenuItem,Ping,RegisterWorker,RemoteFlowExecution,Restart,RestartFlow,RetrieveFile,RunRemoteFlow,SendFile,SendFlowControlCommand,StartRemoteLogging,Stop,StopEngine,StopRemoteLogging,SystemInfo,Text
public interface RemoteCommand extends OptionHandler, Serializable, LoggingSupporter
Interface for remote commands. A string representation of a command consists of two parse: header and (optional) payload. The header is a commented out Java Properties string representation. The payload is a base64-encoded byte array.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_COMMANDthe key for the command in the header section of a command.static StringKEY_TYPEthe key for the type in the header section of a command (Request|Resonse).static StringVALUE_REQUESTthe Request value (type key).static StringVALUE_RESPONSEthe Response value (type key).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidafterSendRequest(String error)Hook method after sending the request.StringassembleRequest(RemoteCommandProcessor processor)Assembles the command into a string, including any payload.voidbeforeSendRequest()Hook method before sending the request.RemoteScriptingEngineHandlergetRemoteScriptingEngineHandler()Returns the application context.byte[]getRequestPayload()Returns the payload of the request, if any.Object[]getRequestPayloadObjects()Returns the objects that represent the request payload.voidhandleRequest(RemoteScriptingEngine engine, RemoteCommandProcessor processor, RequestHandler handler)Handles the request.booleanisRequest()Returns whether the command is a request or response.Stringparse(Properties header)Parses the header information.voidsetRemoteScriptingEngineHandler(RemoteScriptingEngineHandler value)Sets the application context.voidsetRequest(boolean value)Sets whether the command is a request or response.voidsetRequestPayload(byte[] value)Sets the payload for the request.-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
KEY_COMMAND
static final String KEY_COMMAND
the key for the command in the header section of a command.- See Also:
- Constant Field Values
-
KEY_TYPE
static final String KEY_TYPE
the key for the type in the header section of a command (Request|Resonse).- See Also:
- Constant Field Values
-
VALUE_REQUEST
static final String VALUE_REQUEST
the Request value (type key).- See Also:
- Constant Field Values
-
VALUE_RESPONSE
static final String VALUE_RESPONSE
the Response value (type key).- See Also:
- Constant Field Values
-
-
Method Detail
-
setRemoteScriptingEngineHandler
void setRemoteScriptingEngineHandler(RemoteScriptingEngineHandler value)
Sets the application context.- Parameters:
value- the context
-
getRemoteScriptingEngineHandler
RemoteScriptingEngineHandler getRemoteScriptingEngineHandler()
Returns the application context.- Returns:
- the context, null if none set
-
parse
String parse(Properties header)
Parses the header information.- Parameters:
header- the header- Returns:
- null if successfully parsed, otherwise error message
-
setRequest
void setRequest(boolean value)
Sets whether the command is a request or response.- Parameters:
value- true if request
-
isRequest
boolean isRequest()
Returns whether the command is a request or response.- Returns:
- true if request
-
setRequestPayload
void setRequestPayload(byte[] value)
Sets the payload for the request.- Parameters:
value- the payload
-
getRequestPayload
byte[] getRequestPayload()
Returns the payload of the request, if any.- Returns:
- the payload
-
getRequestPayloadObjects
Object[] getRequestPayloadObjects()
Returns the objects that represent the request payload.- Returns:
- the objects
-
assembleRequest
String assembleRequest(RemoteCommandProcessor processor)
Assembles the command into a string, including any payload.- Parameters:
processor- the command processor to use for formatting- Returns:
- the generated string, null if failed to assemble
-
handleRequest
void handleRequest(RemoteScriptingEngine engine, RemoteCommandProcessor processor, RequestHandler handler)
Handles the request.- Parameters:
engine- the remote engine handling the requestprocessor- the command processor to use for formattinghandler- for handling the request
-
beforeSendRequest
void beforeSendRequest()
Hook method before sending the request.
-
afterSendRequest
void afterSendRequest(String error)
Hook method after sending the request.- Parameters:
error- null if successful, otherwise error message
-
-