Class AbstractRemoteCommandAction

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.scripting.processor.RemoteCommandProcessor m_CommandProcessor
      the command processor.
      protected adams.terminal.application.AbstractTerminalApplication m_Owner
      the owning application.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(AbstractRemoteCommandAction o)
      Uses category and title for sorting.
      protected adams.scripting.engine.DefaultScriptingEngine configureEngine​(adams.scripting.responsehandler.ResponseHandler responseHandler, int defPort)
      Returns new instance of a configured scripting engine.
      protected abstract void doRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
      Actual execution.
      boolean equals​(Object obj)
      Checks whether the obj is the same definition (using category/title).
      adams.scripting.processor.RemoteCommandProcessor getCommandProcessor()
      Returns the command processor in use.
      protected LogTextBox getLogTextBox()
      Returns the LogTextBox to use.
      adams.terminal.application.AbstractTerminalApplication getOwner()
      Returns the owning application.
      Runnable getRunnable​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
      Returns the Runnable to use.
      abstract String getTitle()
      Returns the title of the action.
      protected void initialize()
      Initializes members.
      void logError​(String msg)
      Logs the error.
      void logError​(String msg, Throwable t)
      Logs the error.
      void logMessage​(String msg)
      Logs the message.
      protected void postRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
      Cleans up after the execution.
      protected void preRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
      Prepares before the execution.
      void sendCommand​(adams.scripting.command.RemoteCommand cmd, adams.scripting.processor.RemoteCommandProcessor processor, adams.core.base.BaseHostname remote)
      Sends the specified command, not waiting for a response.
      void sendCommandWithReponse​(adams.scripting.command.RemoteCommandWithResponse cmd, adams.scripting.processor.RemoteCommandProcessor processor, adams.scripting.responsehandler.ResponseHandler responseHandler, adams.core.base.BaseHostname local, adams.core.base.BaseHostname remote, int defPort)
      Sends the specified command and the response handler for intercepting the result.
      void setCommandProcessor​(adams.scripting.processor.RemoteCommandProcessor value)
      Sets the command processor to use.
      void setOwner​(adams.terminal.application.AbstractTerminalApplication value)
      Sets the owning application.
    • Field Detail

      • m_Owner

        protected adams.terminal.application.AbstractTerminalApplication m_Owner
        the owning application.
      • m_CommandProcessor

        protected adams.scripting.processor.RemoteCommandProcessor m_CommandProcessor
        the command processor.
    • Constructor Detail

      • AbstractRemoteCommandAction

        public AbstractRemoteCommandAction()
        Initializes the action with no owner.
      • AbstractRemoteCommandAction

        public AbstractRemoteCommandAction​(adams.terminal.application.AbstractTerminalApplication owner)
        Initializes the action.
        Parameters:
        owner - the owning application
    • Method Detail

      • initialize

        protected void initialize()
        Initializes members.
      • setOwner

        public void setOwner​(adams.terminal.application.AbstractTerminalApplication value)
        Sets the owning application.
        Parameters:
        value - the owner
      • getOwner

        public adams.terminal.application.AbstractTerminalApplication getOwner()
        Returns the owning application.
        Returns:
        the owner
      • setCommandProcessor

        public void setCommandProcessor​(adams.scripting.processor.RemoteCommandProcessor value)
        Sets the command processor to use.
        Specified by:
        setCommandProcessor in interface adams.scripting.processor.RemoteCommandProcessorHandler
        Parameters:
        value - the processor
      • getCommandProcessor

        public adams.scripting.processor.RemoteCommandProcessor getCommandProcessor()
        Returns the command processor in use.
        Specified by:
        getCommandProcessor in interface adams.scripting.processor.RemoteCommandProcessorHandler
        Returns:
        the processor
      • getTitle

        public abstract String getTitle()
        Returns the title of the action.
        Returns:
        the title
      • getLogTextBox

        protected LogTextBox getLogTextBox()
        Returns the LogTextBox to use.
        Returns:
        the log to use
      • logMessage

        public void logMessage​(String msg)
        Logs the message.
        Parameters:
        msg - the message to log
      • logError

        public void logError​(String msg)
        Logs the error.
        Parameters:
        msg - the error message to log
      • logError

        public void logError​(String msg,
                             Throwable t)
        Logs the error.
        Parameters:
        msg - the error message to log
        t - the exception
      • configureEngine

        protected adams.scripting.engine.DefaultScriptingEngine configureEngine​(adams.scripting.responsehandler.ResponseHandler responseHandler,
                                                                                int defPort)
        Returns new instance of a configured scripting engine.
        Parameters:
        responseHandler - the handler to use for intercepting the result, can be null
        defPort - the default port to use
        Returns:
        the engine
      • sendCommand

        public void sendCommand​(adams.scripting.command.RemoteCommand cmd,
                                adams.scripting.processor.RemoteCommandProcessor processor,
                                adams.core.base.BaseHostname remote)
        Sends the specified command, not waiting for a response.
        Parameters:
        cmd - the command to send
        processor - the processor for formatting/parsing
        remote - the remote host
      • sendCommandWithReponse

        public void sendCommandWithReponse​(adams.scripting.command.RemoteCommandWithResponse cmd,
                                           adams.scripting.processor.RemoteCommandProcessor processor,
                                           adams.scripting.responsehandler.ResponseHandler responseHandler,
                                           adams.core.base.BaseHostname local,
                                           adams.core.base.BaseHostname remote,
                                           int defPort)
        Sends the specified command and the response handler for intercepting the result.
        Parameters:
        cmd - the command to send
        processor - the processor for formatting/parsing
        responseHandler - the response handler for intercepting the result, can be null
        local - the local host
        remote - the remote host
        defPort - the default port to use
      • preRun

        protected void preRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
        Prepares before the execution.
        Parameters:
        context - the context to use
      • doRun

        protected abstract void doRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
        Actual execution.
        Parameters:
        context - the context to use
      • postRun

        protected void postRun​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
        Cleans up after the execution.
        Parameters:
        context - the context to use
      • getRunnable

        public Runnable getRunnable​(com.googlecode.lanterna.gui2.WindowBasedTextGUI context)
        Returns the Runnable to use.
        Parameters:
        context - the context to use
        Returns:
        the runnable
      • equals

        public boolean equals​(Object obj)
        Checks whether the obj is the same definition (using category/title).
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to compare with
        Returns:
        true if the same definition
        See Also:
        compareTo(AbstractRemoteCommandAction)