public interface SftpEventListener extends SshdEventListener
Modifier and Type | Method and Description |
---|---|
default void |
blocked(ServerSession session,
java.lang.String remoteHandle,
FileHandle localHandle,
long offset,
long length,
int mask,
java.lang.Throwable thrown)
Called after blocking a file section
|
default void |
blocking(ServerSession session,
java.lang.String remoteHandle,
FileHandle localHandle,
long offset,
long length,
int mask)
Called prior to blocking a file section
|
default void |
closed(ServerSession session,
java.lang.String remoteHandle,
Handle localHandle,
java.lang.Throwable thrown)
Specified file / directory has been closed
|
default void |
closing(ServerSession session,
java.lang.String remoteHandle,
Handle localHandle)
Specified file / directory about to be closed
|
default void |
created(ServerSession session,
java.nio.file.Path path,
java.util.Map<java.lang.String,?> attrs,
java.lang.Throwable thrown)
Called after creating a directory
|
default void |
creating(ServerSession session,
java.nio.file.Path path,
java.util.Map<java.lang.String,?> attrs)
Called prior to creating a directory
|
default void |
destroying(ServerSession session)
Called when subsystem is destroyed since it was closed
|
default void |
exiting(ServerSession session,
Handle handle)
Called when subsystem is exiting due to being destroyed
|
default void |
initialized(ServerSession session,
int version)
Called when the SFTP protocol has been initialized
|
default void |
linked(ServerSession session,
java.nio.file.Path source,
java.nio.file.Path target,
boolean symLink,
java.lang.Throwable thrown)
Called after creating a link
|
default void |
linking(ServerSession session,
java.nio.file.Path source,
java.nio.file.Path target,
boolean symLink)
Called prior to creating a link
|
default void |
modifiedAttributes(ServerSession session,
java.nio.file.Path path,
java.util.Map<java.lang.String,?> attrs,
java.lang.Throwable thrown)
Called after modifying the attributes of a file / directory
|
default void |
modifyingAttributes(ServerSession session,
java.nio.file.Path path,
java.util.Map<java.lang.String,?> attrs)
Called prior to modifying the attributes of a file / directory
|
default void |
moved(ServerSession session,
java.nio.file.Path srcPath,
java.nio.file.Path dstPath,
java.util.Collection<java.nio.file.CopyOption> opts,
java.lang.Throwable thrown)
Called after renaming a file / directory
|
default void |
moving(ServerSession session,
java.nio.file.Path srcPath,
java.nio.file.Path dstPath,
java.util.Collection<java.nio.file.CopyOption> opts)
Called prior to renaming a file / directory
|
default void |
open(ServerSession session,
java.lang.String remoteHandle,
Handle localHandle)
Specified file / directory has been opened
|
default void |
openFailed(ServerSession session,
java.lang.String remotePath,
java.nio.file.Path localPath,
boolean isDirectory,
java.lang.Throwable thrown)
Specified file / directory could not be opened - Note: this call may occur without
opening(ServerSession, String, Handle) ever having been called |
default void |
opening(ServerSession session,
java.lang.String remoteHandle,
Handle localHandle)
Specified file / directory is being opened
|
default void |
read(ServerSession session,
java.lang.String remoteHandle,
DirectoryHandle localHandle,
java.util.Map<java.lang.String,java.nio.file.Path> entries)
Result of reading entries from a directory - Note: it may be a partial result if the directory
contains more entries than can be accommodated in the response
|
default void |
read(ServerSession session,
java.lang.String remoteHandle,
FileHandle localHandle,
long offset,
byte[] data,
int dataOffset,
int dataLen,
int readLen,
java.lang.Throwable thrown)
Result of reading from a file
|
default void |
reading(ServerSession session,
java.lang.String remoteHandle,
FileHandle localHandle,
long offset,
byte[] data,
int dataOffset,
int dataLen)
Preparing to read from a file
|
default void |
removed(ServerSession session,
java.nio.file.Path path,
boolean isDirectory,
java.lang.Throwable thrown)
Called after a file has been removed
|
default void |
removing(ServerSession session,
java.nio.file.Path path,
boolean isDirectory)
Called prior to removing a file
|
default void |
unblocked(ServerSession session,
java.lang.String remoteHandle,
FileHandle localHandle,
long offset,
long length,
java.lang.Throwable thrown)
Called prior to un-blocking a file section
|
default void |
unblocking(ServerSession session,
java.lang.String remoteHandle,
FileHandle localHandle,
long offset,
long length)
Called prior to un-blocking a file section
|
static <L extends SftpEventListener> |
validateListener(L listener) |
default void |
writing(ServerSession session,
java.lang.String remoteHandle,
FileHandle localHandle,
long offset,
byte[] data,
int dataOffset,
int dataLen)
Preparing to write to file
|
default void |
written(ServerSession session,
java.lang.String remoteHandle,
FileHandle localHandle,
long offset,
byte[] data,
int dataOffset,
int dataLen,
java.lang.Throwable thrown)
Finished to writing to file
|
validateListener
default void initialized(ServerSession session, int version) throws java.io.IOException
session
- The ServerSession
through which the request was handledversion
- The negotiated SFTP versionjava.io.IOException
- If failed to handle the calldefault void exiting(ServerSession session, Handle handle) throws java.io.IOException
session
- The associated ServerSession
handle
- The file / directory Handle
being closed due to the exitjava.io.IOException
- If failed to handle the calldefault void destroying(ServerSession session) throws java.io.IOException
session
- The associated ServerSession
java.io.IOException
- If failed to handle the calldefault void opening(ServerSession session, java.lang.String remoteHandle, Handle localHandle) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the file / directorylocalHandle
- The associated file / directory Handle
java.io.IOException
- If failed to handle the calldefault void open(ServerSession session, java.lang.String remoteHandle, Handle localHandle) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the file / directorylocalHandle
- The associated file / directory Handle
java.io.IOException
- If failed to handle the calldefault void openFailed(ServerSession session, java.lang.String remotePath, java.nio.file.Path localPath, boolean isDirectory, java.lang.Throwable thrown) throws java.io.IOException
opening(ServerSession, String, Handle)
ever having been calledsession
- The ServerSession
through which the request was handledremotePath
- The path that was specified in the commandlocalPath
- The matching resolved local pathisDirectory
- Whether this was a folder or a filethrown
- Non-null
reason for the failurejava.io.IOException
- If failed to handle the calldefault void read(ServerSession session, java.lang.String remoteHandle, DirectoryHandle localHandle, java.util.Map<java.lang.String,java.nio.file.Path> entries) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the directorylocalHandle
- The associated DirectoryHandle
entries
- A Map
of the listed entries - key = short name, value = Path
of the
sub-entryjava.io.IOException
- If failed to handle the calldefault void reading(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the filelocalHandle
- The associated FileHandle
offset
- Offset in file from which to readdata
- Buffer holding the read datadataOffset
- Offset of read data in bufferdataLen
- Requested read lengthjava.io.IOException
- If failed to handle the calldefault void read(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, int readLen, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the filelocalHandle
- The associated FileHandle
offset
- Offset in file from which to readdata
- Buffer holding the read datadataOffset
- Offset of read data in bufferdataLen
- Requested read lengthreadLen
- Actual read length - negative if thrown exception providedthrown
- Non-null
if read failed due to this exceptionjava.io.IOException
- If failed to handle the calldefault void writing(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the filelocalHandle
- The associated FileHandle
offset
- Offset in file to which to writedata
- Buffer holding the written datadataOffset
- Offset of write data in bufferdataLen
- Requested write lengthjava.io.IOException
- If failed to handle the calldefault void written(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the filelocalHandle
- The associated FileHandle
offset
- Offset in file to which to writedata
- Buffer holding the written datadataOffset
- Offset of write data in bufferdataLen
- Requested write lengththrown
- The reason for failing to write - null
if successfuljava.io.IOException
- If failed to handle the calldefault void blocking(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, long length, int mask) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the filelocalHandle
- The associated FileHandle
offset
- Offset in file for lockinglength
- Section size for lockingmask
- Lock mask flags - see SSH_FXP_BLOCK
messagejava.io.IOException
- If failed to handle the callblocked(ServerSession, String, FileHandle, long, long, int, Throwable)
default void blocked(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, long length, int mask, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the filelocalHandle
- The associated FileHandle
offset
- Offset in file for lockinglength
- Section size for lockingmask
- Lock mask flags - see SSH_FXP_BLOCK
messagethrown
- If not-null
then the reason for the failure to executejava.io.IOException
- If failed to handle the calldefault void unblocking(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, long length) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the filelocalHandle
- The associated FileHandle
offset
- Offset in file for un-lockinglength
- Section size for un-lockingjava.io.IOException
- If failed to handle the calldefault void unblocked(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, long length, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the filelocalHandle
- The associated FileHandle
offset
- Offset in file for un-lockinglength
- Section size for un-lockingthrown
- If not-null
then the reason for the failure to executejava.io.IOException
- If failed to handle the calldefault void closing(ServerSession session, java.lang.String remoteHandle, Handle localHandle) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the file / directorylocalHandle
- The associated file / directory Handle
java.io.IOException
- If failed to handle the calldefault void closed(ServerSession session, java.lang.String remoteHandle, Handle localHandle, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledremoteHandle
- The (opaque) assigned handle for the file / directorylocalHandle
- The associated file / directory Handle
thrown
- If not-null
then the reason for the failure to executejava.io.IOException
- If failed to handle the calldefault void creating(ServerSession session, java.nio.file.Path path, java.util.Map<java.lang.String,?> attrs) throws java.io.IOException
session
- The ServerSession
through which the request was handledpath
- Directory Path
to be createdattrs
- Requested associated attributes to setjava.io.IOException
- If failed to handle the callcreated(ServerSession, Path, Map, Throwable)
default void created(ServerSession session, java.nio.file.Path path, java.util.Map<java.lang.String,?> attrs, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledpath
- Directory Path
to be createdattrs
- Requested associated attributes to setthrown
- If not-null
then the reason for the failure to executejava.io.IOException
- If failed to handle the calldefault void moving(ServerSession session, java.nio.file.Path srcPath, java.nio.file.Path dstPath, java.util.Collection<java.nio.file.CopyOption> opts) throws java.io.IOException
session
- The ServerSession
through which the request was handledsrcPath
- The source Path
dstPath
- The target Path
opts
- The resolved renaming optionsjava.io.IOException
- If failed to handle the callmoved(ServerSession, Path, Path, Collection, Throwable)
default void moved(ServerSession session, java.nio.file.Path srcPath, java.nio.file.Path dstPath, java.util.Collection<java.nio.file.CopyOption> opts, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledsrcPath
- The source Path
dstPath
- The target Path
opts
- The resolved renaming optionsthrown
- If not-null
then the reason for the failure to executejava.io.IOException
- If failed to handle the calldefault void removing(ServerSession session, java.nio.file.Path path, boolean isDirectory) throws java.io.IOException
session
- The ServerSession
through which the request was handledpath
- The Path
about to be removedisDirectory
- Whether this is a folder or a filejava.io.IOException
- If failed to handle the callremoved(ServerSession, Path, boolean, Throwable)
default void removed(ServerSession session, java.nio.file.Path path, boolean isDirectory, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledpath
- The Path
to be removedisDirectory
- Whether this was a folder or a filethrown
- If not-null
then the reason for the failure to executejava.io.IOException
- If failed to handle the calldefault void linking(ServerSession session, java.nio.file.Path source, java.nio.file.Path target, boolean symLink) throws java.io.IOException
session
- The ServerSession
through which the request was handledsource
- The source Path
target
- The target Path
symLink
- true
= symbolic linkjava.io.IOException
- If failed to handle the calllinked(ServerSession, Path, Path, boolean, Throwable)
default void linked(ServerSession session, java.nio.file.Path source, java.nio.file.Path target, boolean symLink, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledsource
- The source Path
target
- The target Path
symLink
- true
= symbolic linkthrown
- If not-null
then the reason for the failure to executejava.io.IOException
- If failed to handle the calldefault void modifyingAttributes(ServerSession session, java.nio.file.Path path, java.util.Map<java.lang.String,?> attrs) throws java.io.IOException
session
- The ServerSession
through which the request was handledpath
- The file / directory Path
to be modifiedattrs
- The attributes Map
- names and values depend on the O/S, view, type, etc...java.io.IOException
- If failed to handle the callmodifiedAttributes(ServerSession, Path, Map, Throwable)
default void modifiedAttributes(ServerSession session, java.nio.file.Path path, java.util.Map<java.lang.String,?> attrs, java.lang.Throwable thrown) throws java.io.IOException
session
- The ServerSession
through which the request was handledpath
- The file / directory Path
to be modifiedattrs
- The attributes Map
- names and values depend on the O/S, view, type, etc...thrown
- If not-null
then the reason for the failure to executejava.io.IOException
- If failed to handle the callstatic <L extends SftpEventListener> L validateListener(L listener)