Class SSHController


  • public final class SSHController
    extends Object
    Provides all methods to handle SSH-Connections and SSHPortForwardings.
    • Method Detail

      • delForwarding

        public void delForwarding​(boolean removeFromMap,
                                  SSHPortForwarding... sshPortForwardings)
        Deletes all Port-Forwardings from the internal database.
        Parameters:
        removeFromMap - should all disconnected connections be cleared from the internal cache?
        sshPortForwardings - Port-Forwardings to be deleted
      • loadFromSSHConnectionsConfigs

        public List<SSHConnection> loadFromSSHConnectionsConfigs()
        Loads all SSH-Connections from the internal database.
        Returns:
      • loadFromSSHForwardingsConfigs

        public List<SSHPortForwarding> loadFromSSHForwardingsConfigs()
        Loads all Port-Forwardings from the internal database.
        Returns:
      • addConnection

        public void addConnection​(SSHConnection... connections)
      • removeConnection

        public void removeConnection​(SSHConnection... connections)
      • disconnectAll

        public void disconnectAll​(boolean removeFromMap)
        Dissconects all SSH-Connections if possible.
        Parameters:
        removeFromMap - should all disconnected connections be cleared from the internal cache?
      • disconnect

        public void disconnect​(boolean removeFromMap,
                               SSHConnection... connections)
        Dissconects all given SSH-Connections if possible.
        Parameters:
        removeFromMap - should all disconnected connections be cleared from the internal cache?
        connections - connections to be discconected
      • connectAll

        public void connectAll()
        Establishes a connection to all configured SSH-Connections.
      • forwardAll

        public void forwardAll()
        Establishes all Port-Forwardings to of all configured SSH-Connections.
      • connect

        public void connect​(SSHConnection... connections)
                     throws Exception
        Establishes an SSH-Connection via its user+password.
        Make sure all environment settings like for example a "VPN-Tunnel" are ready to use.
        You can see if a session is established in the log-files.
        Parameters:
        connections -
        Throws:
        Exception
      • forward

        public void forward​(SSHPortForwarding... sshPortForwardings)
        Establishes all Port-Forwardings which are configured in the database-explorer.
        Parameters:
        sshPortForwardings -
      • forward

        public void forward​(SSHConnection... sshConnections)
        Establishes a Port-Forwarding to all SSH-Connections which are configured in the database-explorer.
        Parameters:
        sshConnections -
      • getAllForwardings

        public List<SSHPortForwarding> getAllForwardings()
        Returns a list of all established Port-Forwardings.
        Returns:
      • saveForwardings

        public void saveForwardings()
        Save all Port-Forwardings persistently.