Top Description Inners Fields Constructors Methods
org.apache.sshd.scp.server

public Class ScpShell

extends AbstractFileSystemCommand
implements ServerChannelSessionHolder
Class Inheritance
All Implemented Interfaces
org.apache.sshd.server.channel.ServerChannelSessionHolder
Imports
java.io.IOError, .IOException, .InputStream, .InterruptedIOException, .OutputStream, .Reader, java.nio.charset.Charset, .StandardCharsets, java.nio.file.FileSystem, .Files, .NoSuchFileException, .Path, java.nio.file.attribute.FileTime, .PosixFilePermission, .PosixFilePermissions, java.time.Instant, .ZoneId, .ZonedDateTime, java.time.format.DateTimeFormatter, java.util.ArrayList, .Collection, .Collections, .EnumSet, .HashMap, .List, .Locale, .Map, .Objects, .Set, .TreeMap, java.util.function.Predicate, java.util.stream.Stream, org.apache.sshd.common.file.FileSystemFactory, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.common.util.threads.CloseableExecutorService, org.apache.sshd.scp.ScpModuleProperties, org.apache.sshd.scp.common.ScpException, .ScpFileOpener, .ScpHelper, .ScpTransferEventListener, org.apache.sshd.scp.common.helpers.DefaultScpFileOpener, .ScpAckInfo, org.apache.sshd.server.Environment, org.apache.sshd.server.channel.ChannelSession, .ServerChannelSessionHolder, org.apache.sshd.server.command.AbstractFileSystemCommand

This commands SCP support for a ChannelSession.
Author
Apache MINA SSHD Project

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Modifier and TypeField and Description
private final ChannelSession
protected Path
public static final String
ENV_HOME

The "HOME" environment variable

public static final String
ENV_LANG

Key for the language - format "en_US.UTF-8"

public static final String
ENV_PWD

The "PWD" environment variable

protected final Charset
protected Path
protected final ScpTransferEventListener
protected final Charset
protected final ScpFileOpener
protected final int
protected final int
public static final String
protected final Map<String, Object>
Inherited from org.apache.sshd.server.command.AbstractFileSystemCommand:
fileSystem

Constructor Summary

AccessConstructor and Description
public
ScpShell(ChannelSession channelSession, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)

Method Summary

Modifier and TypeMethod and Description
protected void
cd(String[] argv)

protected void
doLs(String cmd, String path, boolean optListAll, boolean optLong, boolean optFullTime)

protected void
doScp(String command, String path, boolean optR, boolean optT, boolean optF, boolean optD, boolean optP)

protected void
echo(String[] argv)

public ChannelSession
protected boolean
protected void
protected void
ls(String[] argv)

protected List<String[]>
parse(String command)

protected void
protected void
printenv(String[] argv)

protected void
protected void
pwd(String[] argv)

protected String
readLine(Reader reader)

protected String
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

protected void
scp(String command, String[] argv)

public void
setFileSystemFactory(FileSystemFactory
The factory instance
factory
,
SessionContext session)

Overrides default org.apache.sshd.common.file.FileSystemAware.setFileSystemFactory.

Sets the FileSystemFactory used to create the FileSystem to be used by the session

protected void
signalError(String cmd, String errorMsg)

protected void
signalError(String cmd, String errorMsg, Charset cs)

protected void
unset(String[] argv)

protected void
Inherited from org.apache.sshd.server.command.AbstractFileSystemCommand:
destroygetFileSystemsetFileSystem

Field Detail

channelSessionback to summary
private final ChannelSession channelSession
currentDirback to summary
protected Path currentDir
ENV_HOMEback to summary
public static final String ENV_HOME

The "HOME" environment variable

ENV_LANGback to summary
public static final String ENV_LANG

Key for the language - format "en_US.UTF-8"

ENV_PWDback to summary
public static final String ENV_PWD

The "PWD" environment variable

envVarsEnodingCharsetback to summary
protected final Charset envVarsEnodingCharset
homeDirback to summary
protected Path homeDir
listenerback to summary
protected final ScpTransferEventListener listener
nameEncodingCharsetback to summary
protected final Charset nameEncodingCharset
openerback to summary
protected final ScpFileOpener opener
receiveBufferSizeback to summary
protected final int receiveBufferSize
sendBufferSizeback to summary
protected final int sendBufferSize
STATUSback to summary
public static final String STATUS
variablesback to summary
protected final Map<String, Object> variables

Constructor Detail

ScpShellback to summary
public ScpShell(ChannelSession channelSession, CloseableExecutorService executorService, int sendSize, int receiveSize, ScpFileOpener fileOpener, ScpTransferEventListener eventListener)

Method Detail

cdback to summary
protected void cd(String[] argv) throws Exception
doLsback to summary
protected void doLs(String cmd, String path, boolean optListAll, boolean optLong, boolean optFullTime) throws Exception
doScpback to summary
protected void doScp(String command, String path, boolean optR, boolean optT, boolean optF, boolean optD, boolean optP) throws Exception
echoback to summary
protected void echo(String[] argv) throws Exception
getServerChannelSessionback to summary
public ChannelSession getServerChannelSession()

Implements org.apache.sshd.server.channel.ServerChannelSessionHolder.getServerChannelSession.

Annotations
@Override
handleCommandLineback to summary
protected boolean handleCommandLine(String command) throws Exception
handleUnsupportedCommandback to summary
protected void handleUnsupportedCommand(String command, String[] argv) throws Exception
lsback to summary
protected void ls(String[] argv) throws Exception
parseback to summary
protected List<String[]> parse(String command)
prepareEnvironmentback to summary
protected void prepareEnvironment(Environment environ)
printenvback to summary
protected void printenv(String[] argv) throws Exception
printlnback to summary
protected void println(String cmd, Object x, OutputStream out, Charset cs)
pwdback to summary
protected void pwd(String[] argv) throws Exception
readLineback to summary
protected String readLine(Reader reader) throws IOException
resolveEnvironmentVariableback to summary
protected String resolveEnvironmentVariable(String varName, Map<String, String> envValues)
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
scpback to summary
protected void scp(String command, String[] argv) throws Exception
setFileSystemFactoryback to summary
public void setFileSystemFactory(FileSystemFactory factory, SessionContext session) throws IOException

Overrides default org.apache.sshd.common.file.FileSystemAware.setFileSystemFactory.

Doc from org.apache.sshd.common.file.FileSystemAware.setFileSystemFactory.

Sets the FileSystemFactory used to create the FileSystem to be used by the session

Parameters
factory:FileSystemFactory

The factory instance

session:SessionContext

The SessionContext

Annotations
@Override
Exceptions
IOException:
If failed to resolve/create the file system
signalErrorback to summary
protected void signalError(String cmd, String errorMsg)
signalErrorback to summary
protected void signalError(String cmd, String errorMsg, Charset cs)
unsetback to summary
protected void unset(String[] argv) throws Exception
updatePwdEnvVariableback to summary
protected void updatePwdEnvVariable(Path pwd)
org.apache.sshd.scp.server back to summary

protected Class ScpShell.PathEntry

extends Object
implements Comparable<ScpShell.PathEntry>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

Field Summary

Modifier and TypeField and Description
protected final Path
protected final Map<String, Object>
public static final DateTimeFormatter
protected final Path
public static final DateTimeFormatter
public static final DateTimeFormatter

Constructor Summary

AccessConstructor and Description
public
PathEntry(Path abs, Path root)

Method Summary

Modifier and TypeMethod and Description
protected StringBuilder
public int
compareTo(ScpShell.PathEntry
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public String
display(boolean optLongDisplay, boolean optFullTime)

protected boolean
is(String attr)

protected static Map<String, Object>
protected String
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

protected static String
toString(FileTime time, boolean optFullTime)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

absback to summary
protected final Path abs
attributesback to summary
protected final Map<String, Object> attributes
FULL_TIME_VALUE_FORMATTERback to summary
public static final DateTimeFormatter FULL_TIME_VALUE_FORMATTER
pathback to summary
protected final Path path
TIME_ONLY_VALUE_FORMATTERback to summary
public static final DateTimeFormatter TIME_ONLY_VALUE_FORMATTER
YEAR_VALUE_FORMATTERback to summary
public static final DateTimeFormatter YEAR_VALUE_FORMATTER

Constructor Detail

PathEntryback to summary
public PathEntry(Path abs, Path root)

Method Detail

appendOwnerInformationback to summary
protected StringBuilder appendOwnerInformation(StringBuilder sb, String attr, String defaultValue)
compareToback to summary
public int compareTo(ScpShell.PathEntry o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:ScpShell.PathEntry

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
displayback to summary
public String display(boolean optLongDisplay, boolean optFullTime) throws NoSuchFileException
isback to summary
protected boolean is(String attr)
readAttributesback to summary
protected static Map<String, Object> readAttributes(Path path)
shortDisplayback to summary
protected String shortDisplay()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
toStringback to summary
protected static String toString(FileTime time, boolean optFullTime)