Package org.apache.sshd.scp.server
Class ScpCommand
- All Implemented Interfaces:
Runnable,FileSystemAware,SessionContextHolder,SessionHolder<ServerSession>,ExecutorServiceCarrier,ServerChannelSessionHolder,Command,CommandDirectErrorStreamAware,CommandDirectInputStreamAware,CommandDirectOutputStreamAware,CommandDirectStreamsAware,CommandLifecycle,ServerSessionAware,ServerSessionHolder
This commands provide SCP support on both server and client side. Permissions and preservation of access /
modification times on files are not supported.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ChannelSessionprotected IOExceptionprotected ScpTransferEventListenerprotected final ScpFileOpenerprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected Stringprotected final intprotected final intFields inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand
fileSystemFields inherited from class org.apache.sshd.server.command.AbstractCommandSupport
cbCalled, cmdRunner, executorServiceFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionScpCommand(ChannelSession channelSession, String command, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener) -
Method Summary
Modifier and TypeMethodDescriptionvoidrun()voidstart(ChannelSession channel, Environment env) Starts the command execution.toString()protected voidwriteCommandResponseMessage(String command, int exitValue, String exitMessage) Methods inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand
destroy, getFileSystem, setFileSystemMethods 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, setSessionMethods 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, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.file.FileSystemAware
setFileSystemFactoryMethods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
Field Details
-
sendBufferSize
protected final int sendBufferSize -
receiveBufferSize
protected final int receiveBufferSize -
opener
-
optR
protected boolean optR -
optT
protected boolean optT -
optF
protected boolean optF -
optD
protected boolean optD -
optP
protected boolean optP -
path
-
error
-
listener
-
channelSession
-
-
Constructor Details
-
ScpCommand
public ScpCommand(ChannelSession channelSession, String command, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener) - Parameters:
channelSession- TheChannelSessionthrough which the command was receivedcommand- The command to be executedexecutorService- AnCloseableExecutorServiceto be used whenstart(ChannelSession, Environment)-ing execution. Ifnullan ad-hoc single-threaded service is created and used.sendSize- Size (in bytes) of buffer to use when sending filesreceiveSize- Size (in bytes) of buffer to use when receiving filesfileOpener- TheScpFileOpener- ifnullthenDefaultScpFileOpeneris usedeventListener- AnScpTransferEventListener- may benull- See Also:
-
-
Method Details
-
getServerChannelSession
- Specified by:
getServerChannelSessionin interfaceServerChannelSessionHolder
-
start
Description copied from interface:CommandLifecycleStarts the command execution. All streams must have been set before calling this method. The command should implementRunnable, and this method should spawn a new thread like:Thread(this).start();- Specified by:
startin interfaceCommandLifecycle- Overrides:
startin classAbstractCommandSupport- Parameters:
channel- TheChannelSessionthrough which the command has been receivedenv- TheEnvironment- Throws:
IOException- If failed to start
-
run
public void run() -
writeCommandResponseMessage
protected void writeCommandResponseMessage(String command, int exitValue, String exitMessage) throws IOException - Throws:
IOException
-
toString
- Overrides:
toStringin classAbstractCommandSupport
-