Class ScpShell
- All Implemented Interfaces:
Runnable, FileSystemAware, SessionContextHolder, SessionHolder<ServerSession>, ExecutorServiceCarrier, ServerChannelSessionHolder, Command, CommandDirectErrorStreamAware, CommandDirectInputStreamAware, CommandDirectOutputStreamAware, CommandDirectStreamsAware, CommandLifecycle, ServerSessionAware, ServerSessionHolder
This command provides SCP support for a ChannelSession.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ChannelSessionprotected Pathstatic final StringThe "HOME" environment variablestatic final StringKey for the language - format "en_US.UTF-8"static final StringThe "PWD" environment variableprotected final Charsetprotected Pathprotected final ScpTransferEventListenerprivate static final intprivate static final intprivate static final intprivate static final intprotected final Charsetprotected final ScpFileOpenerprotected final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprotected final intstatic final StringFields inherited from class AbstractFileSystemCommand
fileSystemFields inherited from class AbstractCommandSupport
cbCalled, cmdRunner, executorServiceFields inherited from class AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionScpShell(ChannelSession channelSession, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidprotected voidprotected booleanhandleCommandLine(String command) protected voidhandleUnsupportedCommand(String command, String[] argv) protected voidprotected voidprepareEnvironment(Environment environ) protected voidprotected voidprintln(String cmd, Object x, OutputStream out, Charset cs) protected voidprotected Stringprotected StringresolveEnvironmentVariable(String varName, Map<String, String> envValues) voidrun()protected voidvoidsetFileSystemFactory(FileSystemFactory factory, SessionContext session) Sets theFileSystemFactoryused to create theFileSystemto be used by the sessionprotected voidsignalError(String cmd, String errorMsg) protected voidsignalError(String cmd, String errorMsg, Charset cs) private Stringprotected voidprotected voidupdatePwdEnvVariable(Path pwd) Methods inherited from class AbstractFileSystemCommand
destroy, getFileSystem, setFileSystemMethods inherited from class AbstractCommandSupport
getCommand, getEnvironment, getErrorStream, getExecutorService, getExitCallback, getInputStream, getOutputStream, getServerSession, getSession, getStartedCommandFuture, onExit, onExit, setErrorStream, setExitCallback, setInputStream, setOutputStream, setSession, start, toStringMethods inherited from class AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface SessionHolder
getSessionContext
-
Field Details
-
STATUS
- See Also:
-
ENV_PWD
-
ENV_HOME
-
ENV_LANG
-
LS_ALL
private static final int LS_ALL- See Also:
-
LS_DIR_PLAIN
private static final int LS_DIR_PLAIN- See Also:
-
LS_LONG
private static final int LS_LONG- See Also:
-
LS_FULL_TIME
private static final int LS_FULL_TIME- See Also:
-
SCP_D
private static final int SCP_D- See Also:
-
SCP_F
private static final int SCP_F- See Also:
-
SCP_P
private static final int SCP_P- See Also:
-
SCP_R
private static final int SCP_R- See Also:
-
SCP_T
private static final int SCP_T- See Also:
-
variables
-
nameEncodingCharset
-
envVarsEnodingCharset
-
opener
-
listener
-
sendBufferSize
protected final int sendBufferSize -
receiveBufferSize
protected final int receiveBufferSize -
currentDir
-
homeDir
-
channelSession
-
-
Constructor Details
-
ScpShell
public ScpShell(ChannelSession channelSession, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
-
-
Method Details
-
getServerChannelSession
- Specified by:
getServerChannelSessionin interfaceServerChannelSessionHolder
-
setFileSystemFactory
public void setFileSystemFactory(FileSystemFactory factory, SessionContext session) throws IOException Description copied from interface:FileSystemAwareSets theFileSystemFactoryused to create theFileSystemto be used by the session- Specified by:
setFileSystemFactoryin interfaceFileSystemAware- Parameters:
factory- The factory instancesession- TheSessionContext- Throws:
IOException- If failed to resolve/create the file system- See Also:
-
println
-
signalError
-
signalError
-
run
-
readLine
- Throws:
IOException
-
handleCommandLine
-
prepareEnvironment
-
handleUnsupportedCommand
-
parse
-
printenv
-
resolveEnvironmentVariable
-
unset
-
scp
-
doScp
-
echo
-
pwd
-
toScpPath
-
cd
-
updatePwdEnvVariable
-
ls
-
doLs
-