org.rhq.core.domain.content.composite
Class LoadedPackageBitsComposite

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

public class LoadedPackageBitsComposite
extends Object
implements Serializable

Composite object built by a query that indicates if a package version's contents (its "bits") is loaded/available and (if loaded) if the contents are stored in the database.

See Also:
PackageBits.QUERY_PACKAGE_BITS_LOADED_STATUS_PACKAGE_VERSION_ID, Serialized Form

Constructor Summary
LoadedPackageBitsComposite(int packageVersionId, String fileName, Integer packageBitsId, boolean isPackageBitsInDatabase)
           
LoadedPackageBitsComposite(int packageVersionId, String fileName, Number packageBitsId, Number isPackageBitsInDatabase)
          For use directly by JPQL NamedQueries.
 
Method Summary
 String getFileName()
          The name of the package version file.
 Integer getPackageBitsId()
          The ID of the PackageBits that this composite relates to.
 int getPackageVersionId()
          The ID of the PackageVersion that this composite relates to.
 boolean isPackageBitsAvailable()
          Returns true if the contents of the package version is loaded and available.
 boolean isPackageBitsInDatabase()
          Returns true if the contents of the package version are stored in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadedPackageBitsComposite

public LoadedPackageBitsComposite(int packageVersionId,
                                  String fileName,
                                  Integer packageBitsId,
                                  boolean isPackageBitsInDatabase)

LoadedPackageBitsComposite

public LoadedPackageBitsComposite(int packageVersionId,
                                  String fileName,
                                  Number packageBitsId,
                                  Number isPackageBitsInDatabase)
For use directly by JPQL NamedQueries.

Parameters:
packageVersionId - the ID of the PackageVersion this composite relates to
fileName - the name of the package version file
packageBitsId - the ID of the PackageBits this composite relates to - if null the package bits have not been downloaded yet
isPackageBitsInDatabase - considered true if not null and greater than 0
Method Detail

getPackageVersionId

public int getPackageVersionId()
The ID of the PackageVersion that this composite relates to. It is this package version whose contents is examined.

Returns:
package version ID

getFileName

public String getFileName()
The name of the package version file. Useful if the package bits are stored on the filesystem and you want to read in the bits.

Returns:
package version file name

getPackageBitsId

public Integer getPackageBitsId()
The ID of the PackageBits that this composite relates to. If this is null, then the package bits have not been downloaded and are not available.

Returns:
package bits ID, or null

isPackageBitsAvailable

public boolean isPackageBitsAvailable()
Returns true if the contents of the package version is loaded and available. If false is returned, then the contents are not stored anywhere and must be retrieved; usually by either a ContentSource or by uploading from an agent. If this returns false then you are guaranteed that isPackageBitsInDatabase() will return false.

If this returns true, you can call getPackageBitsId() to get the package bits ID.

Returns:
flag to indicate if the package bits are loaded/available

isPackageBitsInDatabase

public boolean isPackageBitsInDatabase()
Returns true if the contents of the package version are stored in the database. If this is true, then by definition, you are guaranteed that isPackageBitsAvailable() will return true. If this returns false, but isPackageBitsAvailable() returns true, then the package bits are available, they just are not stored in the database and to retrieve them you must use an appropriate mechanism based on where the bits are stored (usually cached on a local file system).

Returns:
flag to indicate if the package bits are stored in the database


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.