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 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
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
ConstructorsConstructorDescriptionScpCommand
(ChannelSession channelSession, String command, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener) -
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
void
start
(ChannelSession channel, Environment env) Starts the command execution.toString()
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
-
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
- TheChannelSession
through which the command was receivedcommand
- The command to be executedexecutorService
- AnCloseableExecutorService
to be used whenstart(ChannelSession, Environment)
-ing execution. Ifnull
an 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
- ifnull
thenDefaultScpFileOpener
is usedeventListener
- AnScpTransferEventListener
- may benull
- See Also:
-
-
Method Details
-
getServerChannelSession
- Specified by:
getServerChannelSession
in interfaceServerChannelSessionHolder
-
start
Description copied from interface:CommandLifecycle
Starts 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:
start
in interfaceCommandLifecycle
- Overrides:
start
in classAbstractCommandSupport
- Parameters:
channel
- TheChannelSession
through 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:
toString
in classAbstractCommandSupport
-