Class SshCommandExecutor

java.lang.Object
com.scivicslab.turingworkflow.plugins.ssh.mixin.SshCommandExecutor
All Implemented Interfaces:
CommandExecutor

public class SshCommandExecutor extends Object implements CommandExecutor
Command executor that executes commands on a remote node via SSH.

Delegates all operations to the wrapped Node instance.

Since:
2.15.0
Author:
devteam@scivicslab.com
  • Constructor Details

    • SshCommandExecutor

      public SshCommandExecutor(Node node)
      Constructs an SSH command executor wrapping the given node.
      Parameters:
      node - the node to execute commands on
  • Method Details

    • execute

      public Node.CommandResult execute(String command) throws IOException
      Executes a command and returns the result.
      Specified by:
      execute in interface CommandExecutor
      Parameters:
      command - the command to execute
      Returns:
      the result of command execution
      Throws:
      IOException - if command execution fails
    • execute

      public Node.CommandResult execute(String command, Node.OutputCallback callback) throws IOException
      Executes a command and returns the result with output callback.
      Specified by:
      execute in interface CommandExecutor
      Parameters:
      command - the command to execute
      callback - the callback for real-time output (may be null)
      Returns:
      the result of command execution
      Throws:
      IOException - if command execution fails
    • executeSudo

      public Node.CommandResult executeSudo(String command) throws IOException
      Executes a command with sudo privileges.
      Specified by:
      executeSudo in interface CommandExecutor
      Parameters:
      command - the command to execute with sudo
      Returns:
      the result of command execution
      Throws:
      IOException - if command execution fails or SUDO_PASSWORD is not set
    • executeSudo

      public Node.CommandResult executeSudo(String command, Node.OutputCallback callback) throws IOException
      Executes a command with sudo privileges and output callback.
      Specified by:
      executeSudo in interface CommandExecutor
      Parameters:
      command - the command to execute with sudo
      callback - the callback for real-time output (may be null)
      Returns:
      the result of command execution
      Throws:
      IOException - if command execution fails or SUDO_PASSWORD is not set
    • getIdentifier

      public String getIdentifier()
      Gets a short identifier for this executor (e.g., hostname).
      Specified by:
      getIdentifier in interface CommandExecutor
      Returns:
      the identifier string
    • getNode

      public Node getNode()
      Gets the wrapped Node instance.
      Returns:
      the node