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
public class ScpShell extends AbstractFileSystemCommand implements ServerChannelSessionHolder
This commands SCP support for a ChannelSession.- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classScpShell.PathEntry
-
Field Summary
Fields Modifier and Type Field Description protected PathcurrentDirstatic StringENV_HOMEThe "HOME" environment variablestatic StringENV_LANGKey for the language - format "en_US.UTF-8"static StringENV_PWDThe "PWD" environment variableprotected CharsetenvVarsEnodingCharsetprotected PathhomeDirprotected ScpTransferEventListenerlistenerprotected CharsetnameEncodingCharsetprotected ScpFileOpeneropenerprotected intreceiveBufferSizeprotected intsendBufferSizestatic StringSTATUSprotected Map<String,Object>variables-
Fields inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand
fileSystem
-
Fields inherited from class org.apache.sshd.server.command.AbstractCommandSupport
cbCalled, cmdRunner, executorService
-
-
Constructor Summary
Constructors Constructor Description ScpShell(ChannelSession channelSession, org.apache.sshd.common.util.threads.CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcd(String[] argv)protected voiddoLs(String cmd, String path, boolean optListAll, boolean optLong, boolean optFullTime)protected voiddoScp(String path, boolean optR, boolean optT, boolean optF, boolean optD, boolean optP)protected voidecho(String[] argv)ChannelSessiongetServerChannelSession()protected booleanhandleCommandLine(String command)protected voidhandleUnsupportedCommand(String command, String[] argv)protected voidls(String[] argv)protected List<String[]>parse(String command)protected voidprepareEnvironment(Environment environ)protected voidprintenv(String[] argv)protected voidprintln(String cmd, Object x, OutputStream out, Charset cs)protected voidpwd(String[] argv)protected StringreadLine(Reader reader)protected StringresolveEnvironmentVariable(String varName, Map<String,String> envValues)voidrun()protected voidscp(String[] argv)voidsetFileSystemFactory(org.apache.sshd.common.file.FileSystemFactory factory, SessionContext session)protected voidsignalError(String cmd, String errorMsg)protected voidsignalError(String cmd, String errorMsg, Charset cs)protected voidunset(String[] argv)protected voidupdatePwdEnvVariable(Path pwd)-
Methods inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand
destroy, getFileSystem, setFileSystem
-
Methods 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, toString
-
Methods 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, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
-
-
-
Field Detail
-
STATUS
public static final String STATUS
- See Also:
- Constant Field Values
-
ENV_PWD
public static final String ENV_PWD
The "PWD" environment variable- See Also:
- Constant Field Values
-
ENV_HOME
public static final String ENV_HOME
The "HOME" environment variable- See Also:
- Constant Field Values
-
ENV_LANG
public static final String ENV_LANG
Key for the language - format "en_US.UTF-8"- See Also:
- Constant Field Values
-
nameEncodingCharset
protected final Charset nameEncodingCharset
-
envVarsEnodingCharset
protected final Charset envVarsEnodingCharset
-
opener
protected final ScpFileOpener opener
-
listener
protected final ScpTransferEventListener listener
-
sendBufferSize
protected final int sendBufferSize
-
receiveBufferSize
protected final int receiveBufferSize
-
currentDir
protected Path currentDir
-
homeDir
protected Path homeDir
-
-
Constructor Detail
-
ScpShell
public ScpShell(ChannelSession channelSession, org.apache.sshd.common.util.threads.CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
-
-
Method Detail
-
getServerChannelSession
public ChannelSession 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
protected void println(String cmd, Object x, OutputStream out, Charset cs)
-
readLine
protected String readLine(Reader reader) throws IOException
- Throws:
IOException
-
handleCommandLine
protected boolean handleCommandLine(String command) throws Exception
- Throws:
Exception
-
prepareEnvironment
protected void prepareEnvironment(Environment environ)
-
handleUnsupportedCommand
protected void handleUnsupportedCommand(String command, String[] argv) throws Exception
- Throws:
Exception
-
resolveEnvironmentVariable
protected String resolveEnvironmentVariable(String varName, Map<String,String> envValues)
-
doScp
protected void doScp(String path, boolean optR, boolean optT, boolean optF, boolean optD, boolean optP) throws Exception
- Throws:
Exception
-
updatePwdEnvVariable
protected void updatePwdEnvVariable(Path pwd)
-
-