org.appng.core.model

## Class RepositoryUtils

- java.lang.Object
- - org.appng.core.model.RepositoryUtils

-     public class RepositoryUtils
      extends Object

  Utility class offering methods that help dealing with `PackageVersion`s and `PackageInfo`rmations.
  Author:
    Matthias Herlitzius

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `SNAPSHOT` The "-SNAPSHOT"-suffix

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getContextPath()` Returns the JAXB context-path `org.appng.core.xml.repository`.
    `static Date` | `getDate(PackageInfo packageInfo)` Retrieves the `Date` from the given `PackageInfo` by parsing its timestamp
    `static PackageArchive` | `getPackage(Repository repo, File file, String archiveName)` Checks whether the given file is a valid `PackageArchive` and matches to `RepositoryMode` of the `Repository`.
    `static Comparator<PackageInfo>` | `getVersionComparator()`
    `static boolean` | `isNewer(PackageInfo packageA, PackageInfo packageB)` Checks whether `packageA` is newer than `packageB`.
    `static boolean` | `isNewer(PackageVersion versionA, PackageVersion versionB)` Checks whether `versionA` is newer than `versionB`
    `static boolean` | `isSnapshot(String name)` Check whether the given name represent a snapshot version

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### SNAPSHOT

          public static final String SNAPSHOT

      The "-SNAPSHOT"-suffix
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getContextPath

          public static String getContextPath()

      Returns the JAXB context-path `org.appng.core.xml.repository`.
      Returns:
        the context-path

    - #### isNewer

          public static boolean isNewer(PackageVersion versionA,
                                        PackageVersion versionB)

      Checks whether `versionA` is newer than `versionB`
      Parameters:
        `versionA` -
        `versionB` -
      Returns:
        `true` if `versionA` is newer than `versionB`, `false` otherwise
      See Also:
        `isNewer(PackageInfo, PackageInfo)`

    - #### isNewer

          public static boolean isNewer(PackageInfo packageA,
                                        PackageInfo packageB)

      Checks whether `packageA` is newer than `packageB`. Comparison is first done by the version and then by the timestamp of the `PackageInfo`.
      Parameters:
        `packageA` -
        `packageB` -
      Returns:
        `true` if `packageA` is newer than `packageB`, `false` otherwise
      See Also:
        `getDate(PackageInfo)`

    - #### getVersionComparator

          public static Comparator<PackageInfo> getVersionComparator()

    - #### getDate

          public static Date getDate(PackageInfo packageInfo)

      Retrieves the `Date` from the given `PackageInfo` by parsing its timestamp
      Parameters:
        `packageInfo` - the `PackageInfo`
      Returns:
        the date (never `null`, in case of a `ParseException`, the "zero-time" is used)

    - #### isSnapshot

          public static boolean isSnapshot(String name)

      Check whether the given name represent a snapshot version
      Parameters:
        `name` - the name
      Returns:
        `true` if the given name contains "-SNAPSHOT", `false` otherwise

    - #### getPackage

          public static PackageArchive getPackage(Repository repo,
                                                  File file,
                                                  String archiveName)

      Checks whether the given file is a valid `PackageArchive` and matches to `RepositoryMode` of the `Repository`.
      Parameters:
        `repo` - the `Repository`
        `file` - the file containing the archive
        `archiveName` - the name of the archive
      Returns:
        the `PackageArchive`, if the given file is a valid archive and matches the `RepositoryMode` of the `Repository`.

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