public class ScpCommand extends AbstractLoggingBean implements Command, Runnable, FileSystemAware
| Modifier and Type | Field and Description |
|---|---|
protected ExitCallback |
callback |
protected OutputStream |
err |
protected IOException |
error |
protected ExecutorService |
executors |
protected FileSystem |
fileSystem |
protected InputStream |
in |
protected ScpTransferEventListener |
listener |
protected String |
name |
protected boolean |
optD |
protected boolean |
optF |
protected boolean |
optP |
protected boolean |
optR |
protected boolean |
optT |
protected OutputStream |
out |
protected String |
path |
protected Future<?> |
pendingFuture |
protected int |
receiveBufferSize |
protected int |
sendBufferSize |
protected boolean |
shutdownExecutor |
log| Constructor and Description |
|---|
ScpCommand(String command,
ExecutorService executorService,
boolean shutdownOnExit,
int sendSize,
int receiveSize,
ScpTransferEventListener eventListener) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the shell.
|
void |
run() |
void |
setErrorStream(OutputStream err)
Set the error stream that can be used by the shell to write its errors.
|
void |
setExitCallback(ExitCallback callback)
Set the callback that the shell has to call when it is closed.
|
void |
setFileSystem(FileSystem fs)
Set the file system in which this shell will be executed.
|
void |
setInputStream(InputStream in)
Set the input stream that can be used by the shell to read input.
|
void |
setOutputStream(OutputStream out)
Set the output stream that can be used by the shell to write its output.
|
void |
start(Environment env)
Starts the shell.
|
String |
toString() |
protected String name
protected boolean optR
protected boolean optT
protected boolean optF
protected boolean optD
protected boolean optP
protected FileSystem fileSystem
protected String path
protected InputStream in
protected OutputStream out
protected OutputStream err
protected ExitCallback callback
protected IOException error
protected ExecutorService executors
protected boolean shutdownExecutor
protected Future<?> pendingFuture
protected int sendBufferSize
protected int receiveBufferSize
protected ScpTransferEventListener listener
public ScpCommand(String command, ExecutorService executorService, boolean shutdownOnExit, int sendSize, int receiveSize, 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 fileseventListener - An ScpTransferEventListener - may be nullThreadUtils.newSingleThreadExecutor(String),
ScpHelper.MIN_SEND_BUFFER_SIZE,
ScpHelper.MIN_RECEIVE_BUFFER_SIZEpublic void setInputStream(InputStream in)
CommandsetInputStream in interface Commandin - The InputStream used by the shell to read input.public void setOutputStream(OutputStream out)
CommandsetOutputStream in interface Commandout - The OutputStream used by the shell to write its outputpublic void setErrorStream(OutputStream err)
CommandsetErrorStream in interface Commanderr - The OutputStream used by the shell to write its errorspublic void setExitCallback(ExitCallback callback)
CommandsetExitCallback in interface Commandcallback - The ExitCallback to call when shell is closedpublic void setFileSystem(FileSystem fs)
FileSystemAwaresetFileSystem in interface FileSystemAwarefs - the file systempublic void start(Environment env) throws IOException
Command
Thread(this).start();
start in interface Commandenv - The EnvironmentIOException - If failed to startpublic void destroy()
CommandCopyright © 2008–2015 The Apache Software Foundation. All rights reserved.