public class ScpShell extends AbstractFileSystemCommand
Modifier and Type | Class and Description |
---|---|
protected static class |
ScpShell.PathEntry |
Modifier and Type | Field and Description |
---|---|
protected ChannelSession |
channel |
protected java.nio.file.Path |
currentDir |
static java.lang.String |
ENV_HOME
The "HOME" environment variable
|
static java.lang.String |
ENV_LANG
Key for the language - format "en_US.UTF-8"
|
static java.lang.String |
ENV_PWD
The "PWD" environment variable
|
protected java.nio.file.Path |
homeDir |
protected ScpTransferEventListener |
listener |
protected java.nio.charset.Charset |
nameEncodingCharset |
protected ScpFileOpener |
opener |
protected int |
receiveBufferSize |
protected int |
sendBufferSize |
static java.lang.String |
STATUS |
protected java.util.Map<java.lang.String,java.lang.Object> |
variables |
fileSystem
cbCalled, cmdRunner, executorService
log
Constructor and Description |
---|
ScpShell(ChannelSession channel,
CloseableExecutorService executorService,
int sendSize,
int receiveSize,
ScpFileOpener fileOpener,
ScpTransferEventListener eventListener) |
Modifier and Type | Method and Description |
---|---|
protected void |
cd(java.lang.String[] argv) |
protected void |
doLs(java.lang.String cmd,
java.lang.String path,
boolean optListAll,
boolean optLong,
boolean optFullTime) |
protected void |
doScp(java.lang.String path,
boolean optR,
boolean optT,
boolean optF,
boolean optD,
boolean optP) |
protected void |
echo(java.lang.String[] argv) |
protected boolean |
handleCommandLine(java.lang.String command) |
protected void |
handleUnsupportedCommand(java.lang.String command,
java.lang.String[] argv) |
protected void |
ls(java.lang.String[] argv) |
protected java.util.List<java.lang.String[]> |
parse(java.lang.String command) |
protected void |
prepareEnvironment(Environment environ) |
protected void |
printenv(java.lang.String[] argv) |
protected void |
println(java.lang.String cmd,
java.lang.Object x,
java.io.OutputStream out,
java.nio.charset.Charset cs) |
protected void |
pwd(java.lang.String[] argv) |
protected java.lang.String |
readLine(java.io.Reader reader) |
protected java.lang.String |
resolveEnvironmentVariable(java.lang.String varName,
java.util.Map<java.lang.String,java.lang.String> envValues) |
void |
run() |
protected void |
scp(java.lang.String[] argv) |
void |
setFileSystemFactory(FileSystemFactory factory,
SessionContext session)
Sets the
FileSystemFactory used to create the FileSystem to be used by the session |
protected void |
signalError(java.lang.String cmd,
java.lang.String errorMsg) |
protected void |
signalError(java.lang.String cmd,
java.lang.String errorMsg,
java.nio.charset.Charset cs) |
protected void |
unset(java.lang.String[] argv) |
protected void |
updatePwdEnvVariable(java.nio.file.Path pwd) |
destroy, getFileSystem, setFileSystem
getCommand, getEnvironment, getErrorStream, getExecutorService, getExitCallback, getInputStream, getOutputStream, getServerSession, getSession, getStartedCommandFuture, onExit, onExit, setErrorStream, setExitCallback, setInputStream, setOutputStream, setSession, start, toString
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSessionContext
public static final java.lang.String STATUS
public static final java.lang.String ENV_PWD
public static final java.lang.String ENV_HOME
public static final java.lang.String ENV_LANG
protected final ChannelSession channel
protected final java.util.Map<java.lang.String,java.lang.Object> variables
protected final java.nio.charset.Charset nameEncodingCharset
protected final ScpFileOpener opener
protected final ScpTransferEventListener listener
protected final int sendBufferSize
protected final int receiveBufferSize
protected java.nio.file.Path currentDir
protected java.nio.file.Path homeDir
public ScpShell(ChannelSession channel, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
public void setFileSystemFactory(FileSystemFactory factory, SessionContext session) throws java.io.IOException
FileSystemAware
FileSystemFactory
used to create the FileSystem
to be used by the sessionfactory
- The factory instancesession
- The SessionContext
java.io.IOException
- If failed to resolve/create the file systemFileSystemAware.setFileSystem(FileSystem)
protected void println(java.lang.String cmd, java.lang.Object x, java.io.OutputStream out, java.nio.charset.Charset cs)
protected void signalError(java.lang.String cmd, java.lang.String errorMsg)
protected void signalError(java.lang.String cmd, java.lang.String errorMsg, java.nio.charset.Charset cs)
public void run()
protected java.lang.String readLine(java.io.Reader reader) throws java.io.IOException
java.io.IOException
protected boolean handleCommandLine(java.lang.String command) throws java.lang.Exception
java.lang.Exception
protected void prepareEnvironment(Environment environ)
protected void handleUnsupportedCommand(java.lang.String command, java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
protected java.util.List<java.lang.String[]> parse(java.lang.String command)
protected void printenv(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
protected java.lang.String resolveEnvironmentVariable(java.lang.String varName, java.util.Map<java.lang.String,java.lang.String> envValues)
protected void unset(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
protected void scp(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
protected void doScp(java.lang.String path, boolean optR, boolean optT, boolean optF, boolean optD, boolean optP) throws java.lang.Exception
java.lang.Exception
protected void echo(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
protected void pwd(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
protected void cd(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
protected void updatePwdEnvVariable(java.nio.file.Path pwd)
protected void ls(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
protected void doLs(java.lang.String cmd, java.lang.String path, boolean optListAll, boolean optLong, boolean optFullTime) throws java.lang.Exception
java.lang.Exception