Class ScpCommand

java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.server.command.AbstractCommandSupport
org.apache.sshd.server.command.AbstractFileSystemCommand
org.apache.sshd.scp.server.ScpCommand
All Implemented Interfaces:
Runnable, org.apache.sshd.common.file.FileSystemAware, org.apache.sshd.common.session.SessionContextHolder, org.apache.sshd.common.session.SessionHolder<org.apache.sshd.server.session.ServerSession>, org.apache.sshd.common.util.threads.ExecutorServiceCarrier, org.apache.sshd.server.channel.ServerChannelSessionHolder, org.apache.sshd.server.command.Command, org.apache.sshd.server.command.CommandDirectErrorStreamAware, org.apache.sshd.server.command.CommandDirectInputStreamAware, org.apache.sshd.server.command.CommandDirectOutputStreamAware, org.apache.sshd.server.command.CommandDirectStreamsAware, org.apache.sshd.server.command.CommandLifecycle, org.apache.sshd.server.session.ServerSessionAware, org.apache.sshd.server.session.ServerSessionHolder

public class ScpCommand extends org.apache.sshd.server.command.AbstractFileSystemCommand implements org.apache.sshd.server.channel.ServerChannelSessionHolder
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

    Fields
    Modifier and Type
    Field
    Description
    protected IOException
     
     
    protected final ScpFileOpener
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
    protected String
     
    protected final int
     
    protected final int
     

    Fields inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand

    fileSystem

    Fields inherited from class org.apache.sshd.server.command.AbstractCommandSupport

    cbCalled, cmdRunner, executorService

    Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    log
  • Constructor Summary

    Constructors
    Constructor
    Description
    ScpCommand(org.apache.sshd.server.channel.ChannelSession channelSession, String command, org.apache.sshd.common.util.threads.CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.sshd.server.channel.ChannelSession
     
    void
    run()
     
    void
    start(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env)
     
     
    protected void
    writeCommandResponseMessage(String command, int exitValue, String exitMessage)
     

    Methods inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand

    destroy, getFileSystem, setFileSystem

    Methods inherited from class org.apache.sshd.server.command.AbstractCommandSupport

    getCommand, getEnvironment, getErrorStream, getExecutorService, getExitCallback, getInputStream, getOutputStream, getServerSession, getSession, getStartedCommandFuture, onExit, onExit, setErrorStream, setExitCallback, setInputStream, setOutputStream, setSession

    Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.sshd.common.file.FileSystemAware

    setFileSystemFactory

    Methods inherited from interface org.apache.sshd.common.session.SessionHolder

    getSessionContext
  • Field Details

    • sendBufferSize

      protected final int sendBufferSize
    • receiveBufferSize

      protected final int receiveBufferSize
    • opener

      protected final ScpFileOpener opener
    • optR

      protected boolean optR
    • optT

      protected boolean optT
    • optF

      protected boolean optF
    • optD

      protected boolean optD
    • optP

      protected boolean optP
    • path

      protected String path
    • error

      protected IOException error
    • listener

      protected ScpTransferEventListener listener
  • Constructor Details

    • ScpCommand

      public ScpCommand(org.apache.sshd.server.channel.ChannelSession channelSession, String command, org.apache.sshd.common.util.threads.CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
      Parameters:
      channelSession - The ChannelSession through which the command was received
      command - The command to be executed
      executorService - An CloseableExecutorService to be used when start(ChannelSession, Environment)-ing execution. If null an ad-hoc single-threaded service is created and used.
      sendSize - Size (in bytes) of buffer to use when sending files
      receiveSize - Size (in bytes) of buffer to use when receiving files
      fileOpener - The ScpFileOpener - if null then DefaultScpFileOpener is used
      eventListener - An ScpTransferEventListener - may be null
      See Also:
  • Method Details

    • getServerChannelSession

      public org.apache.sshd.server.channel.ChannelSession getServerChannelSession()
      Specified by:
      getServerChannelSession in interface org.apache.sshd.server.channel.ServerChannelSessionHolder
    • start

      public void start(org.apache.sshd.server.channel.ChannelSession channel, org.apache.sshd.server.Environment env) throws IOException
      Specified by:
      start in interface org.apache.sshd.server.command.CommandLifecycle
      Overrides:
      start in class org.apache.sshd.server.command.AbstractCommandSupport
      Throws:
      IOException
    • run

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

      protected void writeCommandResponseMessage(String command, int exitValue, String exitMessage) throws IOException
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class org.apache.sshd.server.command.AbstractCommandSupport