Interface CommandExecutor

All Known Implementing Classes:
LocalCommandExecutor, SshCommandExecutor

public interface CommandExecutor
Abstraction for command execution that can be implemented for different contexts.

This interface allows the same action implementation to work in different execution environments:

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

    • execute

      Executes a command and returns the result.
      Parameters:
      command - the command to execute
      Returns:
      the result of command execution
      Throws:
      IOException - if command execution fails
    • execute

      Executes a command and returns the result with output callback.
      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

      Executes a command with sudo privileges.
      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

      Executes a command with sudo privileges and output callback.
      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

      Gets a short identifier for this executor (e.g., hostname).
      Returns:
      the identifier string