Interface FileSystemExceptionFactory

  • All Known Implementing Classes:
    DefaultFileSystemExceptionFactory

    public interface FileSystemExceptionFactory
    A factory for creating FileSystemExceptions based on replies from an SFTP server.

    It's often not possible to distinguish different types of errors without inspecting the error message. This interface allows users to provide their own mapping, based on SftpExceptions.

    Author:
    Rob Spoor
    • Method Detail

      • createGetFileException

        FileSystemException createGetFileException​(String file,
                                                   SftpException exception)
        Creates a FileSystemException that indicates a file or directory cannot be retrieved.
        Parameters:
        file - A string identifying the file or directory.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createReadLinkException

        FileSystemException createReadLinkException​(String link,
                                                    SftpException exception)
        Creates a FileSystemException that indicates a symbolic link cannot be read.
        Parameters:
        link - A string identifying the symbolic link.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createListFilesException

        FileSystemException createListFilesException​(String directory,
                                                     SftpException exception)
        Creates a FileSystemException that indicates the contents of a directory cannot be retrieved.
        Parameters:
        directory - A string identifying the directory.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createChangeWorkingDirectoryException

        FileSystemException createChangeWorkingDirectoryException​(String directory,
                                                                  SftpException exception)
        Creates a FileSystemException that indicates a directory cannot be used as the current working directory.
        Parameters:
        directory - A string identifying the directory.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createCreateDirectoryException

        FileSystemException createCreateDirectoryException​(String directory,
                                                           SftpException exception)
        Creates a FileSystemException that indicates a directory cannot be created.
        Parameters:
        directory - A string identifying the directory.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createDeleteException

        FileSystemException createDeleteException​(String file,
                                                  SftpException exception,
                                                  boolean isDirectory)
        Creates a FileSystemException that indicates a file or directory cannot be deleted.
        Parameters:
        file - A string identifying the file or directory.
        exception - The SftpException that was thrown.
        isDirectory - true if a directory cannot be deleted, or false if a file cannot be deleted.
        Returns:
        The created FileSystemException.
      • createNewInputStreamException

        FileSystemException createNewInputStreamException​(String file,
                                                          SftpException exception)
        Creates a FileSystemException that indicates a file cannot be opened for reading.
        Parameters:
        file - A string identifying the file.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createNewOutputStreamException

        FileSystemException createNewOutputStreamException​(String file,
                                                           SftpException exception,
                                                           Collection<? extends OpenOption> options)
        Creates a FileSystemException that indicates a file cannot be opened for writing.
        Parameters:
        file - A string identifying the file.
        exception - The SftpException that was thrown.
        options - The open options used to open the file.
        Returns:
        The created FileSystemException.
      • createCopyException

        FileSystemException createCopyException​(String file,
                                                String other,
                                                SftpException exception)
        Creates a FileSystemException that indicates a file or directory cannot be copied.
        Parameters:
        file - A string identifying the file or directory to be copied.
        other - A string identifying the file or directory to be copied to.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createMoveException

        FileSystemException createMoveException​(String file,
                                                String other,
                                                SftpException exception)
        Creates a FileSystemException that indicates a file or directory cannot be moved.
        Parameters:
        file - A string identifying the file or directory to be moved.
        other - A string identifying the file or directory to be moved to.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createSetOwnerException

        FileSystemException createSetOwnerException​(String file,
                                                    SftpException exception)
        Creates a FileSystemException that indicates the owner of a file or directory cannot be set.
        Parameters:
        file - A string identifying the file or directory to set the owner of.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createSetGroupException

        FileSystemException createSetGroupException​(String file,
                                                    SftpException exception)
        Creates a FileSystemException that indicates the group of a file or directory cannot be set.
        Parameters:
        file - A string identifying the file or directory to set the group of.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createSetPermissionsException

        FileSystemException createSetPermissionsException​(String file,
                                                          SftpException exception)
        Creates a FileSystemException that indicates the permissions of a file or directory cannot be set.
        Parameters:
        file - A string identifying the file or directory to set the permissions of.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.
      • createSetModificationTimeException

        FileSystemException createSetModificationTimeException​(String file,
                                                               SftpException exception)
        Creates a FileSystemException that indicates the modification time of a file or directory cannot be set.
        Parameters:
        file - A string identifying the file or directory to set the modification time of.
        exception - The SftpException that was thrown.
        Returns:
        The created FileSystemException.