public class ScpShell extends AbstractFileSystemCommand implements ServerChannelSessionHolder
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ScpShell.PathEntry |
| Modifier and Type | Field and Description |
|---|---|
private ChannelSession |
channelSession |
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.charset.Charset |
envVarsEnodingCharset |
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 |
fileSystemcbCalled, cmdRunner, executorServicelog| Constructor and Description |
|---|
ScpShell(ChannelSession channelSession,
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) |
ChannelSession |
getServerChannelSession() |
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, setFileSystemgetCommand, getEnvironment, getErrorStream, getExecutorService, getExitCallback, getInputStream, getOutputStream, getServerSession, getSession, getStartedCommandFuture, onExit, onExit, setErrorStream, setExitCallback, setInputStream, setOutputStream, setSession, start, toStringdebug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSessionContextpublic 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 java.util.Map<java.lang.String,java.lang.Object> variables
protected final java.nio.charset.Charset nameEncodingCharset
protected final java.nio.charset.Charset envVarsEnodingCharset
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
private final ChannelSession channelSession
public ScpShell(ChannelSession channelSession, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
public ChannelSession getServerChannelSession()
getServerChannelSession in interface ServerChannelSessionHolderpublic void setFileSystemFactory(FileSystemFactory factory, SessionContext session) throws java.io.IOException
FileSystemAwareFileSystemFactory used to create the FileSystem to be used by the sessionsetFileSystemFactory in interface FileSystemAwarefactory - The factory instancesession - The SessionContextjava.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()
run in interface java.lang.Runnableprotected java.lang.String readLine(java.io.Reader reader)
throws java.io.IOException
java.io.IOExceptionprotected boolean handleCommandLine(java.lang.String command)
throws java.lang.Exception
java.lang.Exceptionprotected void prepareEnvironment(Environment environ)
protected void handleUnsupportedCommand(java.lang.String command,
java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionprotected java.util.List<java.lang.String[]> parse(java.lang.String command)
protected void printenv(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionprotected 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.Exceptionprotected void scp(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionprotected void doScp(java.lang.String path,
boolean optR,
boolean optT,
boolean optF,
boolean optD,
boolean optP)
throws java.lang.Exception
java.lang.Exceptionprotected void echo(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionprotected void pwd(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionprotected void cd(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionprotected void updatePwdEnvVariable(java.nio.file.Path pwd)
protected void ls(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionprotected void doLs(java.lang.String cmd,
java.lang.String path,
boolean optListAll,
boolean optLong,
boolean optFullTime)
throws java.lang.Exception
java.lang.Exception