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

Field Summary
static String DELETE_IF_NO_CONTENT_SOURCES_OR_CHANNELS
           
static String DELETE_PVPV_IF_NO_CONTENT_SOURCES_OR_CHANNELS
           
static String FIND_EXTRA_PROPS_IF_NO_CONTENT_SOURCES_OR_CHANNELS
           
static String FIND_FILES_IF_NO_CONTENT_SOURCES_OR_CHANNELS
           
static String QUERY_FIND_BY_CHANNEL_ID
           
static String QUERY_FIND_BY_CHANNEL_ID_FILTERED
           
static String QUERY_FIND_BY_CHANNEL_ID_WITH_PACKAGE
           
static String QUERY_FIND_BY_CHANNEL_ID_WITH_PACKAGE_FILTERED
           
static String QUERY_FIND_BY_ID
           
static String QUERY_FIND_BY_ID_IF_NO_CONTENT_SOURCES_OR_CHANNELS
           
static String QUERY_FIND_BY_PACKAGE_DETAILS_KEY
           
static String QUERY_FIND_BY_PACKAGE_ID
           
static String QUERY_FIND_BY_PACKAGE_VER_ARCH
           
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_ID_BY_PACKAGE_DETAILS_KEY_AND_RES_ID
           
static String QUERY_FIND_METADATA_BY_RESOURCE_ID
           
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
 ChannelPackageVersion addChannel(Channel channel)
          Directly assign this package version to the given channel.
 ProductVersionPackageVersion addProductVersion(ProductVersion productVersion)
          Directly assign a product version to this package version.
 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.
 Set<ChannelPackageVersion> getChannelPackageVersions()
          Returns the explicit mapping entities.
 Set<Channel> getChannels()
          The set of channels that can serve up this package version.
 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.
 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()
           
 ChannelPackageVersion removeChannel(Channel channel)
          Removes the channel as one that this package version is related to.
 ProductVersionPackageVersion removeProductVersion(ProductVersion productVersion)
          Removes the product version from this package version, if it exists.
 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_VER_ARCH

public static final String QUERY_FIND_BY_PACKAGE_VER_ARCH
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_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_CHANNEL_ID

public static final String QUERY_FIND_BY_CHANNEL_ID
See Also:
Constant Field Values

QUERY_FIND_BY_CHANNEL_ID_FILTERED

public static final String QUERY_FIND_BY_CHANNEL_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_CHANNEL_ID_WITH_PACKAGE

public static final String QUERY_FIND_BY_CHANNEL_ID_WITH_PACKAGE
See Also:
Constant Field Values

QUERY_FIND_BY_CHANNEL_ID_WITH_PACKAGE_FILTERED

public static final String QUERY_FIND_BY_CHANNEL_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_CHANNELS

public static final String QUERY_FIND_BY_ID_IF_NO_CONTENT_SOURCES_OR_CHANNELS
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_CHANNELS

public static final String DELETE_IF_NO_CONTENT_SOURCES_OR_CHANNELS
See Also:
Constant Field Values

DELETE_PVPV_IF_NO_CONTENT_SOURCES_OR_CHANNELS

public static final String DELETE_PVPV_IF_NO_CONTENT_SOURCES_OR_CHANNELS
See Also:
Constant Field Values

FIND_EXTRA_PROPS_IF_NO_CONTENT_SOURCES_OR_CHANNELS

public static final String FIND_EXTRA_PROPS_IF_NO_CONTENT_SOURCES_OR_CHANNELS
See Also:
Constant Field Values

FIND_FILES_IF_NO_CONTENT_SOURCES_OR_CHANNELS

public static final String FIND_FILES_IF_NO_CONTENT_SOURCES_OR_CHANNELS
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
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)

getChannelPackageVersions

public Set<ChannelPackageVersion> getChannelPackageVersions()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getChannels()

getChannels

public Set<Channel> getChannels()
The set of channels 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 channels, use getChannelPackageVersions() or addChannel(Channel), removeChannel(Channel).


addChannel

public ChannelPackageVersion addChannel(Channel channel)
Directly assign this package version to the given channel.

Parameters:
packageVersion -
Returns:
the mapping that was added

getInstalledPackages

public Set<InstalledPackage> getInstalledPackages()

getInstalledPackageHistory

public Set<InstalledPackageHistory> getInstalledPackageHistory()

removeChannel

public ChannelPackageVersion removeChannel(Channel channel)
Removes the channel 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 channel, null is returned.

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

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-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.