Class PackageId

  • All Implemented Interfaces:
    java.lang.Comparable<PackageId>

    public class PackageId
    extends java.lang.Object
    implements java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      static PackageId[] EMPTY  
      static java.lang.String ETC_PACKAGES
      Deprecated.
      As of 3.1.42, the storage location is implementation details.
      static java.lang.String ETC_PACKAGES_PREFIX
      Deprecated.
      As of 3.1.42, the storage location is implementation details.
    • Constructor Summary

      Constructors 
      Constructor Description
      PackageId​(java.lang.String path)
      Deprecated.
      As of 3.1.42, the storage location is implementation details.
      PackageId​(java.lang.String path, java.lang.String version)
      Deprecated.
      As of 3.1.42, the storage location is implementation details.
      PackageId​(java.lang.String group, java.lang.String name, java.lang.String version)
      Creates a new package id
      PackageId​(java.lang.String group, java.lang.String name, Version version)
      Creates a new package id
      PackageId​(java.lang.String path, Version version)
      Deprecated.
      As of 3.1.42, the storage location is implementation details.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      int compareTo​(PackageId o)
      Compares this id with the given one.
      boolean equals​(java.lang.Object o)  
      static PackageId fromString​(java.lang.String str)
      Returns a package id from a id string.
      static PackageId[] fromString​(java.lang.String... str)
      Returns an array of package id from strings
      java.lang.String getDownloadName()
      Returns a download name in the form name [ "-" version ] ".zip"
      java.lang.String getGroup()
      Returns the group id of this package
      java.lang.String getInstallationPath()
      Deprecated.
      As of 3.1.42, the storage location is implementation details.
      java.lang.String getName()
      Returns the name of this package which is the last segment of the path.
      Version getVersion()
      Returns the version of this package or null if n/a.
      java.lang.String getVersionString()
      Returns the version of this package or and empty string if n/a.
      int hashCode()  
      boolean isFromPath()
      Deprecated.
      As of 3.1.42, the storage location is implementation details.
      boolean isValid()
      Checks if this package id is valid in respect to JCR names.
      static boolean isValid​(java.lang.String group, java.lang.String name, java.lang.String version)
      Checks if the package id is valid in respect to JCR names.
      java.lang.String toString()
      Returns a string representation of this id
      static java.lang.String toString​(PackageId... packs)
      Creates a comma separated list of id strings.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ETC_PACKAGES

        @Deprecated
        public static final java.lang.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 java.lang.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​(java.lang.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​(java.lang.String path,
                         java.lang.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​(java.lang.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​(java.lang.String group,
                         java.lang.String name,
                         java.lang.String version)
        Creates a new package id
        Parameters:
        group - group id
        name - name
        version - version
      • PackageId

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

      • fromString

        public static PackageId fromString​(java.lang.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​(java.lang.String... str)
        Returns an array of package id from strings
        Parameters:
        str - the strings
        Returns:
        the array of package ids
      • toString

        public static java.lang.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 java.lang.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 java.lang.String getGroup()
        Returns the group id of this package
        Returns:
        the group id;
        Since:
        2.2
      • getName

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

        public java.lang.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 java.lang.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 java.lang.String toString()
        Returns a string representation of this id
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(PackageId o)
        Compares this id with the given one.
        Specified by:
        compareTo in interface java.lang.Comparable<PackageId>
      • 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​(java.lang.String group,
                                      java.lang.String name,
                                      java.lang.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