public abstract class AbstractSftpSubsystemHelper extends AbstractLoggingBean implements SftpSubsystemProxy
| Modifier and Type | Field and Description |
|---|---|
private ChannelSession |
channelSession |
static java.util.Set<java.lang.Integer> |
DEFAULT_ACL_SUPPORTED_MASK |
static java.util.List<AbstractOpenSSHExtensionParser.OpenSSHExtension> |
DEFAULT_OPEN_SSH_EXTENSIONS |
static java.util.List<java.lang.String> |
DEFAULT_OPEN_SSH_EXTENSIONS_NAMES |
static java.util.NavigableMap<java.lang.String,OptionalFeature> |
DEFAULT_SUPPORTED_CLIENT_EXTENSIONS
The default reported supported client extensions (case insensitive)
|
private SftpErrorStatusDataHandler |
errorStatusDataHandler |
private SftpFileSystemAccessor |
fileSystemAccessor |
private SftpEventListener |
sftpEventListenerProxy |
private java.util.Collection<SftpEventListener> |
sftpEventListeners |
private UnsupportedAttributePolicy |
unsupportedAttributePolicy |
logALL_SFTP_IMPL, HIGHER_SFTP_IMPL, LOWER_SFTP_IMPL, SUPPORTED_SFTP_VERSIONS| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSftpSubsystemHelper(ChannelSession channelSession,
SftpSubsystemConfigurator configurator) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
addMissingAttribute(java.nio.file.Path file,
java.util.NavigableMap<java.lang.String,java.lang.Object> current,
java.lang.String name,
FileInfoExtractor<?> x,
java.nio.file.LinkOption... options) |
boolean |
addSftpEventListener(SftpEventListener listener)
Register a listener instance
|
protected int |
appendAclSupportedExtension(Buffer buffer,
ServerSession session) |
protected void |
appendExtensions(Buffer buffer,
java.lang.String supportedVersions) |
protected java.lang.String |
appendNewlineExtension(Buffer buffer,
ServerSession session)
Appends the "newline" extension to the buffer.
|
protected java.util.List<AbstractOpenSSHExtensionParser.OpenSSHExtension> |
appendOpenSSHExtensions(Buffer buffer,
ServerSession session) |
protected void |
appendSupported2Extension(Buffer buffer,
java.util.Collection<java.lang.String> extras)
Appends the "supported2" extension to the buffer.
|
protected void |
appendSupportedExtension(Buffer buffer,
java.util.Collection<java.lang.String> extras)
Appends the "supported" extension to the buffer.
|
protected java.util.Map<java.lang.String,?> |
appendVendorIdExtension(Buffer buffer,
java.util.Map<java.lang.String,?> versionProperties,
ServerSession session)
Appends the "vendor-id" extension to the buffer.
|
protected java.lang.String |
appendVersionsExtension(Buffer buffer,
java.lang.String value,
ServerSession session)
Appends the "versions" extension to the buffer.
|
protected java.util.Map.Entry<java.lang.Integer,java.lang.String> |
checkVersionCompatibility(Buffer buffer,
int id,
int proposed,
int failureOpcode)
Checks if a proposed version is within supported range.
|
protected abstract void |
createLink(int id,
java.lang.String existingPath,
java.lang.String linkPath,
boolean symLink) |
protected void |
doBlock(Buffer buffer,
int id) |
protected abstract void |
doBlock(int id,
java.lang.String handle,
long offset,
long length,
int mask) |
protected void |
doCheckFileHash(Buffer buffer,
int id,
java.lang.String targetType) |
protected void |
doCheckFileHash(int id,
java.nio.file.Path file,
NamedFactory<? extends Digest> factory,
long startOffset,
long length,
int blockSize,
Buffer buffer) |
protected abstract void |
doCheckFileHash(int id,
java.lang.String targetType,
java.lang.String target,
java.util.Collection<java.lang.String> algos,
long startOffset,
long length,
int blockSize,
Buffer buffer) |
protected void |
doClose(Buffer buffer,
int id) |
protected abstract void |
doClose(int id,
java.lang.String handle) |
protected void |
doCopyData(Buffer buffer,
int id) |
protected abstract void |
doCopyData(int id,
java.lang.String readHandle,
long readOffset,
long readLength,
java.lang.String writeHandle,
long writeOffset) |
protected void |
doCopyFile(Buffer buffer,
int id) |
protected void |
doCopyFile(int id,
java.lang.String srcFile,
java.lang.String dstFile,
boolean overwriteDestination) |
protected void |
doCopyFile(int id,
java.lang.String srcFile,
java.lang.String dstFile,
java.util.Collection<java.nio.file.CopyOption> opts) |
protected void |
doExtended(Buffer buffer,
int id) |
protected void |
doFSetStat(Buffer buffer,
int id) |
protected abstract void |
doFSetStat(int id,
java.lang.String handle,
java.util.Map<java.lang.String,?> attrs) |
protected void |
doFStat(Buffer buffer,
int id) |
protected abstract java.util.Map<java.lang.String,java.lang.Object> |
doFStat(int id,
java.lang.String handle,
int flags) |
protected abstract void |
doInit(Buffer buffer,
int id) |
protected void |
doLink(Buffer buffer,
int id) |
protected void |
doLink(int id,
java.lang.String targetPath,
java.lang.String linkPath,
boolean symLink) |
protected void |
doLStat(Buffer buffer,
int id) |
protected java.util.Map<java.lang.String,java.lang.Object> |
doLStat(int id,
java.lang.String path,
int flags) |
protected void |
doMakeDirectory(Buffer buffer,
int id) |
protected void |
doMakeDirectory(int id,
java.lang.String path,
java.util.Map<java.lang.String,?> attrs,
boolean followLinks) |
protected void |
doMD5Hash(Buffer buffer,
int id,
java.lang.String targetType) |
protected byte[] |
doMD5Hash(int id,
java.nio.file.Path path,
long startOffset,
long length,
byte[] quickCheckHash) |
protected abstract byte[] |
doMD5Hash(int id,
java.lang.String targetType,
java.lang.String target,
long startOffset,
long length,
byte[] quickCheckHash) |
protected void |
doOpen(Buffer buffer,
int id) |
protected abstract java.lang.String |
doOpen(int id,
java.lang.String path,
int pflags,
int access,
java.util.Map<java.lang.String,java.lang.Object> attrs) |
protected void |
doOpenDir(Buffer buffer,
int id) |
protected abstract java.lang.String |
doOpenDir(int id,
java.lang.String path,
java.nio.file.Path p,
java.nio.file.LinkOption... options) |
protected void |
doOpenSSHFsync(Buffer buffer,
int id) |
protected abstract void |
doOpenSSHFsync(int id,
java.lang.String handle) |
protected void |
doOpenSSHHardLink(Buffer buffer,
int id) |
protected void |
doOpenSSHHardLink(int id,
java.lang.String srcFile,
java.lang.String dstFile) |
protected void |
doOpenSSHLimits(Buffer buffer,
int id) |
protected void |
doPosixRename(Buffer buffer,
int id) |
protected void |
doProcess(Buffer buffer,
int length,
int type,
int id) |
protected void |
doRead(Buffer buffer,
int id) |
protected abstract int |
doRead(int id,
java.lang.String handle,
long offset,
int length,
byte[] data,
int doff,
java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> eof) |
protected abstract void |
doReadDir(Buffer buffer,
int id) |
protected int |
doReadDir(int id,
java.lang.String handle,
DirectoryHandle dir,
Buffer buffer,
int maxSize,
boolean followLinks) |
protected void |
doReadLink(Buffer buffer,
int id) |
protected java.util.AbstractMap.SimpleImmutableEntry<java.nio.file.Path,java.lang.String> |
doReadLink(int id,
java.lang.String path) |
protected void |
doRealPath(Buffer buffer,
int id) |
protected java.util.AbstractMap.SimpleImmutableEntry<java.nio.file.Path,java.lang.Boolean> |
doRealPathV345(int id,
java.lang.String path,
java.nio.file.Path p,
java.nio.file.LinkOption... options) |
protected java.util.AbstractMap.SimpleImmutableEntry<java.nio.file.Path,java.lang.Boolean> |
doRealPathV6(int id,
java.lang.String path,
java.util.Collection<java.lang.String> extraPaths,
java.nio.file.Path p,
java.nio.file.LinkOption... options) |
protected void |
doRemove(Buffer buffer,
int id) |
protected void |
doRemove(int id,
java.nio.file.Path p,
boolean isDirectory)
Called when need to delete a file / directory - also informs the
SftpEventListener |
protected void |
doRemoveDirectory(Buffer buffer,
int id) |
protected void |
doRemoveDirectory(int id,
java.lang.String path,
boolean followLinks) |
protected void |
doRemoveFile(int id,
java.lang.String path,
boolean followLinks) |
protected void |
doRename(Buffer buffer,
int id) |
protected void |
doRename(int id,
java.lang.String oldPath,
java.lang.String newPath,
java.util.Collection<java.nio.file.CopyOption> opts) |
protected void |
doRename(int id,
java.lang.String oldPath,
java.lang.String newPath,
int flags) |
protected void |
doSetAttributes(int cmd,
java.lang.String extension,
java.nio.file.Path file,
java.util.Map<java.lang.String,?> attributes,
boolean followLinks) |
protected void |
doSetStat(Buffer buffer,
int id,
java.lang.String extension,
int cmd,
java.lang.Boolean followLinks) |
protected void |
doSetStat(int id,
java.lang.String path,
int cmd,
java.lang.String extension,
java.util.Map<java.lang.String,?> attrs,
java.lang.Boolean followLinks) |
protected void |
doSpaceAvailable(Buffer buffer,
int id) |
protected SpaceAvailableExtensionInfo |
doSpaceAvailable(int id,
java.lang.String path) |
protected void |
doStat(Buffer buffer,
int id) |
protected java.util.Map<java.lang.String,java.lang.Object> |
doStat(int id,
java.lang.String path,
int flags) |
protected void |
doSymLink(Buffer buffer,
int id) |
protected void |
doSymLink(int id,
java.lang.String targetPath,
java.lang.String linkPath) |
protected void |
doTextSeek(Buffer buffer,
int id) |
protected abstract void |
doTextSeek(int id,
java.lang.String handle,
long line) |
protected void |
doUnblock(Buffer buffer,
int id) |
protected abstract void |
doUnblock(int id,
java.lang.String handle,
long offset,
long length) |
protected void |
doUnsupported(Buffer buffer,
int length,
int type,
int id) |
protected void |
doUnsupportedExtension(Buffer buffer,
int id,
java.lang.String extension) |
protected void |
doVersionSelect(Buffer buffer,
int id) |
protected abstract void |
doVersionSelect(Buffer buffer,
int id,
java.lang.String proposed) |
protected void |
doWrite(Buffer buffer,
int id) |
protected abstract void |
doWrite(int id,
java.lang.String handle,
long offset,
int length,
byte[] data,
int doff,
int remaining) |
protected void |
executeExtendedCommand(Buffer buffer,
int id,
java.lang.String extension) |
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
getAttributes(java.nio.file.Path path,
int flags,
java.nio.file.LinkOption... options) |
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
getAttributes(java.nio.file.Path file,
java.nio.file.LinkOption... options) |
SftpErrorStatusDataHandler |
getErrorStatusDataHandler() |
SftpFileSystemAccessor |
getFileSystemAccessor() |
protected java.lang.String |
getLongName(java.nio.file.Path f,
java.lang.String shortName,
boolean sendAttrs,
java.nio.file.LinkOption... options) |
protected java.lang.String |
getLongName(java.nio.file.Path f,
java.lang.String shortName,
java.nio.file.LinkOption... options) |
protected java.lang.String |
getLongName(java.nio.file.Path f,
java.lang.String shortName,
java.util.Map<java.lang.String,?> attributes) |
protected java.lang.String |
getLongName(java.nio.file.Path f,
java.lang.String shortName,
SftpClient.Attributes attributes) |
protected OpenSSHLimitsExtensionInfo |
getOpenSSHLimitsExtensionInfo(int id,
ChannelSession channel) |
protected java.nio.file.LinkOption[] |
getPathResolutionLinkOption(int cmd,
java.lang.String extension,
java.nio.file.Path path) |
ChannelSession |
getServerChannelSession() |
SftpEventListener |
getSftpEventListenerProxy() |
protected java.lang.String |
getShortName(java.nio.file.Path f) |
protected java.util.Map<java.lang.String,OptionalFeature> |
getSupportedClientExtensions(ServerSession session) |
UnsupportedAttributePolicy |
getUnsupportedAttributePolicy() |
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
handleReadFileAttributesException(java.nio.file.Path file,
java.lang.String view,
java.nio.file.LinkOption[] options,
java.io.IOException e) |
protected void |
handleSetFileAttributeFailure(java.nio.file.Path file,
java.lang.String view,
java.lang.String attribute,
java.lang.Object value,
java.util.Collection<java.lang.String> unsupported,
java.lang.Exception e) |
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
handleUnknownStatusFileAttributes(java.nio.file.Path file,
int flags,
java.nio.file.LinkOption... options) |
protected void |
handleUnsupportedAttributes(java.util.Collection<java.lang.String> attributes) |
protected void |
handleUserPrincipalLookupServiceException(java.lang.Class<? extends java.security.Principal> principalType,
java.lang.String name,
java.io.IOException e) |
protected java.nio.file.Path |
normalize(java.nio.file.Path f) |
protected abstract Buffer |
prepareReply(Buffer buffer) |
protected void |
process(Buffer buffer)
Process an SFTP command.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
readAttrs(Buffer buffer) |
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
readFileAttributes(java.nio.file.Path file,
java.lang.String view,
java.nio.file.LinkOption... options) |
boolean |
removeSftpEventListener(SftpEventListener listener)
Remove a listener instance
|
protected java.util.Collection<java.lang.Integer> |
resolveAclSupportedCapabilities(ServerSession session) |
protected java.nio.file.Path |
resolveFile(java.lang.String remotePath) |
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
resolveFileAttributes(java.nio.file.Path path,
int flags,
java.nio.file.LinkOption... options) |
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
resolveMissingFileAttributes(java.nio.file.Path file,
int flags,
java.util.Map<java.lang.String,java.lang.Object> current,
java.nio.file.LinkOption... options)
Called by
getAttributes(Path, int, LinkOption...) in order to complete any attributes that could not be
retrieved via the supported file system views. |
protected java.lang.Object |
resolveMissingFileAttributeValue(java.nio.file.Path file,
java.lang.String name,
java.lang.Object value,
FileInfoExtractor<?> x,
java.nio.file.LinkOption... options) |
protected java.lang.String |
resolveNewlineValue(ServerSession session) |
protected java.nio.file.Path |
resolveNormalizedLocation(java.lang.String remotePath) |
protected java.util.List<AbstractOpenSSHExtensionParser.OpenSSHExtension> |
resolveOpenSSHExtensions(ServerSession session) |
protected boolean |
resolvePathResolutionFollowLinks(int cmd,
java.lang.String extension,
java.nio.file.Path path) |
protected java.util.NavigableMap<java.lang.String,java.lang.Object> |
resolveReportedFileAttributes(java.nio.file.Path file,
int flags,
java.nio.file.LinkOption... options) |
protected abstract void |
send(Buffer buffer) |
protected void |
sendAttrs(Buffer buffer,
int id,
java.util.Map<java.lang.String,?> attributes) |
protected void |
sendHandle(Buffer buffer,
int id,
java.lang.String handle) |
protected void |
sendLink(Buffer buffer,
int id,
java.nio.file.Path file,
java.lang.String link) |
protected void |
sendPath(Buffer buffer,
int id,
java.nio.file.Path f,
java.util.Map<java.lang.String,?> attrs) |
protected void |
sendStatus(Buffer buffer,
int id,
int substatus,
java.lang.String msg) |
protected void |
sendStatus(Buffer buffer,
int id,
int substatus,
java.lang.String msg,
java.lang.String lang) |
protected void |
sendStatus(Buffer buffer,
int id,
java.lang.Throwable e,
int cmd,
java.lang.Object... args)
Invoked when an exception was thrown due to the execution of some SFTP command
|
protected void |
setFileAccessControl(java.nio.file.Path file,
java.util.List<java.nio.file.attribute.AclEntry> acl,
java.nio.file.LinkOption... options) |
protected void |
setFileAttribute(java.nio.file.Path file,
java.lang.String view,
java.lang.String attribute,
java.lang.Object value,
java.nio.file.LinkOption... options) |
protected void |
setFileAttributes(java.nio.file.Path file,
java.util.Map<java.lang.String,?> attributes,
java.nio.file.LinkOption... options) |
protected void |
setFileExtensions(java.nio.file.Path file,
java.util.Map<java.lang.String,byte[]> extensions,
java.nio.file.LinkOption... options) |
protected void |
setFileOwnership(java.nio.file.Path file,
java.lang.String attribute,
java.security.Principal value,
java.nio.file.LinkOption... options) |
protected void |
setFilePermissions(java.nio.file.Path file,
java.util.Set<java.nio.file.attribute.PosixFilePermission> perms,
java.nio.file.LinkOption... options) |
protected void |
setFileRawViewAttribute(java.nio.file.Path file,
java.lang.String view,
java.lang.String attribute,
java.lang.Object value,
java.nio.file.LinkOption... options) |
protected void |
setFileTime(java.nio.file.Path file,
java.lang.String view,
java.lang.String attribute,
java.nio.file.attribute.FileTime value,
java.nio.file.LinkOption... options) |
protected <E extends java.io.IOException> |
signalOpenFailure(int id,
java.lang.String pathValue,
java.nio.file.Path path,
boolean isDir,
E thrown) |
protected <E extends java.io.IOException> |
signalRemovalPreConditionFailure(int id,
java.lang.String pathValue,
java.nio.file.Path path,
E thrown,
boolean isRemoveDirectory) |
protected java.nio.file.attribute.GroupPrincipal |
toGroup(java.nio.file.Path file,
java.nio.file.attribute.GroupPrincipal name) |
protected java.nio.file.attribute.UserPrincipal |
toUser(java.nio.file.Path file,
java.nio.file.attribute.UserPrincipal name) |
protected <H extends Handle> |
validateHandle(java.lang.String handle,
Handle h,
java.lang.Class<H> type)
Makes sure that the local handle is not null and of the specified type
|
protected java.lang.Boolean |
validateProposedVersion(Buffer buffer,
int id,
java.lang.String proposal) |
protected java.util.AbstractMap.SimpleImmutableEntry<java.nio.file.Path,java.lang.Boolean> |
validateRealPath(int id,
java.lang.String path,
java.nio.file.Path f,
java.nio.file.LinkOption... options) |
protected void |
writeAttrs(Buffer buffer,
java.util.Map<java.lang.String,?> attributes) |
protected void |
writeDirEntry(int id,
DirectoryHandle dir,
java.util.Map<java.lang.String,java.nio.file.Path> entries,
Buffer buffer,
int index,
java.nio.file.Path f,
java.lang.String shortName,
java.nio.file.LinkOption... options) |
protected void |
writeDirEntry(ServerSession session,
int id,
Buffer buffer,
int index,
java.nio.file.Path f,
java.lang.String shortName,
SftpClient.Attributes attributes) |
debug, 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, waitgetDefaultDirectory, getSession, getVersiongetSessionContextgetServerSessionpublic static final java.util.NavigableMap<java.lang.String,OptionalFeature> DEFAULT_SUPPORTED_CLIENT_EXTENSIONS
public static final java.util.List<AbstractOpenSSHExtensionParser.OpenSSHExtension> DEFAULT_OPEN_SSH_EXTENSIONS
public static final java.util.List<java.lang.String> DEFAULT_OPEN_SSH_EXTENSIONS_NAMES
public static final java.util.Set<java.lang.Integer> DEFAULT_ACL_SUPPORTED_MASK
private final ChannelSession channelSession
private final UnsupportedAttributePolicy unsupportedAttributePolicy
private final java.util.Collection<SftpEventListener> sftpEventListeners
private final SftpEventListener sftpEventListenerProxy
private final SftpFileSystemAccessor fileSystemAccessor
private final SftpErrorStatusDataHandler errorStatusDataHandler
protected AbstractSftpSubsystemHelper(ChannelSession channelSession, SftpSubsystemConfigurator configurator)
public ChannelSession getServerChannelSession()
getServerChannelSession in interface ServerChannelSessionHolderpublic UnsupportedAttributePolicy getUnsupportedAttributePolicy()
getUnsupportedAttributePolicy in interface SftpUnsupportedAttributePolicyProviderUnsupportedAttributePolicy to use if failed to access some local file attributespublic SftpFileSystemAccessor getFileSystemAccessor()
getFileSystemAccessor in interface SftpFileSystemAccessorProviderSftpFileSystemAccessor to use for accessing files and directoriespublic SftpEventListener getSftpEventListenerProxy()
getSftpEventListenerProxy in interface SftpEventListenerManagerpublic boolean addSftpEventListener(SftpEventListener listener)
SftpEventListenerManageraddSftpEventListener in interface SftpEventListenerManagerlistener - The SftpEventListener instance to add - never nulltrue if listener is a previously un-registered onepublic boolean removeSftpEventListener(SftpEventListener listener)
SftpEventListenerManagerremoveSftpEventListener in interface SftpEventListenerManagerlistener - The SftpEventListener instance to remove - never nulltrue if listener is a (removed) registered onepublic SftpErrorStatusDataHandler getErrorStatusDataHandler()
getErrorStatusDataHandler in interface SftpErrorStatusDataHandlerProvidernull) SftpErrorStatusDataHandler to use when generating failed commands error
messagesprotected java.lang.Boolean validateProposedVersion(Buffer buffer, int id, java.lang.String proposal) throws java.io.IOException
buffer - The Buffer holding the requestid - The request idproposal - The proposed valueBoolean indicating whether to accept/reject the proposal. If null then
rejection response has been sent, otherwise and appropriate response is generatedjava.io.IOException - If failed send an independent rejection responseprotected java.util.Map.Entry<java.lang.Integer,java.lang.String> checkVersionCompatibility(Buffer buffer, int id, int proposed, int failureOpcode) throws java.io.IOException
SftpModuleProperties.SFTP_VERSION property, then it is used to validate the proposed valuebuffer - The Buffer containing the requestid - The SSH message ID to be used to send the failure message if requiredproposed - The proposed version valuefailureOpcode - The failure opcode to send if validation failsString of comma
separated values representing all the supported versions. null if validation failed
and an appropriate status message was sentjava.io.IOException - If failed to send the failure status messageprotected void process(Buffer buffer) throws java.io.IOException
buffer - the buffer to processjava.io.IOException - if anything wrong happensprotected void doProcess(Buffer buffer, int length, int type, int id) throws java.io.IOException
java.io.IOExceptionprotected void doUnsupported(Buffer buffer, int length, int type, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doInit(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doVersionSelect(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doVersionSelect(Buffer buffer, int id, java.lang.String proposed) throws java.io.IOException
java.io.IOExceptionprotected void doOpen(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract java.lang.String doOpen(int id,
java.lang.String path,
int pflags,
int access,
java.util.Map<java.lang.String,java.lang.Object> attrs)
throws java.io.IOException
id - Request idpath - Pathpflags - Open mode flags - see SSH_FXF_XXX flagsaccess - Access mode flags - see ACE4_XXX flagsattrs - Requested attributesjava.io.IOException - if failed to executeprotected <E extends java.io.IOException> E signalOpenFailure(int id,
java.lang.String pathValue,
java.nio.file.Path path,
boolean isDir,
E thrown)
throws java.io.IOException
java.io.IOExceptionprotected void doClose(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doClose(int id,
java.lang.String handle)
throws java.io.IOException
java.io.IOExceptionprotected void doRead(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract int doRead(int id,
java.lang.String handle,
long offset,
int length,
byte[] data,
int doff,
java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> eof)
throws java.io.IOException
java.io.IOExceptionprotected void doWrite(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doWrite(int id,
java.lang.String handle,
long offset,
int length,
byte[] data,
int doff,
int remaining)
throws java.io.IOException
java.io.IOExceptionprotected void doLStat(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected java.util.Map<java.lang.String,java.lang.Object> doLStat(int id,
java.lang.String path,
int flags)
throws java.io.IOException
java.io.IOExceptionprotected void doSetStat(Buffer buffer, int id, java.lang.String extension, int cmd, java.lang.Boolean followLinks) throws java.io.IOException
java.io.IOExceptionprotected void doSetStat(int id,
java.lang.String path,
int cmd,
java.lang.String extension,
java.util.Map<java.lang.String,?> attrs,
java.lang.Boolean followLinks)
throws java.io.IOException
java.io.IOExceptionprotected void doFStat(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract java.util.Map<java.lang.String,java.lang.Object> doFStat(int id,
java.lang.String handle,
int flags)
throws java.io.IOException
java.io.IOExceptionprotected void doFSetStat(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doFSetStat(int id,
java.lang.String handle,
java.util.Map<java.lang.String,?> attrs)
throws java.io.IOException
java.io.IOExceptionprotected void doOpenDir(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract java.lang.String doOpenDir(int id,
java.lang.String path,
java.nio.file.Path p,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected abstract void doReadDir(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doLink(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doLink(int id,
java.lang.String targetPath,
java.lang.String linkPath,
boolean symLink)
throws java.io.IOException
java.io.IOExceptionprotected void doSymLink(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doSymLink(int id,
java.lang.String targetPath,
java.lang.String linkPath)
throws java.io.IOException
java.io.IOExceptionprotected abstract void createLink(int id,
java.lang.String existingPath,
java.lang.String linkPath,
boolean symLink)
throws java.io.IOException
java.io.IOExceptionprotected void doOpenSSHHardLink(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doOpenSSHLimits(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected OpenSSHLimitsExtensionInfo getOpenSSHLimitsExtensionInfo(int id, ChannelSession channel) throws java.io.IOException
java.io.IOExceptionprotected void doOpenSSHHardLink(int id,
java.lang.String srcFile,
java.lang.String dstFile)
throws java.io.IOException
java.io.IOExceptionprotected void doSpaceAvailable(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected SpaceAvailableExtensionInfo doSpaceAvailable(int id, java.lang.String path) throws java.io.IOException
java.io.IOExceptionprotected void doTextSeek(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doTextSeek(int id,
java.lang.String handle,
long line)
throws java.io.IOException
java.io.IOExceptionprotected void doOpenSSHFsync(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doOpenSSHFsync(int id,
java.lang.String handle)
throws java.io.IOException
java.io.IOExceptionprotected void doCheckFileHash(Buffer buffer, int id, java.lang.String targetType) throws java.io.IOException
java.io.IOExceptionprotected void doCheckFileHash(int id,
java.nio.file.Path file,
NamedFactory<? extends Digest> factory,
long startOffset,
long length,
int blockSize,
Buffer buffer)
throws java.lang.Exception
java.lang.Exceptionprotected void doMD5Hash(Buffer buffer, int id, java.lang.String targetType) throws java.io.IOException
java.io.IOExceptionprotected abstract byte[] doMD5Hash(int id,
java.lang.String targetType,
java.lang.String target,
long startOffset,
long length,
byte[] quickCheckHash)
throws java.lang.Exception
java.lang.Exceptionprotected byte[] doMD5Hash(int id,
java.nio.file.Path path,
long startOffset,
long length,
byte[] quickCheckHash)
throws java.lang.Exception
java.lang.Exceptionprotected abstract void doCheckFileHash(int id,
java.lang.String targetType,
java.lang.String target,
java.util.Collection<java.lang.String> algos,
long startOffset,
long length,
int blockSize,
Buffer buffer)
throws java.lang.Exception
java.lang.Exceptionprotected void doReadLink(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected java.util.AbstractMap.SimpleImmutableEntry<java.nio.file.Path,java.lang.String> doReadLink(int id,
java.lang.String path)
throws java.io.IOException
id - Request identifierpath - Referenced pathPath and its referenced symbolic linkjava.io.IOException - If failed to resolve the requested dataprotected void doRename(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doRename(int id,
java.lang.String oldPath,
java.lang.String newPath,
int flags)
throws java.io.IOException
java.io.IOExceptionprotected void doRename(int id,
java.lang.String oldPath,
java.lang.String newPath,
java.util.Collection<java.nio.file.CopyOption> opts)
throws java.io.IOException
java.io.IOExceptionprotected void doPosixRename(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doCopyData(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doCopyData(int id,
java.lang.String readHandle,
long readOffset,
long readLength,
java.lang.String writeHandle,
long writeOffset)
throws java.io.IOException
java.io.IOExceptionprotected void doCopyFile(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doCopyFile(int id,
java.lang.String srcFile,
java.lang.String dstFile,
boolean overwriteDestination)
throws java.io.IOException
java.io.IOExceptionprotected void doCopyFile(int id,
java.lang.String srcFile,
java.lang.String dstFile,
java.util.Collection<java.nio.file.CopyOption> opts)
throws java.io.IOException
java.io.IOExceptionprotected void doBlock(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doBlock(int id,
java.lang.String handle,
long offset,
long length,
int mask)
throws java.io.IOException
java.io.IOExceptionprotected void doUnblock(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected abstract void doUnblock(int id,
java.lang.String handle,
long offset,
long length)
throws java.io.IOException
java.io.IOExceptionprotected void doStat(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected java.util.Map<java.lang.String,java.lang.Object> doStat(int id,
java.lang.String path,
int flags)
throws java.io.IOException
java.io.IOExceptionprotected void doRealPath(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected java.util.AbstractMap.SimpleImmutableEntry<java.nio.file.Path,java.lang.Boolean> doRealPathV6(int id,
java.lang.String path,
java.util.Collection<java.lang.String> extraPaths,
java.nio.file.Path p,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.util.AbstractMap.SimpleImmutableEntry<java.nio.file.Path,java.lang.Boolean> doRealPathV345(int id,
java.lang.String path,
java.nio.file.Path p,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.util.AbstractMap.SimpleImmutableEntry<java.nio.file.Path,java.lang.Boolean> validateRealPath(int id,
java.lang.String path,
java.nio.file.Path f,
java.nio.file.LinkOption... options)
throws java.io.IOException
id - The request identifierpath - The original pathf - The resolve Pathoptions - The LinkOptions to use to verify file existence and accessAbstractMap.SimpleImmutableEntry whose key is the absolute normalized
Path and value is a Boolean indicating its statusjava.io.IOException - If failed to validate the fileIoUtils.checkFileExists(Path, LinkOption...)protected void doRemoveDirectory(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doRemoveDirectory(int id,
java.lang.String path,
boolean followLinks)
throws java.io.IOException
java.io.IOExceptionprotected void doRemove(int id,
java.nio.file.Path p,
boolean isDirectory)
throws java.io.IOException
SftpEventListenerid - Deletion request IDp - Path to deleteisDirectory - Whether the requested path represents a directory or a regular filejava.io.IOException - If failed to deleteprotected void doMakeDirectory(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doMakeDirectory(int id,
java.lang.String path,
java.util.Map<java.lang.String,?> attrs,
boolean followLinks)
throws java.io.IOException
java.io.IOExceptionprotected void doRemove(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void doRemoveFile(int id,
java.lang.String path,
boolean followLinks)
throws java.io.IOException
java.io.IOExceptionprotected <E extends java.io.IOException> E signalRemovalPreConditionFailure(int id,
java.lang.String pathValue,
java.nio.file.Path path,
E thrown,
boolean isRemoveDirectory)
throws java.io.IOException
java.io.IOExceptionprotected void doExtended(Buffer buffer, int id) throws java.io.IOException
java.io.IOExceptionprotected void executeExtendedCommand(Buffer buffer, int id, java.lang.String extension) throws java.io.IOException
buffer - The command Bufferid - The request idextension - The extension namejava.io.IOException - If failed to execute the extensionprotected void doUnsupportedExtension(Buffer buffer, int id, java.lang.String extension) throws java.io.IOException
java.io.IOExceptionprotected void appendExtensions(Buffer buffer, java.lang.String supportedVersions)
protected int appendAclSupportedExtension(Buffer buffer, ServerSession session)
protected java.util.Collection<java.lang.Integer> resolveAclSupportedCapabilities(ServerSession session)
protected java.util.List<AbstractOpenSSHExtensionParser.OpenSSHExtension> appendOpenSSHExtensions(Buffer buffer, ServerSession session)
protected java.util.List<AbstractOpenSSHExtensionParser.OpenSSHExtension> resolveOpenSSHExtensions(ServerSession session)
protected java.util.Map<java.lang.String,OptionalFeature> getSupportedClientExtensions(ServerSession session)
protected java.lang.String appendVersionsExtension(Buffer buffer, java.lang.String value, ServerSession session)
buffer - The Buffer to append tovalue - The recommended value - ignored if null/emptysession - The ServerSession for which this extension is addedSftpConstants.EXT_VERSIONSprotected java.lang.String appendNewlineExtension(Buffer buffer, ServerSession session)
buffer - The Buffer to append tosession - The ServerSession for which this extension is addedSftpConstants.EXT_NEWLINE,
resolveNewlineValue(ServerSession)protected java.lang.String resolveNewlineValue(ServerSession session)
protected java.util.Map<java.lang.String,?> appendVendorIdExtension(Buffer buffer, java.util.Map<java.lang.String,?> versionProperties, ServerSession session)
buffer - The Buffer to append toversionProperties - The currently available version properties - ignored if null/empty. The code
expects the following values:
groupId - as the vendor nameartifactId - as the product nameversion - as the product versionsession - The ServerSession for which these properties are addedSftpConstants.EXT_VENDOR_ID,
DRAFT
09 - section 4.4protected void appendSupportedExtension(Buffer buffer, java.util.Collection<java.lang.String> extras)
buffer - The Buffer to append toextras - The extra extensions that are available and can be reported - may be null/emptyprotected void appendSupported2Extension(Buffer buffer, java.util.Collection<java.lang.String> extras)
buffer - The Buffer to append toextras - The extra extensions that are available and can be reported - may be null/emptySftpConstants.EXT_SUPPORTED,
DRAFT 13 section 5.4protected void sendHandle(Buffer buffer, int id, java.lang.String handle) throws java.io.IOException
java.io.IOExceptionprotected void sendAttrs(Buffer buffer, int id, java.util.Map<java.lang.String,?> attributes) throws java.io.IOException
java.io.IOExceptionprotected void sendLink(Buffer buffer, int id, java.nio.file.Path file, java.lang.String link) throws java.io.IOException
java.io.IOExceptionprotected void sendPath(Buffer buffer, int id, java.nio.file.Path f, java.util.Map<java.lang.String,?> attrs) throws java.io.IOException
java.io.IOExceptionprotected int doReadDir(int id,
java.lang.String handle,
DirectoryHandle dir,
Buffer buffer,
int maxSize,
boolean followLinks)
throws java.io.IOException
id - Request idhandle - The (opaque) handle assigned to this directorydir - The DirectoryHandlebuffer - The Buffer to write the resultsmaxSize - Max. buffer sizefollowLinks - Whether to follow symbolic links when querying the directory contentsjava.io.IOException - If failed to generate an entryprotected void writeDirEntry(ServerSession session, int id, Buffer buffer, int index, java.nio.file.Path f, java.lang.String shortName, SftpClient.Attributes attributes) throws java.io.IOException
java.io.IOExceptionprotected void writeDirEntry(int id,
DirectoryHandle dir,
java.util.Map<java.lang.String,java.nio.file.Path> entries,
Buffer buffer,
int index,
java.nio.file.Path f,
java.lang.String shortName,
java.nio.file.LinkOption... options)
throws java.io.IOException
id - Request iddir - The DirectoryHandleentries - An in / out Map for updating the written entry - key = short name, value = entry
Pathbuffer - The Buffer to write the resultsindex - Zero-based index of the entry to be writtenf - The entry PathshortName - The entry short nameoptions - The LinkOptions to use for querying the entry-s attributesjava.io.IOException - If failed to generate the entry dataprotected java.lang.String getLongName(java.nio.file.Path f,
java.lang.String shortName,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getLongName(java.nio.file.Path f,
java.lang.String shortName,
boolean sendAttrs,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getLongName(java.nio.file.Path f,
java.lang.String shortName,
java.util.Map<java.lang.String,?> attributes)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getLongName(java.nio.file.Path f,
java.lang.String shortName,
SftpClient.Attributes attributes)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getShortName(java.nio.file.Path f)
throws java.io.IOException
java.io.IOExceptionprotected java.util.NavigableMap<java.lang.String,java.lang.Object> resolveFileAttributes(java.nio.file.Path path,
int flags,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void writeAttrs(Buffer buffer, java.util.Map<java.lang.String,?> attributes) throws java.io.IOException
java.io.IOExceptionprotected java.util.NavigableMap<java.lang.String,java.lang.Object> getAttributes(java.nio.file.Path file,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.util.NavigableMap<java.lang.String,java.lang.Object> handleUnknownStatusFileAttributes(java.nio.file.Path file,
int flags,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.util.NavigableMap<java.lang.String,java.lang.Object> getAttributes(java.nio.file.Path path,
int flags,
java.nio.file.LinkOption... options)
throws java.io.IOException
path - The Path location for the required attributesflags - A mask of the original required attributes - ignored by the default implementationoptions - The LinkOptions to use in order to access the file if necessaryMap of the retrieved attributesjava.io.IOException - If failed to access the fileresolveReportedFileAttributes(Path, int, LinkOption...)protected java.util.NavigableMap<java.lang.String,java.lang.Object> resolveReportedFileAttributes(java.nio.file.Path file,
int flags,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.util.NavigableMap<java.lang.String,java.lang.Object> resolveMissingFileAttributes(java.nio.file.Path file,
int flags,
java.util.Map<java.lang.String,java.lang.Object> current,
java.nio.file.LinkOption... options)
throws java.io.IOException
getAttributes(Path, int, LinkOption...) in order to complete any attributes that could not be
retrieved via the supported file system views. These attributes are deemed important so an extra effort is made
to provide a value for themfile - The Path location for the required attributesflags - A mask of the original required attributes - ignored by the default implementationcurrent - The Map of attributes already retrieved - may be null/empty and/or
unmodifiableoptions - The LinkOptions to use in order to access the file if necessaryMap of the extra attributes whose values need to be updated in the original map.
Note: it is allowed to specify values which override existing ones - the
default implementation does not override values that have a non-null valuejava.io.IOException - If failed to access the attributes - in which case an error is returned to the SFTP
clientSftpFileSystemAccessor.FILEATTRS_RESOLVERSprotected java.lang.Object resolveMissingFileAttributeValue(java.nio.file.Path file,
java.lang.String name,
java.lang.Object value,
FileInfoExtractor<?> x,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.util.NavigableMap<java.lang.String,java.lang.Object> addMissingAttribute(java.nio.file.Path file,
java.util.NavigableMap<java.lang.String,java.lang.Object> current,
java.lang.String name,
FileInfoExtractor<?> x,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.util.NavigableMap<java.lang.String,java.lang.Object> readFileAttributes(java.nio.file.Path file,
java.lang.String view,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected java.util.NavigableMap<java.lang.String,java.lang.Object> handleReadFileAttributesException(java.nio.file.Path file,
java.lang.String view,
java.nio.file.LinkOption[] options,
java.io.IOException e)
throws java.io.IOException
java.io.IOExceptionprotected void doSetAttributes(int cmd,
java.lang.String extension,
java.nio.file.Path file,
java.util.Map<java.lang.String,?> attributes,
boolean followLinks)
throws java.io.IOException
java.io.IOExceptionprotected java.nio.file.LinkOption[] getPathResolutionLinkOption(int cmd,
java.lang.String extension,
java.nio.file.Path path)
throws java.io.IOException
java.io.IOExceptionprotected boolean resolvePathResolutionFollowLinks(int cmd,
java.lang.String extension,
java.nio.file.Path path)
throws java.io.IOException
java.io.IOExceptionprotected void setFileAttributes(java.nio.file.Path file,
java.util.Map<java.lang.String,?> attributes,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void handleSetFileAttributeFailure(java.nio.file.Path file,
java.lang.String view,
java.lang.String attribute,
java.lang.Object value,
java.util.Collection<java.lang.String> unsupported,
java.lang.Exception e)
throws java.io.IOException
java.io.IOExceptionprotected void setFileAttribute(java.nio.file.Path file,
java.lang.String view,
java.lang.String attribute,
java.lang.Object value,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void setFileTime(java.nio.file.Path file,
java.lang.String view,
java.lang.String attribute,
java.nio.file.attribute.FileTime value,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void setFileRawViewAttribute(java.nio.file.Path file,
java.lang.String view,
java.lang.String attribute,
java.lang.Object value,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void setFileOwnership(java.nio.file.Path file,
java.lang.String attribute,
java.security.Principal value,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void setFileExtensions(java.nio.file.Path file,
java.util.Map<java.lang.String,byte[]> extensions,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void setFilePermissions(java.nio.file.Path file,
java.util.Set<java.nio.file.attribute.PosixFilePermission> perms,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void setFileAccessControl(java.nio.file.Path file,
java.util.List<java.nio.file.attribute.AclEntry> acl,
java.nio.file.LinkOption... options)
throws java.io.IOException
java.io.IOExceptionprotected void handleUnsupportedAttributes(java.util.Collection<java.lang.String> attributes)
protected java.nio.file.attribute.GroupPrincipal toGroup(java.nio.file.Path file,
java.nio.file.attribute.GroupPrincipal name)
throws java.io.IOException
java.io.IOExceptionprotected java.nio.file.attribute.UserPrincipal toUser(java.nio.file.Path file,
java.nio.file.attribute.UserPrincipal name)
throws java.io.IOException
java.io.IOExceptionprotected void handleUserPrincipalLookupServiceException(java.lang.Class<? extends java.security.Principal> principalType,
java.lang.String name,
java.io.IOException e)
throws java.io.IOException
java.io.IOExceptionprotected java.util.Map<java.lang.String,java.lang.Object> readAttrs(Buffer buffer) throws java.io.IOException
java.io.IOExceptionprotected <H extends Handle> H validateHandle(java.lang.String handle, Handle h, java.lang.Class<H> type) throws java.io.IOException
H - The generic handle typehandle - The original handle idh - The resolved Handle instancetype - The expected handle typejava.io.IOException - If a generic exception occurredjava.io.FileNotFoundException - If the handle instance is nullInvalidHandleException - If the handle instance is not of the expected typeprotected void sendStatus(Buffer buffer, int id, java.lang.Throwable e, int cmd, java.lang.Object... args) throws java.io.IOException
buffer - A Buffer to be used to build the status replyid - Command identifiere - Thrown exceptioncmd - The command that was attemptedargs - The relevant command arguments - Note: provided only for logging purposes and
subject to type and/or order change at any versionjava.io.IOException - If failed to build and send the status bufferprotected void sendStatus(Buffer buffer, int id, int substatus, java.lang.String msg) throws java.io.IOException
java.io.IOExceptionprotected void sendStatus(Buffer buffer, int id, int substatus, java.lang.String msg, java.lang.String lang) throws java.io.IOException
java.io.IOExceptionprotected abstract void send(Buffer buffer) throws java.io.IOException
java.io.IOExceptionprotected java.nio.file.Path resolveNormalizedLocation(java.lang.String remotePath)
throws java.io.IOException,
java.nio.file.InvalidPathException
java.io.IOExceptionjava.nio.file.InvalidPathExceptionprotected java.nio.file.Path normalize(java.nio.file.Path f)
protected java.nio.file.Path resolveFile(java.lang.String remotePath)
throws java.io.IOException,
java.nio.file.InvalidPathException
remotePath - The remote path - separated by '/'Pathjava.io.IOException - If failed to resolve the local pathjava.nio.file.InvalidPathException - If bad local path specification