Class AbstractCommand

    • Field Detail

      • m_Request

        protected boolean m_Request
        whether the command is a request or response.
    • Constructor Detail

      • AbstractCommand

        public AbstractCommand()
    • Method Detail

      • setRequest

        public void setRequest​(boolean value)
        Sets whether the command is a request or response.
        Specified by:
        setRequest in interface RemoteCommand
        Parameters:
        value - true if request
      • isRequest

        public boolean isRequest()
        Returns whether the command is a request or response.
        Specified by:
        isRequest in interface RemoteCommand
        Returns:
        true if request
      • assembleRequestHeader

        protected Properties assembleRequestHeader()
        Assembles the request header.
        Returns:
        the request header
      • prepareRequestPayload

        protected void prepareRequestPayload()
        Hook method for preparing the request payload,
        Default implementation does nothing.
      • assembleRequest

        public String assembleRequest​(RemoteCommandProcessor processor)
        Assembles the command into a string, including any payload.
        Specified by:
        assembleRequest in interface RemoteCommand
        Parameters:
        processor - the processor for formatting/parsing
        Returns:
        the generated string, null if failed to assemble
      • doHandleRequest

        protected abstract String doHandleRequest​(RemoteScriptingEngine engine,
                                                  RemoteCommandProcessor processor)
        Handles the request.
        Parameters:
        engine - the remote engine handling the request
        Returns:
        null if successful, otherwise error message
      • parse

        public String parse​(Properties header)
        Parses the header information.
        Specified by:
        parse in interface RemoteCommand
        Parameters:
        header - the header
        Returns:
        null if successfully parsed, otherwise error message
      • beforeSendRequest

        public void beforeSendRequest()
        Hook method before sending the command.
        Default implementation does nothing.
        Specified by:
        beforeSendRequest in interface RemoteCommand
      • afterSendRequest

        public void afterSendRequest​(String error)
        Hook method after sending the request.
        Default implementation does nothing.
        Specified by:
        afterSendRequest in interface RemoteCommand
        Parameters:
        error - null if successful, otherwise error message