public class SftpSubsystem extends AbstractSftpSubsystemHelper implements Command, Runnable, org.apache.sshd.common.file.FileSystemAware, org.apache.sshd.common.util.threads.ExecutorServiceCarrier, AsyncCommand, ChannelDataReceiver
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.sshd.common.util.buffer.Buffer |
buffer |
protected ExitCallback |
callback |
protected static org.apache.sshd.common.util.buffer.Buffer |
CLOSE |
protected AtomicBoolean |
closed |
protected Path |
defaultDir |
protected Environment |
env |
protected org.apache.sshd.common.util.threads.CloseableExecutorService |
executorService |
protected Map<String,byte[]> |
extensions |
protected int |
fileHandleSize |
protected FileSystem |
fileSystem |
protected Map<String,Handle> |
handles |
protected int |
maxFileHandleRounds |
protected IoOutputStream |
out |
protected Future<?> |
pendingFuture |
protected org.apache.sshd.common.random.Random |
randomizer |
protected BlockingQueue<org.apache.sshd.common.util.buffer.Buffer> |
requests |
protected AtomicLong |
requestsCount |
protected int |
version |
protected byte[] |
workBuf |
DEFAULT_ACL_SUPPORTED_MASK, DEFAULT_OPEN_SSH_EXTENSIONS, DEFAULT_OPEN_SSH_EXTENSIONS_NAMES, DEFAULT_SUPPORTED_CLIENT_EXTENSIONSlogALL_SFTP_IMPL, HIGHER_SFTP_IMPL, LOWER_SFTP_IMPL, SUPPORTED_SFTP_VERSIONS| Constructor and Description |
|---|
SftpSubsystem(ChannelSession channel,
SftpSubsystemConfigurator configurator) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
closeAllHandles() |
protected void |
createLink(int id,
String existingPath,
String linkPath,
boolean symLink) |
int |
data(ChannelSession channel,
byte[] buf,
int start,
int len) |
void |
destroy(ChannelSession channel) |
protected void |
doBlock(int id,
String handle,
long offset,
long length,
int mask) |
protected void |
doCheckFileHash(int id,
String targetType,
String target,
Collection<String> algos,
long startOffset,
long length,
int blockSize,
org.apache.sshd.common.util.buffer.Buffer buffer) |
protected void |
doClose(int id,
String handle) |
protected void |
doCopyData(int id,
String readHandle,
long readOffset,
long readLength,
String writeHandle,
long writeOffset) |
protected void |
doFSetStat(int id,
String handle,
Map<String,?> attrs) |
protected Map<String,Object> |
doFStat(int id,
String handle,
int flags) |
protected void |
doInit(org.apache.sshd.common.util.buffer.Buffer buffer,
int id) |
protected byte[] |
doMD5Hash(int id,
String targetType,
String target,
long startOffset,
long length,
byte[] quickCheckHash) |
protected String |
doOpen(int id,
String path,
int pflags,
int access,
Map<String,Object> attrs) |
protected String |
doOpenDir(int id,
String path,
Path p,
LinkOption... options) |
protected void |
doOpenSSHFsync(int id,
String handle) |
protected void |
doProcess(org.apache.sshd.common.util.buffer.Buffer buffer,
int length,
int type,
int id) |
protected int |
doRead(int id,
String handle,
long offset,
int length,
byte[] data,
int doff) |
protected void |
doReadDir(org.apache.sshd.common.util.buffer.Buffer buffer,
int id) |
protected void |
doTextSeek(int id,
String handle,
long line) |
protected void |
doUnblock(int id,
String handle,
long offset,
long length) |
protected void |
doVersionSelect(org.apache.sshd.common.util.buffer.Buffer buffer,
int id,
String proposed) |
protected void |
doWrite(int id,
String handle,
long offset,
int length,
byte[] data,
int doff,
int remaining) |
protected String |
generateFileHandle(Path file) |
Path |
getDefaultDirectory() |
org.apache.sshd.common.util.threads.CloseableExecutorService |
getExecutorService() |
ServerSession |
getServerSession() |
int |
getVersion() |
protected void |
initializeSessionRelatedMember(ServerSession session,
ChannelSession channel) |
protected org.apache.sshd.common.util.buffer.Buffer |
prepareReply(org.apache.sshd.common.util.buffer.Buffer buffer) |
protected ChannelDataReceiver |
resolveErrorDataChannelReceiver(ChannelSession channelSession,
ChannelDataReceiver receiver) |
void |
run() |
protected void |
send(org.apache.sshd.common.util.buffer.Buffer buffer) |
void |
setErrorStream(OutputStream err) |
void |
setExitCallback(ExitCallback callback) |
void |
setFileSystem(FileSystem fileSystem) |
void |
setInputStream(InputStream in) |
void |
setIoErrorStream(IoOutputStream err) |
void |
setIoInputStream(IoInputStream in) |
void |
setIoOutputStream(IoOutputStream out) |
void |
setOutputStream(OutputStream out) |
void |
start(ChannelSession channel,
Environment env) |
addMissingAttribute, addSftpEventListener, appendAclSupportedExtension, appendExtensions, appendNewlineExtension, appendOpenSSHExtensions, appendSupported2Extension, appendSupportedExtension, appendVendorIdExtension, appendVersionsExtension, checkVersionCompatibility, doBlock, doCheckFileHash, doCheckFileHash, doClose, doCopyData, doCopyFile, doCopyFile, doCopyFile, doExtended, doFSetStat, doFStat, doLink, doLink, doLStat, doLStat, doMakeDirectory, doMakeDirectory, doMD5Hash, doMD5Hash, doOpen, doOpenDir, doOpenSSHFsync, doOpenSSHHardLink, doOpenSSHHardLink, doPosixRename, doRead, doReadDir, doReadLink, doReadLink, doRealPath, doRealPathV345, doRealPathV6, doRemove, doRemove, doRemoveDirectory, doRemoveDirectory, doRemoveFile, doRename, doRename, doRename, doSetAttributes, doSetStat, doSetStat, doSpaceAvailable, doSpaceAvailable, doStat, doStat, doSymLink, doSymLink, doTextSeek, doUnblock, doUnsupported, doUnsupportedExtension, doVersionSelect, doWrite, executeExtendedCommand, getAttributes, getAttributes, getErrorStatusDataHandler, getFileSystemAccessor, getLongName, getLongName, getLongName, getPathResolutionLinkOption, getServerChannelSession, getSftpEventListenerProxy, getShortName, getSupportedClientExtensions, getUnsupportedAttributePolicy, handleReadFileAttributesException, handleSetFileAttributeFailure, handleUnknownStatusFileAttributes, handleUnsupportedAttributes, handleUserPrincipalLookupServiceException, normalize, process, readAttrs, readFileAttributes, removeSftpEventListener, resolveAclSupportedCapabilities, resolveFile, resolveFileAttributes, resolveMissingFileAttributes, resolveMissingFileAttributeValue, resolveNewlineValue, resolveNormalizedLocation, resolveOpenSSHExtensions, resolvePathResolutionFollowLinks, sendAttrs, sendHandle, sendLink, sendPath, sendStatus, sendStatus, sendStatus, setFileAccessControl, setFileAttribute, setFileAttributes, setFileExtensions, setFileOwnership, setFilePermissions, setFileRawViewAttribute, setFileTime, signalOpenFailure, signalRemovalPreConditionFailure, toGroup, toUser, validateHandle, validateProposedVersion, validateRealPath, writeAttrs, writeDirEntrydebug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetFileSystemFactorygetSessiongetSessionContextprotected static final org.apache.sshd.common.util.buffer.Buffer CLOSE
protected final AtomicBoolean closed
protected final AtomicLong requestsCount
protected final org.apache.sshd.common.util.buffer.Buffer buffer
protected final BlockingQueue<org.apache.sshd.common.util.buffer.Buffer> requests
protected ExitCallback callback
protected IoOutputStream out
protected Environment env
protected org.apache.sshd.common.random.Random randomizer
protected int fileHandleSize
protected int maxFileHandleRounds
protected Future<?> pendingFuture
protected byte[] workBuf
protected FileSystem fileSystem
protected Path defaultDir
protected int version
protected org.apache.sshd.common.util.threads.CloseableExecutorService executorService
public SftpSubsystem(ChannelSession channel, SftpSubsystemConfigurator configurator)
channel - The ChannelSession through which the command was receivedconfigurator - The SftpSubsystemConfigurator to useprotected ChannelDataReceiver resolveErrorDataChannelReceiver(ChannelSession channelSession, ChannelDataReceiver receiver)
public int getVersion()
getVersion in interface SftpSubsystemEnvironmentpublic Path getDefaultDirectory()
getDefaultDirectory in interface SftpSubsystemEnvironmentchroot locationpublic org.apache.sshd.common.util.threads.CloseableExecutorService getExecutorService()
getExecutorService in interface org.apache.sshd.common.util.threads.ExecutorServiceCarrierprotected void initializeSessionRelatedMember(ServerSession session, ChannelSession channel)
public ServerSession getServerSession()
getServerSession in interface ServerSessionHolderpublic void setFileSystem(FileSystem fileSystem)
setFileSystem in interface org.apache.sshd.common.file.FileSystemAwarepublic void setExitCallback(ExitCallback callback)
setExitCallback in interface Commandpublic void setInputStream(InputStream in)
setInputStream in interface CommandDirectInputStreamAwarepublic void setOutputStream(OutputStream out)
setOutputStream in interface CommandDirectOutputStreamAwarepublic void setErrorStream(OutputStream err)
setErrorStream in interface CommandDirectErrorStreamAwarepublic void setIoInputStream(IoInputStream in)
setIoInputStream in interface AsyncCommandInputStreamAwarepublic void setIoOutputStream(IoOutputStream out)
setIoOutputStream in interface AsyncCommandOutputStreamAwarepublic void setIoErrorStream(IoOutputStream err)
setIoErrorStream in interface AsyncCommandErrorStreamAwarepublic void start(ChannelSession channel, Environment env) throws IOException
start in interface CommandLifecycleIOExceptionpublic int data(ChannelSession channel, byte[] buf, int start, int len) throws IOException
data in interface ChannelDataReceiverIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionprotected void doProcess(org.apache.sshd.common.util.buffer.Buffer buffer, int length, int type, int id) throws IOException
doProcess in class AbstractSftpSubsystemHelperIOExceptionprotected void createLink(int id,
String existingPath,
String linkPath,
boolean symLink)
throws IOException
createLink in class AbstractSftpSubsystemHelperIOExceptionprotected void doTextSeek(int id,
String handle,
long line)
throws IOException
doTextSeek in class AbstractSftpSubsystemHelperIOExceptionprotected void doOpenSSHFsync(int id,
String handle)
throws IOException
doOpenSSHFsync in class AbstractSftpSubsystemHelperIOExceptionprotected void doCheckFileHash(int id,
String targetType,
String target,
Collection<String> algos,
long startOffset,
long length,
int blockSize,
org.apache.sshd.common.util.buffer.Buffer buffer)
throws Exception
doCheckFileHash in class AbstractSftpSubsystemHelperExceptionprotected byte[] doMD5Hash(int id,
String targetType,
String target,
long startOffset,
long length,
byte[] quickCheckHash)
throws Exception
doMD5Hash in class AbstractSftpSubsystemHelperExceptionprotected void doVersionSelect(org.apache.sshd.common.util.buffer.Buffer buffer, int id, String proposed) throws IOException
doVersionSelect in class AbstractSftpSubsystemHelperIOExceptionprotected void doBlock(int id,
String handle,
long offset,
long length,
int mask)
throws IOException
doBlock in class AbstractSftpSubsystemHelperIOExceptionprotected void doUnblock(int id,
String handle,
long offset,
long length)
throws IOException
doUnblock in class AbstractSftpSubsystemHelperIOExceptionprotected void doCopyData(int id,
String readHandle,
long readOffset,
long readLength,
String writeHandle,
long writeOffset)
throws IOException
doCopyData in class AbstractSftpSubsystemHelperIOExceptionprotected void doReadDir(org.apache.sshd.common.util.buffer.Buffer buffer, int id) throws IOException
doReadDir in class AbstractSftpSubsystemHelperIOExceptionprotected String doOpenDir(int id, String path, Path p, LinkOption... options) throws IOException
doOpenDir in class AbstractSftpSubsystemHelperIOExceptionprotected void doFSetStat(int id,
String handle,
Map<String,?> attrs)
throws IOException
doFSetStat in class AbstractSftpSubsystemHelperIOExceptionprotected Map<String,Object> doFStat(int id, String handle, int flags) throws IOException
doFStat in class AbstractSftpSubsystemHelperIOExceptionprotected void doWrite(int id,
String handle,
long offset,
int length,
byte[] data,
int doff,
int remaining)
throws IOException
doWrite in class AbstractSftpSubsystemHelperIOExceptionprotected int doRead(int id,
String handle,
long offset,
int length,
byte[] data,
int doff)
throws IOException
doRead in class AbstractSftpSubsystemHelperIOExceptionprotected void doClose(int id,
String handle)
throws IOException
doClose in class AbstractSftpSubsystemHelperIOExceptionprotected String doOpen(int id, String path, int pflags, int access, Map<String,Object> attrs) throws IOException
doOpen in class AbstractSftpSubsystemHelperid - Request idpath - Pathpflags - Open mode flags - see SSH_FXF_XXX flagsaccess - Access mode flags - see ACE4_XXX flagsattrs - Requested attributesIOException - if failed to executeprotected String generateFileHandle(Path file) throws IOException
IOExceptionprotected void doInit(org.apache.sshd.common.util.buffer.Buffer buffer, int id) throws IOException
doInit in class AbstractSftpSubsystemHelperIOExceptionprotected org.apache.sshd.common.util.buffer.Buffer prepareReply(org.apache.sshd.common.util.buffer.Buffer buffer)
prepareReply in class AbstractSftpSubsystemHelperprotected void send(org.apache.sshd.common.util.buffer.Buffer buffer) throws IOException
send in class AbstractSftpSubsystemHelperIOExceptionpublic void destroy(ChannelSession channel)
destroy in interface CommandLifecycleprotected void closeAllHandles()
Copyright © 2018–2021 The Apache Software Foundation. All rights reserved.