| java.lang.Object com.ericdaugherty.sshwebproxy.SshConnection
SshConnection | public class SshConnection implements SshConstants(Code) | | SshConnection represents an Ssh connection
between the local host and a remote ssh daemon.
A single SshConnection may contain multiple channels,
which may be file transfer channels or shell channels.
author: Eric Daugherty |
Constructor Summary | |
public | SshConnection(SshClient sshClient, String connectionInfo) Initialize a new SshConnection with the SshClient connection. | public | SshConnection(String host, int port, String username, String password) Create a new SshConnection to the specified location
with the specified username and password. | public | SshConnection(String host, int port, String username, byte[] key, String keyPassPhrase) Create a new SshConnection to the specified location
with the specified username and key. |
SshConnection | public SshConnection(SshClient sshClient, String connectionInfo)(Code) | | Initialize a new SshConnection with the SshClient connection.
Parameters: sshClient - the sshClient that represents the connection. |
SshConnection | public SshConnection(String host, int port, String username, String password) throws SshConnectException(Code) | | Create a new SshConnection to the specified location
with the specified username and password.
Parameters: host - the remote host to connect to. Parameters: port - the port to connect to. Parameters: username - the username to login with. Parameters: password - the password to login with. throws: SshConnectException - thrown if the connection attempt failes for any reason. |
SshConnection | public SshConnection(String host, int port, String username, byte[] key, String keyPassPhrase) throws SshConnectException(Code) | | Create a new SshConnection to the specified location
with the specified username and key.
Parameters: host - the remote host to connect to. Parameters: port - the port to connect to. Parameters: username - the username to login with. Parameters: key - the SSH Key as a byte array. Parameters: keyPassPhrase - the passPharse for the key (optional) throws: SshConnectException - thrown if the connection attempt failes for any reason. |
close | public void close()(Code) | | Closes all open channels and the current SshConnection.
|
closeChannel | public void closeChannel(String channelId)(Code) | | Close a specfic channel. This calls channel.close()
and removes it from the channel list.
Parameters: channelId - the channel to remove. |
closeChannel | public void closeChannel(SshChannel sshChannel)(Code) | | Close a specfic channel. This calls channel.close()
and removes it from the channel list.
Parameters: sshChannel - the channel to remove. |
getChannel | public SshChannel getChannel(String channelId)(Code) | | Returns the requested channel.
Parameters: channelId - the channel's unique id. the requested channel, or null if it does not exist. |
getConnectionInfo | public String getConnectionInfo()(Code) | | Returns information about this connection. The information
consists of the username, the host, and the port. The result
is formatted as: username@host:port
formated string: username@host:port |
getConnectionInfo | public static String getConnectionInfo(String host, String port, String username)(Code) | | Helper method to return the connection info.
Parameters: host - Parameters: port - Parameters: username - a propertly formatted connection info string. |
getConnectionInfo | public static String getConnectionInfo(String host, int port, String username)(Code) | | Helper method to return the connection info.
Parameters: host - Parameters: port - Parameters: username - a propertly formatted connection info string. |
getFileChannel | public FileChannel getFileChannel(String channelId)(Code) | | Returns the requested channel.
Parameters: channelId - the channel's unique id. the requested channel, or null if it does not exist. |
getShellChannel | public ShellChannel getShellChannel(String channelId)(Code) | | Returns the requested channel.
Parameters: channelId - the channel's unique id. the requested channel, or null if it does not exist. |
getShellChannels | public Collection getShellChannels()(Code) | | Returns a collection of all ShellChannels associated with this
connection.
will never be null. |
isOpen | public boolean isOpen()(Code) | | Returns true if this SshConnection is open.
true if it is open. |
toString | public String toString()(Code) | | Return a string representation of this connection.
|
|
|