Package org.apache.sshd.scp.server
Class ScpShell
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.server.command.AbstractCommandSupport
org.apache.sshd.server.command.AbstractFileSystemCommand
org.apache.sshd.scp.server.ScpShell
- All Implemented Interfaces:
Runnable,org.apache.sshd.common.file.FileSystemAware,SessionContextHolder,SessionHolder<ServerSession>,org.apache.sshd.common.util.threads.ExecutorServiceCarrier,ServerChannelSessionHolder,Command,CommandDirectErrorStreamAware,CommandDirectInputStreamAware,CommandDirectOutputStreamAware,CommandDirectStreamsAware,CommandLifecycle,ServerSessionAware,ServerSessionHolder
This commands SCP support for a ChannelSession.
- Author:
- Apache MINA SSHD Project
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected 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, org.apache.sshd.common.util.threads.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(org.apache.sshd.common.file.FileSystemFactory factory, SessionContext session) protected 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
-
-
Constructor Details
-
ScpShell
public ScpShell(ChannelSession channelSession, org.apache.sshd.common.util.threads.CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
-
-
Method Details
-
getServerChannelSession
- Specified by:
getServerChannelSessionin interfaceServerChannelSessionHolder
-
setFileSystemFactory
public void setFileSystemFactory(org.apache.sshd.common.file.FileSystemFactory factory, SessionContext session) throws IOException - Specified by:
setFileSystemFactoryin interfaceorg.apache.sshd.common.file.FileSystemAware- Throws:
IOException
-
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 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
-