Interface SshConnection

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
MinaSshConnection

public interface SshConnection extends AutoCloseable
SSH connection interface providing secure shell connectivity and operations. All methods throw specific SSH exceptions instead of generic exceptions for better error handling.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the SSH connection and releases resources.
    void
    Establishes the SSH connection.
    exec(String command)
    Executes a command on the remote SSH server using the configured timeout.
    exec(String command, long timeoutMs)
    Executes a command on the remote SSH server.
    Opens an SFTP session for file operations.
  • Method Details

    • connect

      void connect() throws SshConnectionException
      Establishes the SSH connection.
    • exec

      ExecResult exec(String command, long timeoutMs) throws SshConnectionException
      Executes a command on the remote SSH server.
      Parameters:
      command - the command to execute
      timeoutMs - timeout in milliseconds
      Returns:
      the execution result
    • exec

      Executes a command on the remote SSH server using the configured timeout.
      Parameters:
      command - the command to execute
      Returns:
      the execution result
    • openSftp

      Opens an SFTP session for file operations.
      Returns:
      the SFTP session
    • close

      void close()
      Closes the SSH connection and releases resources.
      Specified by:
      close in interface AutoCloseable