Class AbstractSftpEventListenerAdapter

java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter
All Implemented Interfaces:
EventListener, org.apache.sshd.common.util.SshdEventListener, SftpEventListener

public abstract class AbstractSftpEventListenerAdapter extends org.apache.sshd.common.util.logging.AbstractLoggingBean implements SftpEventListener
A no-op implementation of SftpEventListener for those who wish to implement only a small number of methods. By default, all non-overridden methods simply log at TRACE level their invocation parameters
Author:
Apache MINA SSHD Project
  • Field Summary

    Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    log
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    blocked(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, int mask, Throwable thrown)
    Called after blocking a file section
    void
    blocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, int mask)
    Called prior to blocking a file section
    void
    closed(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Handle localHandle, Throwable thrown)
    Specified file / directory has been closed
    void
    closing(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Handle localHandle)
    Specified file / directory about to be closed
    void
    created(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs, Throwable thrown)
    Called after creating a directory
    void
    creating(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs)
    Called prior to creating a directory
    void
    destroying(org.apache.sshd.server.session.ServerSession session)
    Called when subsystem is destroyed since it was closed
    void
    exiting(org.apache.sshd.server.session.ServerSession session, Handle handle)
    Called when subsystem is exiting due to being destroyed
    void
    initialized(org.apache.sshd.server.session.ServerSession session, int version)
    Called when the SFTP protocol has been initialized
    void
    linked(org.apache.sshd.server.session.ServerSession session, Path source, Path target, boolean symLink, Throwable thrown)
    Called after creating a link
    void
    linking(org.apache.sshd.server.session.ServerSession session, Path source, Path target, boolean symLink)
    Called prior to creating a link
    void
    modifiedAttributes(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs, Throwable thrown)
    Called after modifying the attributes of a file / directory
    void
    modifyingAttributes(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs)
    Called prior to modifying the attributes of a file / directory
    void
    moved(org.apache.sshd.server.session.ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts, Throwable thrown)
    Called after renaming a file / directory
    void
    moving(org.apache.sshd.server.session.ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts)
    Called prior to renaming a file / directory
    void
    open(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Handle localHandle)
    Specified file / directory has been opened
    void
    openFailed(org.apache.sshd.server.session.ServerSession session, String remotePath, Path localPath, boolean isDirectory, Throwable thrown)
    Specified file / directory could not be opened - Note: this call may occur without SftpEventListener.opening(ServerSession, String, Handle) ever having been called
    void
    opening(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Handle localHandle)
    Specified file / directory is being opened
    void
    read(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, int readLen, Throwable thrown)
    Result of reading from a file
    void
    readEntries(org.apache.sshd.server.session.ServerSession session, String remoteHandle, DirectoryHandle localHandle, Map<String,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(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen)
    Preparing to read from a file
    void
    readingEntries(org.apache.sshd.server.session.ServerSession session, String remoteHandle, DirectoryHandle localHandle)
    About to read entries from a directory - Note: might not be the 1st time it is called for the directory in case several iterations are required in order to go through all the entries in the directory
    void
    receivedExtension(org.apache.sshd.server.session.ServerSession session, String extension, int id)
    Called when a SFTP extension request SftpConstants.SSH_FXP_EXTENDED has been received before it is processed.
    void
    removed(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory, Throwable thrown)
    Called after a file has been removed
    void
    removing(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory)
    Called prior to removing a file
    void
    unblocked(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, Throwable thrown)
    Called prior to un-blocking a file section
    void
    unblocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length)
    Called prior to un-blocking a file section
    void
    writing(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen)
    Preparing to write to file
    void
    written(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, Throwable thrown)
    Finished to writing to file

    Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.sshd.sftp.server.SftpEventListener

    received
  • Constructor Details

    • AbstractSftpEventListenerAdapter

      protected AbstractSftpEventListenerAdapter()
  • Method Details

    • receivedExtension

      public void receivedExtension(org.apache.sshd.server.session.ServerSession session, String extension, int id) throws IOException
      Description copied from interface: SftpEventListener
      Called when a SFTP extension request SftpConstants.SSH_FXP_EXTENDED has been received before it is processed.
      Specified by:
      receivedExtension in interface SftpEventListener
      Parameters:
      session - The ServerSession through which the request was received
      extension - The extension request received; one of the SSH_EXT_* constants from SftpConstants
      id - The id received with the request
      Throws:
      IOException - If the request shall generate an error response.
    • initialized

      public void initialized(org.apache.sshd.server.session.ServerSession session, int version) throws 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:
      IOException - If failed to handle the call
    • destroying

      public void destroying(org.apache.sshd.server.session.ServerSession session) throws 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:
      IOException - If failed to handle the call
    • opening

      public void opening(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Handle localHandle) throws 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:
      IOException - If failed to handle the call
    • openFailed

      public void openFailed(org.apache.sshd.server.session.ServerSession session, String remotePath, Path localPath, boolean isDirectory, Throwable thrown) throws IOException
      Description copied from interface: SftpEventListener
      Specified file / directory could not be opened - Note: this call may occur without SftpEventListener.opening(ServerSession, String, Handle) ever having been called
      Specified by:
      openFailed in interface SftpEventListener
      Parameters:
      session - The ServerSession through which the request was handled
      remotePath - The path that was specified in the command
      localPath - The matching resolved local path
      isDirectory - Whether this was a folder or a file
      thrown - Non-null reason for the failure
      Throws:
      IOException - If failed to handle the call
    • open

      public void open(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Handle localHandle) throws 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:
      IOException - If failed to handle the call
    • readingEntries

      public void readingEntries(org.apache.sshd.server.session.ServerSession session, String remoteHandle, DirectoryHandle localHandle) throws IOException
      Description copied from interface: SftpEventListener
      About to read entries from a directory - Note: might not be the 1st time it is called for the directory in case several iterations are required in order to go through all the entries in the directory
      Specified by:
      readingEntries 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
      Throws:
      IOException - If failed to handle the call
      See Also:
    • readEntries

      public void readEntries(org.apache.sshd.server.session.ServerSession session, String remoteHandle, DirectoryHandle localHandle, Map<String,Path> entries) throws 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:
      IOException - If failed to handle the call
    • reading

      public void reading(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen) throws 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:
      IOException - If failed to handle the call
    • read

      public void read(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, int readLen, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • writing

      public void writing(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen) throws 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:
      IOException - If failed to handle the call
    • written

      public void written(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • blocking

      public void blocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, int mask) throws IOException
      Description copied from interface: SftpEventListener
      Called prior to blocking a file section
      Specified by:
      blocking 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
      Throws:
      IOException - If failed to handle the call
      See Also:
    • blocked

      public void blocked(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, int mask, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • unblocking

      public void unblocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length) throws 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:
      IOException - If failed to handle the call
    • unblocked

      public void unblocked(org.apache.sshd.server.session.ServerSession session, String remoteHandle, FileHandle localHandle, long offset, long length, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • closing

      public void closing(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Handle localHandle) throws 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:
      IOException - If failed to handle the call
    • closed

      public void closed(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Handle localHandle, Throwable thrown) throws IOException
      Description copied from interface: SftpEventListener
      Specified file / directory has been closed
      Specified by:
      closed 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
      thrown - If not-null then the reason for the failure to execute
      Throws:
      IOException - If failed to handle the call
    • creating

      public void creating(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs) throws IOException
      Description copied from interface: SftpEventListener
      Called prior to creating a directory
      Specified by:
      creating 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
      Throws:
      IOException - If failed to handle the call
      See Also:
    • created

      public void created(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • moving

      public void moving(org.apache.sshd.server.session.ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts) throws IOException
      Description copied from interface: SftpEventListener
      Called prior to renaming a file / directory
      Specified by:
      moving 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
      Throws:
      IOException - If failed to handle the call
      See Also:
    • moved

      public void moved(org.apache.sshd.server.session.ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • removing

      public void removing(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory) throws IOException
      Description copied from interface: SftpEventListener
      Called prior to removing a file
      Specified by:
      removing in interface SftpEventListener
      Parameters:
      session - The ServerSession through which the request was handled
      path - The Path about to be removed
      isDirectory - Whether this is a folder or a file
      Throws:
      IOException - If failed to handle the call
      See Also:
    • removed

      public void removed(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • linking

      public void linking(org.apache.sshd.server.session.ServerSession session, Path source, Path target, boolean symLink) throws IOException
      Description copied from interface: SftpEventListener
      Called prior to creating a link
      Specified by:
      linking 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
      Throws:
      IOException - If failed to handle the call
      See Also:
    • linked

      public void linked(org.apache.sshd.server.session.ServerSession session, Path source, Path target, boolean symLink, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • modifyingAttributes

      public void modifyingAttributes(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs) throws IOException
      Description copied from interface: SftpEventListener
      Called prior to modifying the attributes of a file / directory
      Specified by:
      modifyingAttributes 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...
      Throws:
      IOException - If failed to handle the call
      See Also:
    • modifiedAttributes

      public void modifiedAttributes(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs, Throwable thrown) throws 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:
      IOException - If failed to handle the call
    • exiting

      public void exiting(org.apache.sshd.server.session.ServerSession session, Handle handle) throws IOException
      Description copied from interface: SftpEventListener
      Called when subsystem is exiting due to being destroyed
      Specified by:
      exiting in interface SftpEventListener
      Parameters:
      session - The associated ServerSession
      handle - The file / directory Handle being closed due to the exit
      Throws:
      IOException - If failed to handle the call