Package org.apache.sshd.scp.server
Class ScpShell
- All Implemented Interfaces:
Runnable,FileSystemAware,SessionContextHolder,SessionHolder<ServerSession>,ExecutorServiceCarrier,ServerChannelSessionHolder,Command,CommandDirectErrorStreamAware,CommandDirectInputStreamAware,CommandDirectOutputStreamAware,CommandDirectStreamsAware,CommandLifecycle,ServerSessionAware,ServerSessionHolder
This commands 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 ScpTransferEventListenerprotected final Charsetprotected final ScpFileOpenerprotected final intprotected final intstatic final StringFields inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand
fileSystemFields inherited from class org.apache.sshd.server.command.AbstractCommandSupport
cbCalled, cmdRunner, executorServiceFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionScpShell(ChannelSession channelSession, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voiddoScp(String command, String path, boolean optR, boolean optT, boolean optF, boolean optD, boolean optP) protected 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) protected voidprotected voidupdatePwdEnvVariable(Path pwd) Methods inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand
destroy, getFileSystem, setFileSystemMethods inherited from class org.apache.sshd.server.command.AbstractCommandSupport
getCommand, getEnvironment, getErrorStream, getExecutorService, getExitCallback, getInputStream, getOutputStream, getServerSession, getSession, getStartedCommandFuture, onExit, onExit, setErrorStream, setExitCallback, setInputStream, setOutputStream, setSession, start, toStringMethods inherited from class org.apache.sshd.common.util.logging.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
Field Details
-
STATUS
- See Also:
-
ENV_PWD
The "PWD" environment variable- See Also:
-
ENV_HOME
The "HOME" environment variable- See Also:
-
ENV_LANG
Key for the language - format "en_US.UTF-8"- 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
public void run() -
readLine
- Throws:
IOException
-
handleCommandLine
- Throws:
Exception
-
prepareEnvironment
-
handleUnsupportedCommand
- Throws:
Exception
-
parse
-
printenv
- Throws:
Exception
-
resolveEnvironmentVariable
-
unset
- Throws:
Exception
-
scp
- Throws:
Exception
-
doScp
protected void doScp(String command, String path, boolean optR, boolean optT, boolean optF, boolean optD, boolean optP) throws Exception - Throws:
Exception
-
echo
- Throws:
Exception
-
pwd
- Throws:
Exception
-
cd
- Throws:
Exception
-
updatePwdEnvVariable
-
ls
- Throws:
Exception
-
doLs
protected void doLs(String cmd, String path, boolean optListAll, boolean optLong, boolean optFullTime) throws Exception - Throws:
Exception
-