com.mindbright.ssh2
Class SSH2SimpleSFTPShell

java.lang.Object
  extended bycom.mindbright.ssh2.SSH2SimpleSFTPShell
All Implemented Interfaces:
java.lang.Runnable

public final class SSH2SimpleSFTPShell
extends java.lang.Object
implements java.lang.Runnable

This class implements a basic interactive sftp session. It opens a terminal window in which the user may interact with sftp using typed commands.


Nested Class Summary
static class SSH2SimpleSFTPShell.ProgressBar
          Class implementing a progress bar which gets printed in a terminal window.
 
Constructor Summary
SSH2SimpleSFTPShell(SSH2Connection connection, java.lang.String title)
          This constructor needs an open connection to the server and a window name.
 
Method Summary
 void doHelp()
          Print help text.
 java.lang.String expandLocal(java.lang.String name)
          If needed, expand the given filename to include full path on the local side.
 java.lang.String expandRemote(java.lang.String name)
          If needed, expand the given filename to include full path on the remote side.
 java.lang.String getNextArg(java.lang.String args)
          Extract the next argument from a space-separated list of arguments.
 TerminalWin getTerminal()
           
 java.lang.String[] makeArgv(java.lang.String cmdLine)
          Split a command line into arguments.
 void run()
          The thread running this gets created in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSH2SimpleSFTPShell

public SSH2SimpleSFTPShell(SSH2Connection connection,
                           java.lang.String title)
This constructor needs an open connection to the server and a window name. It will create an sftp session on the connection and popup a new terminal window with the given title. It will also spawn a thread to run the sftp session.

Parameters:
connection - The connection to use.
title - Title of window.
Method Detail

run

public void run()
The thread running this gets created in the constructor. So there is no need to call this function explicitely.

Specified by:
run in interface java.lang.Runnable

expandRemote

public java.lang.String expandRemote(java.lang.String name)
If needed, expand the given filename to include full path on the remote side.

Parameters:
name - Name to expand
Returns:
A full path.

expandLocal

public java.lang.String expandLocal(java.lang.String name)
If needed, expand the given filename to include full path on the local side.

Parameters:
name - Name to expand
Returns:
A full path.

getNextArg

public java.lang.String getNextArg(java.lang.String args)
Extract the next argument from a space-separated list of arguments.

Parameters:
args - List of arguments. This list is modified in the process.
Returns:
The fisr argument in the list.

makeArgv

public java.lang.String[] makeArgv(java.lang.String cmdLine)
Split a command line into arguments. This will split the given command line into individual arguments. The arguments are assumed to be separated by spaces. There is no quote handling or escape mechanism.

Parameters:
cmdLine - Command line to extract arguments from.
Returns:
An ordered array of arguments.

doHelp

public void doHelp()
Print help text.


getTerminal

public TerminalWin getTerminal()