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.nio.charset.Charset |
DEFAULT_NAME_ENCODING_CHARSET
Default value of "scp-shell-name-encoding-charset"
|
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 |
static java.lang.String |
NAME_ENCODING_CHARSET
Used to indicate the
Charset (or its name) for encoding referenced files/folders names - extracted from
the client channel session when 1st initialized. |
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 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, setFileSystemgetCommand, getEnvironment, getErrorStream, getExecutorService, getExitCallback, getInputStream, getOutputStream, getServerSession, getSession, getStartedCommandFuture, onExit, onExit, setErrorStream, setExitCallback, setInputStream, setOutputStream, setSession, start, toStringgetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSessionContextpublic static final java.lang.String NAME_ENCODING_CHARSET
Charset (or its name) for encoding referenced files/folders names - extracted from
the client channel session when 1st initialized.public static final java.nio.charset.Charset DEFAULT_NAME_ENCODING_CHARSET
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
FileSystemAwareFileSystemFactory used to create the FileSystem to be used by the sessionfactory - 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()
protected 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