Package org.apache.sshd.scp.server
Class ScpShell
- All Implemented Interfaces:
Runnable
,FileSystemAware
,SessionContextHolder
,SessionHolder<ServerSession>
,ExecutorServiceCarrier
,Command
,CommandLifecycle
,ServerSessionHolder
,SessionAware
This commands SCP support for a ChannelSession.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChannelSession
protected Path
static final String
The "HOME" environment variablestatic final String
Key for the language - format "en_US.UTF-8"static final String
The "PWD" environment variableprotected Path
protected final ScpTransferEventListener
protected final Charset
protected final ScpFileOpener
protected final int
protected final int
static final String
Fields inherited from class org.apache.sshd.server.command.AbstractFileSystemCommand
fileSystem
Fields inherited from class org.apache.sshd.server.command.AbstractCommandSupport
cbCalled, cmdRunner, executorService
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Constructor Summary
ConstructorsConstructorDescriptionScpShell
(ChannelSession channel, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
protected void
protected boolean
handleCommandLine
(String command) protected void
handleUnsupportedCommand
(String command, String[] argv) protected void
protected void
prepareEnvironment
(Environment environ) protected void
protected void
println
(String cmd, Object x, OutputStream out, Charset cs) protected void
protected String
protected String
resolveEnvironmentVariable
(String varName, Map<String, String> envValues) void
run()
protected void
void
setFileSystemFactory
(FileSystemFactory factory, SessionContext session) Sets theFileSystemFactory
used to create theFileSystem
to be used by the sessionprotected void
signalError
(String cmd, String errorMsg) protected void
signalError
(String cmd, String errorMsg, Charset cs) protected void
protected void
updatePwdEnvVariable
(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 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:
-
channel
-
variables
-
nameEncodingCharset
-
opener
-
listener
-
sendBufferSize
protected final int sendBufferSize -
receiveBufferSize
protected final int receiveBufferSize -
currentDir
-
homeDir
-
-
Constructor Details
-
ScpShell
public ScpShell(ChannelSession channel, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)
-
-
Method Details
-
setFileSystemFactory
public void setFileSystemFactory(FileSystemFactory factory, SessionContext session) throws IOException Description copied from interface:FileSystemAware
Sets theFileSystemFactory
used to create theFileSystem
to be used by the session- 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 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
-