Package org.apache.sshd.scp.server
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,SessionContextHolder,SessionHolder<ServerSession>,org.apache.sshd.common.util.threads.ExecutorServiceCarrier,ServerChannelSessionHolder,Command,CommandDirectErrorStreamAware,CommandDirectInputStreamAware,CommandDirectOutputStreamAware,CommandDirectStreamsAware,CommandLifecycle,ServerSessionAware,ServerSessionHolder
public class ScpCommand extends AbstractFileSystemCommand implements 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 IOExceptionerrorprotected ScpTransferEventListenerlistenerprotected ScpFileOpeneropenerprotected booleanoptDprotected booleanoptFprotected booleanoptPprotected booleanoptRprotected booleanoptTprotected Stringpathprotected intreceiveBufferSizeprotected intsendBufferSize-
Fields inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand
fileSystem
-
Fields inherited from class org.apache.sshd.server.command.AbstractCommandSupport
cbCalled, cmdRunner, executorService
-
-
Constructor Summary
Constructors Constructor Description ScpCommand(ChannelSession channelSession, String command, org.apache.sshd.common.util.threads.CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelSessiongetServerChannelSession()voidrun()voidstart(ChannelSession channel, Environment env)StringtoString()protected voidwriteCommandResponseMessage(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.session.SessionHolder
getSessionContext
-
-
-
-
Field Detail
-
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 Detail
-
ScpCommand
public ScpCommand(ChannelSession channelSession, String command, org.apache.sshd.common.util.threads.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:
ThreadUtils.newSingleThreadExecutor(String),ScpHelper.MIN_SEND_BUFFER_SIZE,ScpHelper.MIN_RECEIVE_BUFFER_SIZE
-
-
Method Detail
-
getServerChannelSession
public ChannelSession getServerChannelSession()
- Specified by:
getServerChannelSessionin interfaceServerChannelSessionHolder
-
start
public void start(ChannelSession channel, Environment env) throws IOException
- Specified by:
startin interfaceCommandLifecycle- Overrides:
startin classAbstractCommandSupport- Throws:
IOException
-
writeCommandResponseMessage
protected void writeCommandResponseMessage(String command, int exitValue, String exitMessage) throws IOException
- Throws:
IOException
-
toString
public String toString()
- Overrides:
toStringin classAbstractCommandSupport
-
-