Class AbstractSftpEventListenerAdapter

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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
      void blocking​(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, long length, int mask)
      Called prior to blocking a file section
      void closing​(ServerSession session, java.lang.String remoteHandle, Handle localHandle)
      Specified file / directory about to be closed
      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
      void creating​(ServerSession session, java.nio.file.Path path, java.util.Map<java.lang.String,​?> attrs)
      Called prior to creating a directory
      void destroying​(ServerSession session)
      Called when subsystem is destroyed since it was closed
      void initialized​(ServerSession session, int version)
      Called when the SFTP protocol has been initialized
      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
      void linking​(ServerSession session, java.nio.file.Path source, java.nio.file.Path target, boolean symLink)
      Called prior to creating a link
      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
      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
      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
      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
      void open​(ServerSession session, java.lang.String remoteHandle, Handle localHandle)
      Specified file / directory has been opened
      void opening​(ServerSession session, java.lang.String remoteHandle, Handle localHandle)
      Specified file / directory is being opened
      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
      void readEntries​(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
      void reading​(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen)
      Preparing to read from a file
      void removed​(ServerSession session, java.nio.file.Path path, boolean isDirectory, java.lang.Throwable thrown)
      Called after a file has been removed
      void removing​(ServerSession session, java.nio.file.Path path, boolean isDirectory)
      Called prior to removing a file
      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
      void unblocking​(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, long length)
      Called prior to un-blocking a file section
      void writing​(ServerSession session, java.lang.String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen)
      Preparing to write to file
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractSftpEventListenerAdapter

        protected AbstractSftpEventListenerAdapter()
    • Method Detail

      • initialized

        public void initialized​(ServerSession session,
                                int version)
                         throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called when the SFTP protocol has been initialized
        Specified by:
        initialized in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        version - The negotiated SFTP version
        Throws:
        java.io.IOException - If failed to handle the call
      • destroying

        public void destroying​(ServerSession session)
                        throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called when subsystem is destroyed since it was closed
        Specified by:
        destroying in interface SftpEventListener
        Parameters:
        session - The associated ServerSession
        Throws:
        java.io.IOException - If failed to handle the call
      • opening

        public void opening​(ServerSession session,
                            java.lang.String remoteHandle,
                            Handle localHandle)
                     throws java.io.IOException
        Description copied from interface: SftpEventListener
        Specified file / directory is being opened
        Specified by:
        opening in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file / directory
        localHandle - The associated file / directory Handle
        Throws:
        java.io.IOException - If failed to handle the call
      • open

        public void open​(ServerSession session,
                         java.lang.String remoteHandle,
                         Handle localHandle)
                  throws java.io.IOException
        Description copied from interface: SftpEventListener
        Specified file / directory has been opened
        Specified by:
        open in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file / directory
        localHandle - The associated file / directory Handle
        Throws:
        java.io.IOException - If failed to handle the call
      • readEntries

        public void readEntries​(ServerSession session,
                                java.lang.String remoteHandle,
                                DirectoryHandle localHandle,
                                java.util.Map<java.lang.String,​java.nio.file.Path> entries)
                         throws java.io.IOException
        Description copied from interface: SftpEventListener
        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
        Specified by:
        readEntries in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the directory
        localHandle - The associated DirectoryHandle
        entries - A Map of the listed entries - key = short name, value = Path of the sub-entry
        Throws:
        java.io.IOException - If failed to handle the call
      • reading

        public void reading​(ServerSession session,
                            java.lang.String remoteHandle,
                            FileHandle localHandle,
                            long offset,
                            byte[] data,
                            int dataOffset,
                            int dataLen)
                     throws java.io.IOException
        Description copied from interface: SftpEventListener
        Preparing to read from a file
        Specified by:
        reading in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file
        localHandle - The associated FileHandle
        offset - Offset in file from which to read
        data - Buffer holding the read data
        dataOffset - Offset of read data in buffer
        dataLen - Requested read length
        Throws:
        java.io.IOException - If failed to handle the call
      • read

        public 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
        Description copied from interface: SftpEventListener
        Result of reading from a file
        Specified by:
        read in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file
        localHandle - The associated FileHandle
        offset - Offset in file from which to read
        data - Buffer holding the read data
        dataOffset - Offset of read data in buffer
        dataLen - Requested read length
        readLen - Actual read length - negative if thrown exception provided
        thrown - Non-null if read failed due to this exception
        Throws:
        java.io.IOException - If failed to handle the call
      • writing

        public void writing​(ServerSession session,
                            java.lang.String remoteHandle,
                            FileHandle localHandle,
                            long offset,
                            byte[] data,
                            int dataOffset,
                            int dataLen)
                     throws java.io.IOException
        Description copied from interface: SftpEventListener
        Preparing to write to file
        Specified by:
        writing in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file
        localHandle - The associated FileHandle
        offset - Offset in file to which to write
        data - Buffer holding the written data
        dataOffset - Offset of write data in buffer
        dataLen - Requested write length
        Throws:
        java.io.IOException - If failed to handle the call
      • written

        public 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
        Description copied from interface: SftpEventListener
        Finished to writing to file
        Specified by:
        written in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file
        localHandle - The associated FileHandle
        offset - Offset in file to which to write
        data - Buffer holding the written data
        dataOffset - Offset of write data in buffer
        dataLen - Requested write length
        thrown - The reason for failing to write - null if successful
        Throws:
        java.io.IOException - If failed to handle the call
      • blocked

        public void blocked​(ServerSession session,
                            java.lang.String remoteHandle,
                            FileHandle localHandle,
                            long offset,
                            long length,
                            int mask,
                            java.lang.Throwable thrown)
                     throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called after blocking a file section
        Specified by:
        blocked in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file
        localHandle - The associated FileHandle
        offset - Offset in file for locking
        length - Section size for locking
        mask - Lock mask flags - see SSH_FXP_BLOCK message
        thrown - If not-null then the reason for the failure to execute
        Throws:
        java.io.IOException - If failed to handle the call
      • unblocking

        public void unblocking​(ServerSession session,
                               java.lang.String remoteHandle,
                               FileHandle localHandle,
                               long offset,
                               long length)
                        throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called prior to un-blocking a file section
        Specified by:
        unblocking in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file
        localHandle - The associated FileHandle
        offset - Offset in file for un-locking
        length - Section size for un-locking
        Throws:
        java.io.IOException - If failed to handle the call
      • unblocked

        public void unblocked​(ServerSession session,
                              java.lang.String remoteHandle,
                              FileHandle localHandle,
                              long offset,
                              long length,
                              java.lang.Throwable thrown)
                       throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called prior to un-blocking a file section
        Specified by:
        unblocked in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file
        localHandle - The associated FileHandle
        offset - Offset in file for un-locking
        length - Section size for un-locking
        thrown - If not-null then the reason for the failure to execute
        Throws:
        java.io.IOException - If failed to handle the call
      • closing

        public void closing​(ServerSession session,
                            java.lang.String remoteHandle,
                            Handle localHandle)
                     throws java.io.IOException
        Description copied from interface: SftpEventListener
        Specified file / directory about to be closed
        Specified by:
        closing in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        remoteHandle - The (opaque) assigned handle for the file / directory
        localHandle - The associated file / directory Handle
        Throws:
        java.io.IOException - If failed to handle the call
      • created

        public void created​(ServerSession session,
                            java.nio.file.Path path,
                            java.util.Map<java.lang.String,​?> attrs,
                            java.lang.Throwable thrown)
                     throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called after creating a directory
        Specified by:
        created in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        path - Directory Path to be created
        attrs - Requested associated attributes to set
        thrown - If not-null then the reason for the failure to execute
        Throws:
        java.io.IOException - If failed to handle the call
      • moved

        public 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
        Description copied from interface: SftpEventListener
        Called after renaming a file / directory
        Specified by:
        moved in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        srcPath - The source Path
        dstPath - The target Path
        opts - The resolved renaming options
        thrown - If not-null then the reason for the failure to execute
        Throws:
        java.io.IOException - If failed to handle the call
      • removed

        public void removed​(ServerSession session,
                            java.nio.file.Path path,
                            boolean isDirectory,
                            java.lang.Throwable thrown)
                     throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called after a file has been removed
        Specified by:
        removed in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        path - The Path to be removed
        isDirectory - Whether this was a folder or a file
        thrown - If not-null then the reason for the failure to execute
        Throws:
        java.io.IOException - If failed to handle the call
      • linked

        public void linked​(ServerSession session,
                           java.nio.file.Path source,
                           java.nio.file.Path target,
                           boolean symLink,
                           java.lang.Throwable thrown)
                    throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called after creating a link
        Specified by:
        linked in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        source - The source Path
        target - The target Path
        symLink - true = symbolic link
        thrown - If not-null then the reason for the failure to execute
        Throws:
        java.io.IOException - If failed to handle the call
      • modifiedAttributes

        public void modifiedAttributes​(ServerSession session,
                                       java.nio.file.Path path,
                                       java.util.Map<java.lang.String,​?> attrs,
                                       java.lang.Throwable thrown)
                                throws java.io.IOException
        Description copied from interface: SftpEventListener
        Called after modifying the attributes of a file / directory
        Specified by:
        modifiedAttributes in interface SftpEventListener
        Parameters:
        session - The ServerSession through which the request was handled
        path - The file / directory Path to be modified
        attrs - 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 execute
        Throws:
        java.io.IOException - If failed to handle the call