public class ScpCommand extends AbstractFileSystemCommand
Modifier and Type | Field and Description |
---|---|
protected java.io.IOException |
error |
protected ScpTransferEventListener |
listener |
protected ScpFileOpener |
opener |
protected boolean |
optD |
protected boolean |
optF |
protected boolean |
optP |
protected boolean |
optR |
protected boolean |
optT |
protected java.lang.String |
path |
protected int |
receiveBufferSize |
protected int |
sendBufferSize |
fileSystem
callback, cbCalled, cmdFuture, cmdRunner, command, environment, err, executorService, in, out, serverSession, shutdownOnExit
log
Constructor and Description |
---|
ScpCommand(java.lang.String command,
java.util.concurrent.ExecutorService executorService,
boolean shutdownOnExit,
int sendSize,
int receiveSize,
ScpFileOpener fileOpener,
ScpTransferEventListener eventListener) |
Modifier and Type | Method and Description |
---|---|
void |
run() |
void |
start(Environment env)
Starts the command execution.
|
java.lang.String |
toString() |
protected void |
writeCommandResponseMessage(java.lang.String command,
int exitValue,
java.lang.String exitMessage) |
destroy, getFileSystem, setFileSystem
getCommand, getEnvironment, getErrorStream, getExecutorService, getExitCallback, getInputStream, getOutputStream, getServerSession, getSession, getStartedCommandFuture, isShutdownOnExit, onExit, onExit, setErrorStream, setExitCallback, setInputStream, setOutputStream, setSession
getSimplifiedLogger
protected final int sendBufferSize
protected final int receiveBufferSize
protected final ScpFileOpener opener
protected boolean optR
protected boolean optT
protected boolean optF
protected boolean optD
protected boolean optP
protected java.lang.String path
protected java.io.IOException error
protected ScpTransferEventListener listener
public ScpCommand(java.lang.String command, java.util.concurrent.ExecutorService executorService, boolean shutdownOnExit, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
command
- The command to be executedexecutorService
- An ExecutorService
to be used when
start(Environment)
-ing execution. If null
an ad-hoc
single-threaded service is created and used.shutdownOnExit
- If true
the ExecutorService.shutdownNow()
will be called when command terminates - unless it is the ad-hoc
service, which will be shutdown regardlesssendSize
- Size (in bytes) of buffer to use when sending filesreceiveSize
- Size (in bytes) of buffer to use when receiving filesfileOpener
- The ScpFileOpener
- if null
then DefaultScpFileOpener
is usedeventListener
- An ScpTransferEventListener
- may be null
ThreadUtils.newSingleThreadExecutor(String)
,
ScpHelper.MIN_SEND_BUFFER_SIZE
,
ScpHelper.MIN_RECEIVE_BUFFER_SIZE
public void start(Environment env) throws java.io.IOException
CommandLifecycle
Runnable
,
and this method should spawn a new thread like:
Thread(this).start();
start
in interface CommandLifecycle
start
in class AbstractCommandSupport
env
- The Environment
java.io.IOException
- If failed to startpublic void run()
protected void writeCommandResponseMessage(java.lang.String command, int exitValue, java.lang.String exitMessage) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class AbstractCommandSupport