Class PackageId
- java.lang.Object
-
- org.apache.jackrabbit.vault.packaging.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, a name and an optional version. The group is a relative path, eg: "company/project/subgroup", the name and the version can be of any format.The string representation is
<group>:<name>[:<version>]
.
-
-
Field Summary
Fields Modifier and Type Field Description static PackageId[]
EMPTY
static String
ETC_PACKAGES
Deprecated.As of 3.1.42, the storage location is implementation details.static String
ETC_PACKAGES_PREFIX
Deprecated.As of 3.1.42, the storage location is implementation details.
-
Constructor Summary
Constructors Constructor Description PackageId(String path)
Deprecated.As of 3.1.42, the storage location is implementation details.PackageId(String path, String version)
Deprecated.As of 3.1.42, the storage location is implementation details.PackageId(String group, String name, String version)
Creates a new package idPackageId(String group, String name, Version version)
Creates a new package idPackageId(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(Object o)
static PackageId
fromString(String str)
Returns a package id from an id string in the format<group>:<name>[:<version>]
.static PackageId[]
fromString(String... str)
Returns an array of package id from strings.String
getDownloadName()
Returns a download name in the formname [ "-" version ] ".zip"
String
getGroup()
Returns the group of this packageString
getInstallationPath()
Deprecated.As of 3.1.42, the storage location is implementation details.@NotNull String
getName()
Returns the name of this package (usually this is the last segment of the path).@NotNull Version
getVersion()
Returns the version of this package orVersion.EMPTY
if not set.@NotNull 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(String group, String name, String version)
Checks if the package id is valid in respect to JCR names.String
toString()
Returns a string representation of this id in the format<group>:<name>[:<version>]
.static String
toString(PackageId... packs)
Creates a comma separated list of id strings in the format<group>:<name>[:<version>]
.
-
-
-
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 packageversion
- 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 packageversion
- version of the package
-
PackageId
public PackageId(String group, String name, String version)
Creates a new package id- Parameters:
group
- group idname
- nameversion
- version
-
-
Method Detail
-
fromString
public static PackageId fromString(String str)
Returns a package id from an id string in the format<group>:<name>[:<version>]
. 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
- See Also:
fromString(String)
-
toString
public static String toString(PackageId... packs)
Creates a comma separated list of id strings in the format<group>:<name>[:<version>]
.- 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 of this package- Returns:
- the group.
- Since:
- 2.2
-
getName
@NotNull public @NotNull String getName()
Returns the name of this package (usually this is the last segment of the path).- Returns:
- the name of this package.
-
getVersionString
@NotNull public @NotNull 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 formname [ "-" version ] ".zip"
- Returns:
- the download name
- Since:
- 2.0
-
getVersion
@NotNull public @NotNull Version getVersion()
Returns the version of this package orVersion.EMPTY
if not set.- Returns:
- the version of this package
-
toString
public String toString()
Returns a string representation of this id in the format<group>:<name>[:<version>]
.
-
compareTo
public int compareTo(PackageId o)
Compares this id with the given one.- Specified by:
compareTo
in interfaceComparable<PackageId>
-
isValid
public boolean isValid()
Checks if this package id is valid in respect to JCR names.- Returns:
true
if the names are valid
-
-