org.apache.sshd.server.command
Class ScpCommand

java.lang.Object
  extended by org.apache.sshd.server.command.ScpCommand
All Implemented Interfaces:
Runnable, Command, FileSystemAware

public class ScpCommand
extends Object
implements Command, Runnable, FileSystemAware

This commands provide SCP support on both server and client side. Permissions and preservation of access / modification times on files are not supported.

Author:
Apache MINA SSHD Project

Field Summary
protected  ExitCallback callback
           
protected  OutputStream err
           
protected  IOException error
           
protected static int ERROR
           
protected  InputStream in
           
protected static org.slf4j.Logger log
           
protected  String name
           
protected static int OK
           
protected  boolean optD
           
protected  boolean optF
           
protected  boolean optP
           
protected  boolean optR
           
protected  boolean optT
           
protected  boolean optV
           
protected  OutputStream out
           
protected  String path
           
protected  FileSystemView root
           
protected static int WARNING
           
 
Constructor Summary
ScpCommand(String[] args)
           
 
Method Summary
protected  void ack()
           
 void destroy()
          Destroy the shell.
protected  int readAck(boolean canEof)
           
protected  void readDir(SshFile path)
           
protected  void readFile(SshFile path)
           
protected  String readLine()
           
 void run()
           
 void setErrorStream(OutputStream err)
          Set the error stream that can be used by the shell to write its errors.
 void setExitCallback(ExitCallback callback)
          Set the callback that the shell has to call when it is closed.
 void setFileSystemView(FileSystemView view)
          Set the file system in which this shell will be executed.
 void setInputStream(InputStream in)
          Set the input stream that can be used by the shell to read input.
 void setOutputStream(OutputStream out)
          Set the output stream that can be used by the shell to write its output.
 void start(Environment env)
          Starts the shell.
protected  void writeDir(String header, SshFile path)
           
protected  void writeFile(String header, SshFile path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.slf4j.Logger log

OK

protected static final int OK
See Also:
Constant Field Values

WARNING

protected static final int WARNING
See Also:
Constant Field Values

ERROR

protected static final int ERROR
See Also:
Constant Field Values

name

protected String name

optR

protected boolean optR

optT

protected boolean optT

optF

protected boolean optF

optV

protected boolean optV

optD

protected boolean optD

optP

protected boolean optP

root

protected FileSystemView root

path

protected String path

in

protected InputStream in

out

protected OutputStream out

err

protected OutputStream err

callback

protected ExitCallback callback

error

protected IOException error
Constructor Detail

ScpCommand

public ScpCommand(String[] args)
Method Detail

setInputStream

public void setInputStream(InputStream in)
Description copied from interface: Command
Set the input stream that can be used by the shell to read input.

Specified by:
setInputStream in interface Command

setOutputStream

public void setOutputStream(OutputStream out)
Description copied from interface: Command
Set the output stream that can be used by the shell to write its output.

Specified by:
setOutputStream in interface Command

setErrorStream

public void setErrorStream(OutputStream err)
Description copied from interface: Command
Set the error stream that can be used by the shell to write its errors.

Specified by:
setErrorStream in interface Command

setExitCallback

public void setExitCallback(ExitCallback callback)
Description copied from interface: Command
Set the callback that the shell has to call when it is closed.

Specified by:
setExitCallback in interface Command

start

public void start(Environment env)
           throws IOException
Description copied from interface: Command
Starts the shell. All streams must have been set before calling this method. The command should implement Runnable, and this method should spawn a new thread like:
 Thread(this).start();
 
 

Specified by:
start in interface Command
Throws:
IOException

destroy

public void destroy()
Description copied from interface: Command
Destroy the shell. This method can be called by the SSH server to destroy the shell because the client has disconnected somehow.

Specified by:
destroy in interface Command

run

public void run()
Specified by:
run in interface Runnable

writeDir

protected void writeDir(String header,
                        SshFile path)
                 throws IOException
Throws:
IOException

writeFile

protected void writeFile(String header,
                         SshFile path)
                  throws IOException
Throws:
IOException

readLine

protected String readLine()
                   throws IOException
Throws:
IOException

readFile

protected void readFile(SshFile path)
                 throws IOException
Throws:
IOException

readDir

protected void readDir(SshFile path)
                throws IOException
Throws:
IOException

ack

protected void ack()
            throws IOException
Throws:
IOException

readAck

protected int readAck(boolean canEof)
               throws IOException
Throws:
IOException

setFileSystemView

public void setFileSystemView(FileSystemView view)
Description copied from interface: FileSystemAware
Set the file system in which this shell will be executed.

Specified by:
setFileSystemView in interface FileSystemAware


Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.