org.jclouds.sshj
Class SshjSshClient

java.lang.Object
  extended by org.jclouds.sshj.SshjSshClient
All Implemented Interfaces:
SshClient

public class SshjSshClient
extends Object
implements SshClient

This class needs refactoring. It is not thread safe.

Author:
Adrian Cole

Nested Class Summary
static interface SshjSshClient.Connection<T>
           
 
Nested classes/interfaces inherited from interface org.jclouds.ssh.SshClient
SshClient.Factory
 
Field Summary
protected  Logger logger
           
 
Constructor Summary
SshjSshClient(BackoffLimitedRetryHandler backoffLimitedRetryHandler, com.google.common.net.HostAndPort socket, LoginCredentials loginCredentials, int timeout)
           
 
Method Summary
protected
<T,C extends SshjSshClient.Connection<T>>
T
acquire(C connection)
           
 void connect()
           
 void disconnect()
           
 ExecResponse exec(String command)
          Execute a process and block until it is complete
 ExecChannel execChannel(String command)
          Execute a process and allow the user to interact with it.
protected  SshjSshClient.Connection<net.schmizz.sshj.connection.channel.direct.Session> execConnection()
           
 Payload get(String path)
           
 String getHostAddress()
           
 String getUsername()
           
protected  SshjSshClient.Connection<net.schmizz.sshj.connection.channel.direct.Session> noPTYConnection()
           
 void put(String path, Payload contents)
           
 void put(String path, String contents)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

@Named(value="jclouds.ssh")
protected Logger logger
Constructor Detail

SshjSshClient

public SshjSshClient(BackoffLimitedRetryHandler backoffLimitedRetryHandler,
                     com.google.common.net.HostAndPort socket,
                     LoginCredentials loginCredentials,
                     int timeout)
Method Detail

put

public void put(String path,
                String contents)
Specified by:
put in interface SshClient

acquire

protected <T,C extends SshjSshClient.Connection<T>> T acquire(C connection)

connect

public void connect()
Specified by:
connect in interface SshClient

get

public Payload get(String path)
Specified by:
get in interface SshClient

put

public void put(String path,
                Payload contents)
Specified by:
put in interface SshClient

toString

public String toString()
Overrides:
toString in class Object

disconnect

@PreDestroy
public void disconnect()
Specified by:
disconnect in interface SshClient

execConnection

protected SshjSshClient.Connection<net.schmizz.sshj.connection.channel.direct.Session> execConnection()

exec

public ExecResponse exec(String command)
Description copied from interface: SshClient
Execute a process and block until it is complete

Specified by:
exec in interface SshClient
Parameters:
command - command line to invoke
Returns:
output of the command

noPTYConnection

protected SshjSshClient.Connection<net.schmizz.sshj.connection.channel.direct.Session> noPTYConnection()

execChannel

public ExecChannel execChannel(String command)
Description copied from interface: SshClient
Execute a process and allow the user to interact with it. Note that this will allow the session to exist indefinitely, and its connection is not closed when SshClient.disconnect() is called.

Specified by:
execChannel in interface SshClient
Parameters:
command - command line to invoke
Returns:
reference to the running process

getHostAddress

public String getHostAddress()
Specified by:
getHostAddress in interface SshClient

getUsername

public String getUsername()
Specified by:
getUsername in interface SshClient


Copyright © 2009-2012 jclouds. All Rights Reserved.