Class PackageId

  • All Implemented Interfaces:
    Comparable<PackageId>

    public class PackageId
    extends Object
    implements Comparable<PackageId>
    PackageId provides the basic metrics for identifying a package. A package id consists of a group id, a name and a version. the group is a relative path, eg: "company/project/subgroup", the name and the version can be of any format.
    • Field Detail

      • ETC_PACKAGES

        @Deprecated
        public static final String ETC_PACKAGES
        Deprecated.
        As of 3.1.42, the storage location is implementation details.
        The root path of the packages storage location.
        See Also:
        Constant Field Values
      • ETC_PACKAGES_PREFIX

        @Deprecated
        public static final String ETC_PACKAGES_PREFIX
        Deprecated.
        As of 3.1.42, the storage location is implementation details.
        The root path prefix of the packages storage location.
        See Also:
        Constant Field Values
      • EMPTY

        public static final PackageId[] EMPTY
    • Constructor Detail

      • PackageId

        @Deprecated
        public PackageId​(String path)
        Deprecated.
        As of 3.1.42, the storage location is implementation details.
        Creates a new package id
        Parameters:
        path - path of the package
      • PackageId

        @Deprecated
        public PackageId​(String path,
                         String version)
        Deprecated.
        As of 3.1.42, the storage location is implementation details.
        Creates a new package id
        Parameters:
        path - path of the package
        version - version of the package
      • PackageId

        @Deprecated
        public PackageId​(String path,
                         Version version)
        Deprecated.
        As of 3.1.42, the storage location is implementation details.
        Creates a new package id
        Parameters:
        path - path of the package
        version - version of the package
      • PackageId

        public PackageId​(String group,
                         String name,
                         String version)
        Creates a new package id
        Parameters:
        group - group id
        name - name
        version - version
      • PackageId

        public PackageId​(String group,
                         String name,
                         Version version)
        Creates a new package id
        Parameters:
        group - group id
        name - name
        version - version
    • Method Detail

      • fromString

        public static PackageId fromString​(String str)
        Returns a package id from a id string. if the given id is null or an empty string, null is returned.
        Parameters:
        str - the string
        Returns:
        the package id
      • fromString

        public static PackageId[] fromString​(String... str)
        Returns an array of package id from strings
        Parameters:
        str - the strings
        Returns:
        the array of package ids
      • toString

        public static String toString​(PackageId... packs)
        Creates a comma separated list of id strings.
        Parameters:
        packs - the ids
        Returns:
        the string
      • isFromPath

        @Deprecated
        public boolean isFromPath()
        Deprecated.
        As of 3.1.42, the storage location is implementation details.
        Checks if this definition was constructed from a path, rather from a group and name.
        Returns:
        true if constructed from path.
        Since:
        2.2.26
      • getInstallationPath

        @Deprecated
        public String getInstallationPath()
        Deprecated.
        As of 3.1.42, the storage location is implementation details.
        Returns the path of this package. please note that since 2.3 this also includes the version, but never the extension (.zip).
        Returns:
        the path of this package
        Since:
        2.2
      • getGroup

        public String getGroup()
        Returns the group id of this package
        Returns:
        the group id;
        Since:
        2.2
      • getName

        public String getName()
        Returns the name of this package which is the last segment of the path.
        Returns:
        the name of this package.
      • getVersionString

        public String getVersionString()
        Returns the version of this package or and empty string if n/a.
        Returns:
        the version of this package
        Since:
        2.0
      • getDownloadName

        public String getDownloadName()
        Returns a download name in the form name [ "-" version ] ".zip"
        Returns:
        the download name
        Since:
        2.0
      • getVersion

        public Version getVersion()
        Returns the version of this package or null if n/a.
        Returns:
        the version of this package
      • toString

        public String toString()
        Returns a string representation of this id
        Overrides:
        toString in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isValid

        public boolean isValid()
        Checks if this package id is valid in respect to JCR names.
        Returns:
        true if the names are valid
      • isValid

        public static boolean isValid​(String group,
                                      String name,
                                      String version)
        Checks if the package id is valid in respect to JCR names.
        Parameters:
        group - the package group name
        name - the package name
        version - the (optional) version
        Returns:
        true if the names are valid