public class SshConnectionImpl extends Object implements SshConnection
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CMD_EXEC
SSH Command to open an "exec channel".
|
| Modifier | Constructor and Description |
|---|---|
protected |
SshConnectionImpl(String host,
int port,
Authentication authentication)
Creates and opens a SshConnection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
disconnect()
Disconnects the connection.
|
String |
executeCommand(String command)
Execute an ssh command on the server.
|
com.jcraft.jsch.ChannelExec |
executeCommandChannel(String command)
This version takes a command to run, and then returns a wrapper instance
that exposes all the standard state of the channel (stdin, stdout,
stderr, exit status, etc).
|
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.
|
protected static final String CMD_EXEC
protected SshConnectionImpl(String host, int port, Authentication authentication) throws SshException, IOException
host - the host to connect to.port - the port.authentication - the authentication-infoSshException - if something happens - usually due to bad config.IOException - if the unfortunate happens.public boolean isConnected()
isConnected in interface SshConnectionpublic boolean isAuthenticated()
isAuthenticated in interface SshConnectionpublic boolean isSessionOpen()
isSessionOpen in interface SshConnectionpublic String executeCommand(String command) throws SshException
executeCommand in interface SshConnectioncommand - the command to execute.SshException - if so.public Reader executeCommandReader(String command) throws SshException, IOException
executeCommandReader in interface SshConnectioncommand - the command to execute.IOException - if it is so.SshException - if there are any ssh problems.public com.jcraft.jsch.ChannelExec executeCommandChannel(String command) throws SshException, IOException
executeCommandChannel in interface SshConnectioncommand - the command to execute.IOException - if it is so.SshException - if there are any ssh problems.executeCommandReader(String)public void disconnect()
disconnect in interface SshConnectionCopyright © 2004-2015 Hudson. All Rights Reserved.