org.rhq.core.domain.content
Class PackageVersion

java.lang.Object
  extended by org.rhq.core.domain.content.PackageVersion
All Implemented Interfaces:
Serializable

public class PackageVersion
extends Object
implements Serializable

Represents a specific version of a Package. This does not represent an installed package found deployed in any platform or on a resource (that's InstalledPackage). This object refers to a known version of a particular package that can be installed on applicable resources.

See Also:
Serialized Form

Nested Class Summary
static class PackageVersion.DefaultPackageVersionComparator
          This is a default Comparator implementation for package versions.
 
Field Summary
static PackageVersion.DefaultPackageVersionComparator DEFAULT_COMPARATOR
           
static String DELETE_IF_NO_CONTENT_SOURCES_OR_REPOS
           
static String DELETE_MULTIPLE_IF_NO_CONTENT_SOURCES_OR_REPOS
           
static String DELETE_PVPV_IF_NO_CONTENT_SOURCES_OR_REPOS
           
static String DELETE_SINGLE_IF_NO_CONTENT_SOURCES_OR_REPOS
           
static String FIND_EXTRA_PROPS_IF_NO_CONTENT_SOURCES_OR_REPOS
           
static String FIND_FILES_IF_NO_CONTENT_SOURCES_OR_REPOS
           
static String QUERY_FIND_BY_ID
           
static String QUERY_FIND_BY_ID_IF_NO_CONTENT_SOURCES_OR_REPOS
           
static String QUERY_FIND_BY_PACKAGE_AND_REPO_ID
           
static String QUERY_FIND_BY_PACKAGE_DETAILS
           
static String QUERY_FIND_BY_PACKAGE_DETAILS_KEY
           
static String QUERY_FIND_BY_PACKAGE_DETAILS_KEY_WITH_NON_NULL_RESOURCE_TYPE
           
static String QUERY_FIND_BY_PACKAGE_DETAILS_SHA
           
static String QUERY_FIND_BY_PACKAGE_ID
           
static String QUERY_FIND_BY_PACKAGE_SHA
           
static String QUERY_FIND_BY_PACKAGE_SHA_RES_TYPE
           
static String QUERY_FIND_BY_PACKAGE_VER_ARCH
           
static String QUERY_FIND_BY_REPO_ID
           
static String QUERY_FIND_BY_REPO_ID_FILTERED
           
static String QUERY_FIND_BY_REPO_ID_WITH_PACKAGE
           
static String QUERY_FIND_BY_REPO_ID_WITH_PACKAGE_FILTERED
           
static String QUERY_FIND_COMPOSITE_BY_FILTERS
           
static String QUERY_FIND_COMPOSITE_BY_ID
           
static String QUERY_FIND_COMPOSITE_BY_ID_WITH_PROPS
           
static String QUERY_FIND_COMPOSITES_BY_IDS
           
static String QUERY_FIND_DELETEABLE_IDS_IN_REPO
           
static String QUERY_FIND_ID_BY_PACKAGE_DETAILS_KEY_AND_RES_ID
           
static String QUERY_FIND_METADATA_BY_RESOURCE_ID
           
static String QUERY_FIND_PACKAGE_BY_FILENAME
           
static String QUERY_FIND_PACKAGEVERSION_BY_FILENAME
           
static String QUERY_GET_PKG_BITS_LENGTH_BY_PKG_DETAILS_AND_RES_ID
           
 
Constructor Summary
PackageVersion()
           
PackageVersion(Package pkg, String version, Architecture arch)
           
 
Method Summary
 ProductVersionPackageVersion addProductVersion(ProductVersion productVersion)
          Directly assign a product version to this package version.
 RepoPackageVersion addRepo(Repo repo)
          Directly assign this package version to the given repo.
 boolean equals(Object o)
           
 Architecture getArchitecture()
          Architecture of this package version which tells you the kinds of platforms (e.g. operating system or hardware) that this package version can be installed on.
 String getDisplayName()
          Name of this package version that is suitable for display to the user in the UI.
 String getDisplayVersion()
          A version string suitable for displaying to a user.
 Configuration getExtraProperties()
          Values to further describe this package version.
 Long getFileCreatedDate()
          Timestamp indicating when the package's file was created.
 String getFileName()
          Name of the file with the contents of this package.
 Long getFileSize()
          Size of the package's file.
 Package getGeneralPackage()
          Package that this version applies to.
 int getId()
           
 Set<InstalledPackageHistory> getInstalledPackageHistory()
           
 Set<InstalledPackage> getInstalledPackages()
           
 String getLicenseName()
          Name of the license under which the package falls.
 String getLicenseVersion()
          Version of the package's license.
 String getLongDescription()
          Long free text description of this version of the package.
 String getMD5()
          The MD5 hash of this package version's file contents.
 byte[] getMetadata()
          Optional blob of metadata that is only meaningful to the plugin that is responsible for installing this package version.
 PackageBits getPackageBits()
          If this package version's actual contents (its "bits") have been inventoried, this will return a PackageBits object representing that data.
 Set<ProductVersionPackageVersion> getProductVersionPackageVersions()
          Returns the explicit mapping entities.
 Set<ProductVersion> getProductVersions()
          The product versions that this package version is associated with.
 Set<RepoPackageVersion> getRepoPackageVersions()
          Returns the explicit mapping entities.
 Set<Repo> getRepos()
          The set of repos that can serve up this package version.
 String getSHA256()
          The SHA-256 hash of this package version's file contents.
 String getShortDescription()
          Short free text description of this version of the package.
 String getVersion()
          The machine understandable version of the package.
 int hashCode()
           
 ProductVersionPackageVersion removeProductVersion(ProductVersion productVersion)
          Removes the product version from this package version, if it exists.
 RepoPackageVersion removeRepo(Repo repo)
          Removes the repo as one that this package version is related to.
 void setArchitecture(Architecture architecture)
           
 void setDisplayName(String displayName)
           
 void setDisplayVersion(String displayVersion)
           
 void setExtraProperties(Configuration extraProperties)
           
 void setFileCreatedDate(Long fileCreatedDate)
           
 void setFileName(String fileName)
           
 void setFileSize(Long fileSize)
           
 void setGeneralPackage(Package generalPackage)
           
 void setId(int id)
           
 void setLicenseName(String licenseName)
           
 void setLicenseVersion(String licenseVersion)
           
 void setLongDescription(String longDescription)
           
 void setMD5(String md5)
           
 void setMetadata(byte[] metadata)
           
 void setPackageBits(PackageBits packageBits)
           
 void setSHA256(String sha256)
           
 void setShortDescription(String shortDescription)
           
 void setVersion(String version)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_FIND_BY_PACKAGE_DETAILS

public static final String QUERY_FIND_BY_PACKAGE_DETAILS
See Also:
Constant Field Values

QUERY_FIND_BY_PACKAGE_VER_ARCH

public static final String QUERY_FIND_BY_PACKAGE_VER_ARCH
See Also:
Constant Field Values

QUERY_FIND_BY_PACKAGE_SHA

public static final String QUERY_FIND_BY_PACKAGE_SHA
See Also:
Constant Field Values

QUERY_FIND_BY_PACKAGE_SHA_RES_TYPE

public static final String QUERY_FIND_BY_PACKAGE_SHA_RES_TYPE
See Also:
Constant Field Values

QUERY_FIND_BY_PACKAGE_DETAILS_KEY_WITH_NON_NULL_RESOURCE_TYPE

public static final String QUERY_FIND_BY_PACKAGE_DETAILS_KEY_WITH_NON_NULL_RESOURCE_TYPE
See Also:
Constant Field Values

QUERY_FIND_BY_PACKAGE_DETAILS_KEY

public static final String QUERY_FIND_BY_PACKAGE_DETAILS_KEY
See Also:
Constant Field Values

QUERY_FIND_BY_PACKAGE_DETAILS_SHA

public static final String QUERY_FIND_BY_PACKAGE_DETAILS_SHA
See Also:
Constant Field Values

QUERY_FIND_ID_BY_PACKAGE_DETAILS_KEY_AND_RES_ID

public static final String QUERY_FIND_ID_BY_PACKAGE_DETAILS_KEY_AND_RES_ID
See Also:
Constant Field Values

QUERY_FIND_BY_REPO_ID

public static final String QUERY_FIND_BY_REPO_ID
See Also:
Constant Field Values

QUERY_FIND_BY_REPO_ID_FILTERED

public static final String QUERY_FIND_BY_REPO_ID_FILTERED
See Also:
Constant Field Values

QUERY_FIND_BY_PACKAGE_ID

public static final String QUERY_FIND_BY_PACKAGE_ID
See Also:
Constant Field Values

QUERY_FIND_BY_PACKAGE_AND_REPO_ID

public static final String QUERY_FIND_BY_PACKAGE_AND_REPO_ID
See Also:
Constant Field Values

QUERY_FIND_BY_REPO_ID_WITH_PACKAGE

public static final String QUERY_FIND_BY_REPO_ID_WITH_PACKAGE
See Also:
Constant Field Values

QUERY_FIND_BY_REPO_ID_WITH_PACKAGE_FILTERED

public static final String QUERY_FIND_BY_REPO_ID_WITH_PACKAGE_FILTERED
See Also:
Constant Field Values

QUERY_FIND_METADATA_BY_RESOURCE_ID

public static final String QUERY_FIND_METADATA_BY_RESOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_BY_ID_IF_NO_CONTENT_SOURCES_OR_REPOS

public static final String QUERY_FIND_BY_ID_IF_NO_CONTENT_SOURCES_OR_REPOS
See Also:
Constant Field Values

QUERY_GET_PKG_BITS_LENGTH_BY_PKG_DETAILS_AND_RES_ID

public static final String QUERY_GET_PKG_BITS_LENGTH_BY_PKG_DETAILS_AND_RES_ID
See Also:
Constant Field Values

DELETE_IF_NO_CONTENT_SOURCES_OR_REPOS

public static final String DELETE_IF_NO_CONTENT_SOURCES_OR_REPOS
See Also:
Constant Field Values

DELETE_SINGLE_IF_NO_CONTENT_SOURCES_OR_REPOS

public static final String DELETE_SINGLE_IF_NO_CONTENT_SOURCES_OR_REPOS
See Also:
Constant Field Values

DELETE_MULTIPLE_IF_NO_CONTENT_SOURCES_OR_REPOS

public static final String DELETE_MULTIPLE_IF_NO_CONTENT_SOURCES_OR_REPOS
See Also:
Constant Field Values

DELETE_PVPV_IF_NO_CONTENT_SOURCES_OR_REPOS

public static final String DELETE_PVPV_IF_NO_CONTENT_SOURCES_OR_REPOS
See Also:
Constant Field Values

FIND_EXTRA_PROPS_IF_NO_CONTENT_SOURCES_OR_REPOS

public static final String FIND_EXTRA_PROPS_IF_NO_CONTENT_SOURCES_OR_REPOS
See Also:
Constant Field Values

FIND_FILES_IF_NO_CONTENT_SOURCES_OR_REPOS

public static final String FIND_FILES_IF_NO_CONTENT_SOURCES_OR_REPOS
See Also:
Constant Field Values

QUERY_FIND_COMPOSITE_BY_ID

public static final String QUERY_FIND_COMPOSITE_BY_ID
See Also:
Constant Field Values

QUERY_FIND_COMPOSITE_BY_ID_WITH_PROPS

public static final String QUERY_FIND_COMPOSITE_BY_ID_WITH_PROPS
See Also:
Constant Field Values

QUERY_FIND_COMPOSITES_BY_IDS

public static final String QUERY_FIND_COMPOSITES_BY_IDS
See Also:
Constant Field Values

QUERY_FIND_COMPOSITE_BY_FILTERS

public static final String QUERY_FIND_COMPOSITE_BY_FILTERS
See Also:
Constant Field Values

QUERY_FIND_BY_ID

public static final String QUERY_FIND_BY_ID
See Also:
Constant Field Values

QUERY_FIND_PACKAGE_BY_FILENAME

public static final String QUERY_FIND_PACKAGE_BY_FILENAME
See Also:
Constant Field Values

QUERY_FIND_PACKAGEVERSION_BY_FILENAME

public static final String QUERY_FIND_PACKAGEVERSION_BY_FILENAME
See Also:
Constant Field Values

QUERY_FIND_DELETEABLE_IDS_IN_REPO

public static final String QUERY_FIND_DELETEABLE_IDS_IN_REPO
See Also:
Constant Field Values

DEFAULT_COMPARATOR

public static final PackageVersion.DefaultPackageVersionComparator DEFAULT_COMPARATOR
See Also:
PackageVersion.DefaultPackageVersionComparator
Constructor Detail

PackageVersion

public PackageVersion()

PackageVersion

public PackageVersion(Package pkg,
                      String version,
                      Architecture arch)
Method Detail

getId

public int getId()

setId

public void setId(int id)

getGeneralPackage

public Package getGeneralPackage()
Package that this version applies to.


setGeneralPackage

public void setGeneralPackage(Package generalPackage)

getDisplayName

public String getDisplayName()
Name of this package version that is suitable for display to the user in the UI.


setDisplayName

public void setDisplayName(String displayName)

getShortDescription

public String getShortDescription()
Short free text description of this version of the package. In other words, a summary of the package.


setShortDescription

public void setShortDescription(String shortDescription)

getLongDescription

public String getLongDescription()
Long free text description of this version of the package.


setLongDescription

public void setLongDescription(String longDescription)

getVersion

public String getVersion()
The machine understandable version of the package. The format of this attribute will vary based on the package. It should be possible by simply sorting package versions on this column to determine which package version is newer or older than another. Anyone that creates package versions must be able to generate valid version strings that support those semantics.


setVersion

public void setVersion(String version)

getDisplayVersion

public String getDisplayVersion()
A version string suitable for displaying to a user. It may or may not be the same as {#getVersion()}.


setDisplayVersion

public void setDisplayVersion(String displayVersion)

getArchitecture

public Architecture getArchitecture()
Architecture of this package version which tells you the kinds of platforms (e.g. operating system or hardware) that this package version can be installed on.


setArchitecture

public void setArchitecture(Architecture architecture)

getFileName

public String getFileName()
Name of the file with the contents of this package.


setFileName

public void setFileName(String fileName)

getFileSize

public Long getFileSize()
Size of the package's file.


setFileSize

public void setFileSize(Long fileSize)

getMD5

public String getMD5()
The MD5 hash of this package version's file contents.


setMD5

public void setMD5(String md5)

getSHA256

public String getSHA256()
The SHA-256 hash of this package version's file contents.


setSHA256

public void setSHA256(String sha256)

getFileCreatedDate

public Long getFileCreatedDate()
Timestamp indicating when the package's file was created.


setFileCreatedDate

public void setFileCreatedDate(Long fileCreatedDate)

getLicenseName

public String getLicenseName()
Name of the license under which the package falls.

See Also:
getLicenseVersion()

setLicenseName

public void setLicenseName(String licenseName)

getLicenseVersion

public String getLicenseVersion()
Version of the package's license.


setLicenseVersion

public void setLicenseVersion(String licenseVersion)

getMetadata

public byte[] getMetadata()
Optional blob of metadata that is only meaningful to the plugin that is responsible for installing this package version. This may be null if this package version has no applicable metadata for it. Typical usages of this is to provide instructional information describing the install steps the plugin needs to perform to install the package; or yum XML information on rpms.


setMetadata

public void setMetadata(byte[] metadata)

getExtraProperties

public Configuration getExtraProperties()
Values to further describe this package version. Values in this object will adhere to the configuration defined by the associated package type as found in this object's package.

See Also:
PackageType.getPackageExtraPropertiesDefinition()

setExtraProperties

public void setExtraProperties(Configuration extraProperties)

getRepoPackageVersions

public Set<RepoPackageVersion> getRepoPackageVersions()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getRepos()

getRepos

public Set<Repo> getRepos()
The set of repos that can serve up this package version.

The returned set is not backed by this entity - if you want to alter the set of associated repos, use getRepoPackageVersions() or addRepo(Repo), removeRepo(Repo).


addRepo

public RepoPackageVersion addRepo(Repo repo)
Directly assign this package version to the given repo.

Parameters:
packageVersion -
Returns:
the mapping that was added

getInstalledPackages

public Set<InstalledPackage> getInstalledPackages()

getInstalledPackageHistory

public Set<InstalledPackageHistory> getInstalledPackageHistory()

removeRepo

public RepoPackageVersion removeRepo(Repo repo)
Removes the repo as one that this package version is related to. The mapping that was removed is returned; if the given package version was not a member of the repo, null is returned.

Parameters:
repo -
Returns:
the mapping that was removed or null if this package version was not mapped to the given repo

getPackageBits

public PackageBits getPackageBits()
If this package version's actual contents (its "bits") have been inventoried, this will return a PackageBits object representing that data. If there is no content available yet, this will return null. When null is returned, it means it has to be pulled down, usually via a ContentSource. WARNING! You most likely do not want to call this method if inside the scope of an entity manager session. If you do, this will load in the PackageBits object which potentially will load the entire package's contents in memory (and thus, if large enough, will cause an OutOfMemoryError).


setPackageBits

public void setPackageBits(PackageBits packageBits)

getProductVersionPackageVersions

public Set<ProductVersionPackageVersion> getProductVersionPackageVersions()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
#getPackageVersions()

getProductVersions

public Set<ProductVersion> getProductVersions()
The product versions that this package version is associated with.

The returned set is not backed by this entity - if you want to alter the set of associated product versions, use getProductVersionPackageVersions() or addProductVersion(ProductVersion), removeProductVersion(ProductVersion).


addProductVersion

public ProductVersionPackageVersion addProductVersion(ProductVersion productVersion)
Directly assign a product version to this package version.

Parameters:
productVersion -
Returns:
the mapping that was added

removeProductVersion

public ProductVersionPackageVersion removeProductVersion(ProductVersion productVersion)
Removes the product version from this package version, if it exists. If it does exist, the mapping that was removed is returned; if the given product version did not exist as one that is a member of this package version, null is returned.

Parameters:
productVersion - the product version to remove
Returns:
the mapping that was removed or null if the product version was not mapped to this package version

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.