Top Description Fields Constructors Methods
org.apache.sshd.scp.server

public Class ScpCommand

extends AbstractFileSystemCommand
implements ServerChannelSessionHolder
Class Inheritance
All Implemented Interfaces
org.apache.sshd.server.channel.ServerChannelSessionHolder
Imports
java.io.IOException, java.nio.charset.StandardCharsets, java.util.Collections, .Objects, org.apache.sshd.common.util.GenericUtils, org.apache.sshd.common.util.threads.CloseableExecutorService, .ThreadUtils, org.apache.sshd.scp.common.ScpException, .ScpFileOpener, .ScpHelper, .ScpTransferEventListener, org.apache.sshd.scp.common.helpers.DefaultScpFileOpener, .ScpAckInfo, org.apache.sshd.server.Environment, .ExitCallback, org.apache.sshd.server.channel.ChannelSession, .ServerChannelSessionHolder, org.apache.sshd.server.command.AbstractFileSystemCommand, org.apache.sshd.server.session.ServerSession

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

Modifier and TypeField and Description
private final ChannelSession
protected IOException
protected ScpTransferEventListener
protected final ScpFileOpener
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected String
protected final int
protected final int
Inherited from org.apache.sshd.server.command.AbstractFileSystemCommand:
fileSystem

Constructor Summary

AccessConstructor and Description
public
ScpCommand(ChannelSession
The ChannelSession through which the command was received
channelSession
,
String
The command to be executed
command
,
CloseableExecutorService
An CloseableExecutorService to be used when start(ChannelSession, Environment)-ing execution. If null an ad-hoc single-threaded service is created and used.
executorService
,
int
Size (in bytes) of buffer to use when sending files
sendSize
,
int
Size (in bytes) of buffer to use when receiving files
receiveSize
,
ScpFileOpener
The ScpFileOpener - if null then DefaultScpFileOpener is used
fileOpener
,
ScpTransferEventListener
An ScpTransferEventListener - may be null
eventListener
)

Method Summary

Modifier and TypeMethod and Description
public ChannelSession
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

public void
start(ChannelSession
The ChannelSession through which the command has been received
channel
,
Environment env)

Overrides org.apache.sshd.server.command.AbstractCommandSupport.start.

Implements org.apache.sshd.server.command.CommandLifecycle.start.

Starts the command execution.

public String
toString()

Overrides org.apache.sshd.server.command.AbstractCommandSupport.toString.

Returns a string representation of the object.

protected void
writeCommandResponseMessage(String command, int exitValue, String exitMessage)

Inherited from org.apache.sshd.server.command.AbstractFileSystemCommand:
destroygetFileSystemsetFileSystem

Field Detail

channelSessionback to summary
private final ChannelSession channelSession
errorback to summary
protected IOException error
listenerback to summary
protected ScpTransferEventListener listener
openerback to summary
protected final ScpFileOpener opener
optDback to summary
protected boolean optD
optFback to summary
protected boolean optF
optPback to summary
protected boolean optP
optRback to summary
protected boolean optR
optTback to summary
protected boolean optT
pathback to summary
protected String path
receiveBufferSizeback to summary
protected final int receiveBufferSize
sendBufferSizeback to summary
protected final int sendBufferSize

Constructor Detail

ScpCommandback to summary
public ScpCommand(ChannelSession channelSession, String command, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
Parameters
channelSession:ChannelSession

The ChannelSession through which the command was received

command:String

The command to be executed

executorService:CloseableExecutorService

An CloseableExecutorService to be used when start(ChannelSession, Environment)-ing execution. If null an ad-hoc single-threaded service is created and used.

sendSize:int

Size (in bytes) of buffer to use when sending files

receiveSize:int

Size (in bytes) of buffer to use when receiving files

fileOpener:ScpFileOpener

The ScpFileOpener - if null then DefaultScpFileOpener is used

eventListener:ScpTransferEventListener

An ScpTransferEventListener - may be null

See Also
ThreadUtils#newSingleThreadExecutor(String), ScpHelper#MIN_SEND_BUFFER_SIZE, ScpHelper#MIN_RECEIVE_BUFFER_SIZE

Method Detail

getServerChannelSessionback to summary
public ChannelSession getServerChannelSession()

Implements org.apache.sshd.server.channel.ServerChannelSessionHolder.getServerChannelSession.

Annotations
@Override
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
startback to summary
public void start(ChannelSession channel, Environment env) throws IOException

Overrides org.apache.sshd.server.command.AbstractCommandSupport.start.

Implements org.apache.sshd.server.command.CommandLifecycle.start.

Doc from org.apache.sshd.server.command.CommandLifecycle.start.

Starts the command execution. All streams must have been set before calling this method. The command should implement java.lang.Runnable, and this method should spawn a new thread like:

Thread(this).start();

Parameters
channel:ChannelSession

The ChannelSession through which the command has been received

env:Environment

The Environment

Annotations
@Override
Exceptions
IOException:
If failed to start
toStringback to summary
public String toString()

Overrides org.apache.sshd.server.command.AbstractCommandSupport.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
writeCommandResponseMessageback to summary
protected void writeCommandResponseMessage(String command, int exitValue, String exitMessage) throws IOException