org.rhq.core.clientapi.server.content
Interface ContentServerService


public interface ContentServerService

Server-side interface for interacting with the server's content subsystem.


Field Summary
static String CONCURRENCY_LIMIT_CONTENT_DOWNLOAD
          Concurrency control setting to limit the number of packages that can be downloaded.
static String CONCURRENCY_LIMIT_CONTENT_REPORT
          Concurrency control parameter to limit the number of content reports that are handled.
 
Method Summary
 void completeDeletePackageRequest(RemovePackagesResponse response)
          Informs the server that a previous request to delete a package has completed.
 void completeDeployPackageRequest(DeployPackagesResponse response)
          Informs the server that a previous request to deploy a package has completed.
 void completeRetrievePackageBitsRequest(ContentServiceResponse response, InputStream contentStream)
          Informs the server that a previous request to get a package's bits has completed.
 long downloadPackageBitsForChildResource(int parentResourceId, String resourceTypeName, PackageDetailsKey packageDetailsKey, OutputStream outputStream)
          Downloads the package bits used to create a package used as the backing of a resource.
 long downloadPackageBitsGivenResource(int resourceId, PackageDetailsKey packageDetailsKey, OutputStream outputStream)
          Requests that the server download and stream the bits for the specified package.
 long downloadPackageBitsRangeGivenResource(int resourceId, PackageDetailsKey packageDetailsKey, OutputStream outputStream, long startByte, long endByte)
          Requests that the server download and stream the bits for the specified package.
 long getPackageBitsLength(int resourceId, PackageDetailsKey packageDetailsKey)
          Requests the size, in bytes, of the identified package version.
 PageList<PackageVersionMetadataComposite> getPackageVersionMetadata(int resourceId, PageControl pc)
          Requests all metadata for all package versions that the given resource component is subscribed to (see Repo.getResources().
 String getResourceSubscriptionMD5(int resourceId)
          Gets the MD5 hash of the resource's "content subscription".
 Set<ResourcePackageDetails> loadDependencies(int requestId, Set<PackageDetailsKey> dependencyPackages)
          Informs the server that a package installation (as indicated in the specified request ID) requires dependency packages to be installed.
 void mergeDiscoveredPackages(ContentDiscoveryReport report)
          Sends a set of newly discovered packages to the server.
 

Field Detail

CONCURRENCY_LIMIT_CONTENT_REPORT

static final String CONCURRENCY_LIMIT_CONTENT_REPORT
Concurrency control parameter to limit the number of content reports that are handled.

See Also:
Constant Field Values

CONCURRENCY_LIMIT_CONTENT_DOWNLOAD

static final String CONCURRENCY_LIMIT_CONTENT_DOWNLOAD
Concurrency control setting to limit the number of packages that can be downloaded.

See Also:
Constant Field Values
Method Detail

mergeDiscoveredPackages

@Asynchronous(guaranteedDelivery=true)
@LimitedConcurrency(value="rhq.server.concurrency-limit.content-report")
void mergeDiscoveredPackages(ContentDiscoveryReport report)
Sends a set of newly discovered packages to the server. The collection of packages represents the current set of packages deployed on the specified resource. As such, entries may be either new packages or packages that have been returned from a previous discovery. Any packages that were known for the resource that are not in this collection of package are considered deleted from the resource.

Parameters:
report - report containing the current set of packages installed on the resource.

completeDeployPackageRequest

@Asynchronous(guaranteedDelivery=true)
void completeDeployPackageRequest(DeployPackagesResponse response)
Informs the server that a previous request to deploy a package has completed.

Parameters:
response - indicates the original request and the result of executing it

completeDeletePackageRequest

@Asynchronous(guaranteedDelivery=true)
void completeDeletePackageRequest(RemovePackagesResponse response)
Informs the server that a previous request to delete a package has completed.

Parameters:
response - indicates the original request and the result of executing it

completeRetrievePackageBitsRequest

@Asynchronous(guaranteedDelivery=true)
void completeRetrievePackageBitsRequest(ContentServiceResponse response,
                                                                       InputStream contentStream)
Informs the server that a previous request to get a package's bits has completed.

Parameters:
response - indicates the original request and the result of executing it
contentStream - stream of the package bits being retrieved

loadDependencies

Set<ResourcePackageDetails> loadDependencies(int requestId,
                                             Set<PackageDetailsKey> dependencyPackages)
Informs the server that a package installation (as indicated in the specified request ID) requires dependency packages to be installed. The server will look in its package store to make sure the correct package versions can be found. The server will take the necessary server-side actions to ensure the integrity of the initial request (such as attaching the dependency packages to the initial request entity). In the case of a failure, the server should not mark the request entity as a failure; the natural workflow of a failure response coming back to the server from the agent will take care of that. This method should return the fully populated package descriptions. If the package was not found in the package database, it will be omitted from the returned set.

Parameters:
requestId - refers back to the request ID of the package deployment for which these dependencies were found
dependencyPackages - provides information on the dependency package (name, type, version, architecture);
Returns:
fully populated metadata on the packages known to the server for each of the specified keys; if the server does not know about a package, it will not be present in the returned set

downloadPackageBitsGivenResource

@Timeout(value=2700000L)
@LimitedConcurrency(value="rhq.server.concurrency-limit.content-download")
long downloadPackageBitsGivenResource(int resourceId,
                                                                           PackageDetailsKey packageDetailsKey,
                                                                           OutputStream outputStream)
Requests that the server download and stream the bits for the specified package. If the package cannot be found, an exception will be thrown.

Parameters:
resourceId - identifies the resource to which the bits will be installed
packageDetailsKey - identifies the package to download
outputStream - an output stream where the server should write the package contents. It is up to the caller to prepare this output stream in order to write the package content to an appropriate location.
Returns:
the number of bytes written to the output stream - this is the size of the package version that was downloaded

downloadPackageBitsRangeGivenResource

@Timeout(value=2700000L)
@LimitedConcurrency(value="rhq.server.concurrency-limit.content-download")
long downloadPackageBitsRangeGivenResource(int resourceId,
                                                                                PackageDetailsKey packageDetailsKey,
                                                                                OutputStream outputStream,
                                                                                long startByte,
                                                                                long endByte)
Requests that the server download and stream the bits for the specified package. If the package cannot be found, an exception will be thrown.

Parameters:
resourceId - identifies the resource to which the bits will be installed
packageDetailsKey - identifies the package to download
outputStream - an output stream where the server should write the package contents. It is up to the caller to prepare this output stream in order to write the package content to an appropriate location.
startByte - the first byte (inclusive) of the byte range to retrieve and output (bytes start at index 0)
endByte - the last byte (inclusive) of the byte range to retrieve and output (-1 means up to EOF) (bytes start at index 0)
Returns:
the number of bytes written to the output stream - this is the size of the chunk downloaded

downloadPackageBitsForChildResource

@Timeout(value=2700000L)
@LimitedConcurrency(value="rhq.server.concurrency-limit.content-download")
long downloadPackageBitsForChildResource(int parentResourceId,
                                                                              String resourceTypeName,
                                                                              PackageDetailsKey packageDetailsKey,
                                                                              OutputStream outputStream)
Downloads the package bits used to create a package used as the backing of a resource.

Parameters:
parentResourceId - identifies the parent resource under which the new resource is being created
resourceTypeName - type of child resource being created
packageDetailsKey - package being used to create the child resource
outputStream - an output stream where the server should write the package contents. It is up to the caller to prepare this output stream in order to write the package content to an appropriate location.
Returns:
the number of bytes written to the output stream

getPackageVersionMetadata

@LimitedConcurrency(value="rhq.server.concurrency-limit.content-download")
PageList<PackageVersionMetadataComposite> getPackageVersionMetadata(int resourceId,
                                                                                            PageControl pc)
Requests all metadata for all package versions that the given resource component is subscribed to (see Repo.getResources(). The returned object has the metadata bytes that are meaningful to the calling plugin component.

Callers should consider caching the returned metadata. Use getResourceSubscriptionMD5(int) to get the MD5 hashcode of the metadata for the resource to aid in determining when a cache of metadata is stale.

Parameters:
resourceId - identifies the resource requesting the data; all package versions in all the resource's subscribed repos will be represented in the returned map
pc - this method can potentially return a large set; this page control object allows the caller to page through that large set, as opposed to requesting the entire set in one large chunk
Returns:
the list of all package versions' metadata

getResourceSubscriptionMD5

String getResourceSubscriptionMD5(int resourceId)
Gets the MD5 hash of the resource's "content subscription". If any changes were made to the repos this resource is subscribed to, a changed MD5 will be returned.

Parameters:
resourceId - identifies the resource requesting the MD5; if any change to any package version in any resource's subscribed repos will be used when generating the MD5
Returns:
the MD5 of all package versions' metadata
See Also:
getPackageVersionMetadata(int, PageControl)

getPackageBitsLength

long getPackageBitsLength(int resourceId,
                          PackageDetailsKey packageDetailsKey)
Requests the size, in bytes, of the identified package version.

Parameters:
resourceId - identifies the resource requesting the info
packageDetailsKey - identifies the package whose size is to be returned
Returns:
the size, in number of bytes, of the package version


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