Class PackageId
- java.lang.Object
-
- org.apache.jackrabbit.vault.packaging.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 idPackageId(java.lang.String group, java.lang.String name, Version version)
Creates a new package idPackageId(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 stringsjava.lang.String
getDownloadName()
Returns a download name in the formname [ "-" version ] ".zip"
java.lang.String
getGroup()
Returns the group id of this packagejava.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 ornull
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 idstatic java.lang.String
toString(PackageId... packs)
Creates a comma separated list of id strings.
-
-
-
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 packageversion
- 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 packageversion
- 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 idname
- nameversion
- version
-
PackageId
public PackageId(java.lang.String group, java.lang.String name, Version version)
Creates a new package id- Parameters:
group
- group idname
- nameversion
- 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 formname [ "-" version ] ".zip"
- Returns:
- the download name
- Since:
- 2.0
-
getVersion
public Version getVersion()
Returns the version of this package ornull
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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(PackageId o)
Compares this id with the given one.- Specified by:
compareTo
in interfacejava.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 namename
- the package nameversion
- the (optional) version- Returns:
true
if the names are valid
-
-