com.sonyericsson.hudson.plugins.gerrit.gerritevents.ssh
Interface SshConnection

All Known Implementing Classes:
SshConnectionImpl

public interface SshConnection

A simple ssh client connection with private key.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Method Summary
 void disconnect()
          Disconnects the connection.
 String executeCommand(String command)
          Execute an ssh command on the server.
 com.jcraft.jsch.ChannelExec executeCommandChannel(String command)
          Execute an ssh command on the server, without closing the session so that the caller can get access to all the Channel attributes from the server.
 Reader executeCommandReader(String command)
          Execute an ssh command on the server, without closing the session so that a Reader can be returned with streaming data from the server.
 boolean isAuthenticated()
          Is the connection authenticated.
 boolean isConnected()
          Is the connection connected.
 boolean isSessionOpen()
          Returns if there already is an open session on this connection.
 

Method Detail

isConnected

boolean isConnected()
Is the connection connected.

Returns:
true if it is so.

isAuthenticated

boolean isAuthenticated()
Is the connection authenticated.

Returns:
true if it is so.

isSessionOpen

boolean isSessionOpen()
Returns if there already is an open session on this connection.

Returns:
true if it is so.

executeCommand

String executeCommand(String command)
                      throws SshException
Execute an ssh command on the server. After the command is sent the used channel is disconnected.

Parameters:
command - the command to execute.
Returns:
a String containing the output from the command.
Throws:
SshException - if so.

executeCommandReader

Reader executeCommandReader(String command)
                            throws SshException,
                                   IOException
Execute an ssh command on the server, without closing the session so that a Reader can be returned with streaming data from the server.

Parameters:
command - the command to execute.
Returns:
a Reader with streaming data from the server.
Throws:
IOException - if it is so.
SshException - if there are any ssh problems.

executeCommandChannel

com.jcraft.jsch.ChannelExec executeCommandChannel(String command)
                                                  throws SshException,
                                                         IOException
Execute an ssh command on the server, without closing the session so that the caller can get access to all the Channel attributes from the server.

Parameters:
command - the command to execute.
Returns:
a Channel with access to all streams and the exit code.
Throws:
IOException - if it is so.
SshException - if there are any ssh problems.
See Also:
executeCommandReader(String)

disconnect

void disconnect()
Disconnects the connection.



Copyright © 2004-2012 Hudson. All Rights Reserved.