Interface ArchiveReadService

All Superinterfaces:
ArchiveService
All Known Implementing Classes:
CommonsCompressArchiveReadService, SevenZipArchiveService

public interface ArchiveReadService extends ArchiveService
Interface defining functionality associated with the reading of archives.
Author:
Aashutos Kakshepati
  • Field Details

  • Method Details

    • generateArchiveMetaData

      default ArchiveInfo generateArchiveMetaData(String archivePath)
      Extracts metadata from the archive specified and wraps it in an ArchiveInfo object. The default implementation does not parse the file and just returns the default archive setup with minimum configuration. The default archive has no guarantee of its compatibility with the underlying archive as it may have custom features enabled e.g. encryption.
      Parameters:
      archivePath -
      Returns:
      ArchiveInfo - POJO containing Archive Information parsed from the file metadata
    • listFiles

      List<FileInfo> listFiles(long sessionId, String archivePath)
      List contents of archive by archive path given. Hence, uses default archive info settings as per dictated by the archive service implementation.
      Parameters:
      sessionId - Unique identifier representing the session the ProgressMessage will display messages for
      archivePath -
      Returns:
      List<FileInfo> - List of normalised files and folders from the archive
    • listFiles

      List<FileInfo> listFiles(long sessionId, ArchiveInfo archiveInfo)
      List contents of archive by the archive info object given. It can contain properties that can handle specific file specifications such as encryption methodology and credentials.
      Parameters:
      sessionId - Unique identifier representing the session the ProgressMessage will display messages for
      archiveInfo -
      Returns:
      List<FileInfo> - List of normalised files and folders from the archive
    • extractFile

      boolean extractFile(long sessionId, Path targetLocation, String archivePath, FileInfo file)
      Extracts the specified file by the FileInfo object supplied from the archive.
      Parameters:
      sessionId - Unique identifier representing the session the ProgressMessage will display messages for
      targetLocation - Location to extract file to
      archivePath -
      file - The File metadata from the archive that is to be extracted
      Returns:
      boolean - returns true, if extraction was successful
    • extractFile

      boolean extractFile(long sessionId, Path targetLocation, ArchiveInfo archiveInfo, FileInfo file)
      Extracts the specified file by the FileInfo object supplied from the archive. The archive info object can provide archive-specific configuration e.g. decryption passwords.
      Parameters:
      sessionId - Unique identifier representing the session the ProgressMessage will display messages for
      targetLocation - Location to extract file to
      archiveInfo -
      file - The File metadata from the archive that is to be extracted
      Returns:
      boolean - returns true, if extraction was successful
    • testArchive

      boolean testArchive(long sessionId, String archivePath)
      Checks the integrity of the archive. It is assumed that the archive headers are unencrypted. Hence, archive path would suffice.
      Parameters:
      sessionId - Unique identifier representing the session the ProgressMessage will display messages for
      archivePath -
      Returns:
      boolean - returns true if the archive is valid
    • getOpenArchiveOptionsPane

      @Deprecated(forRemoval=true) default Optional<javafx.scene.Node> getOpenArchiveOptionsPane(ArchiveInfo archiveInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Given the archive information passed in, the implementation can use this method to determine whether a dialog needs to be presented to the user prior to opening the archive in order to provide suitable options and archive-specific configuration e.g. decryption passwords.
      Parameters:
      archiveInfo -
      Returns:
      Optional<Node> - The JavaFX Node representing the form to show prior to opening the archive or Empty if none is available.
    • supportedReadFormats

      @Deprecated(forRemoval=true) List<String> supportedReadFormats()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Lists out explicitly all archive formats that can be read by the implementation of the archive service.
      Returns:
      List<String> - List of unique archive formats supported