org.appng.core.model

## Interface PackageArchive

- All Known Implementing Classes:
    PackageArchiveImpl

      public interface PackageArchive

  An ApplicationArchive contains informations about a `Application` in a `Repository`. Those informations are obtained from the `Application`'s ZIP-file.
  Author:
    Matthias Herlitzius

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getBytes()` Returns the binary data of the archive's ZIP-file.
    `String` | `getChecksum()` Returns the checksum for this archive (SHA256).
    `File` | `getFile()` Returns the archive's ZIP-file.
    `PackageInfo` | `getPackageInfo()` Returns a `PackageInfo` unmarshalled from the archive's "application.xml".
    `PackageType` | `getType()` Returns the `PackageType` for this `PackageArchive`.
    `boolean` | `isValid()` Checks whether this is a valid `PackageArchive`, meaning it's ZIP-file has a valid structure and contains a valid "application.xml".
    `<T> T` | `processZipFile(ZipFileProcessor<T> processor)` Processes the `PackageArchive`'s ZIP-file with the given `ZipFileProcessor`.

- - ### Method Detail

    - #### isValid

          boolean isValid()

      Checks whether this is a valid `PackageArchive`, meaning it's ZIP-file has a valid structure and contains a valid "application.xml".
      Returns:
        `true` if this a valid `PackageArchive`, `false` otherwise

    - #### getPackageInfo

          PackageInfo getPackageInfo()

      Returns a `PackageInfo` unmarshalled from the archive's "application.xml". This methods returns `null`, if `isValid()` returns `false`.
      Returns:
        a `PackageInfo`

    - #### processZipFile

          <T> T processZipFile(ZipFileProcessor<T> processor)
                        throws IOException

      Processes the `PackageArchive`'s ZIP-file with the given `ZipFileProcessor`.
      Type Parameters:
        `T` - the return type of the `ZipFileProcessor`
      Parameters:
        `processor` - a `ZipFileProcessor`
      Returns:
        an object of type `<T>`
      Throws:
        `IOException` -
        - if `ZipFileProcessor.process(org.apache.commons.compress.archivers.zip.ZipFile)` throws an `IOException`
        - if the ZIP-file could not be read

    - #### getFile

          File getFile()

      Returns the archive's ZIP-file.
      Returns:
        the file

    - #### getBytes

          byte[] getBytes()
                   throws IOException

      Returns the binary data of the archive's ZIP-file. Should only be called if `isValid()` returns `true`.
      Returns:
        the binary data
      Throws:
        `IOException` - if the ZIP-file could not be read

    - #### getType

          PackageType getType()

      Returns the `PackageType` for this `PackageArchive`.
      Returns:
        the `PackageType`

    - #### getChecksum

          String getChecksum()

      Returns the checksum for this archive (SHA256).
      Returns:
        the checksum

Copyright © 2011–2023 aiticon GmbH. All rights reserved.