org.rhq.enterprise.server.content
Interface ContentSourceManagerLocal

All Known Implementing Classes:
ContentSourceManagerBean

public interface ContentSourceManagerLocal

Interface that provides access to the ContentSource objects deployed in the server, allowing the callers to access data about and from remote content repositories.


Method Summary
 org.rhq.core.domain.content.RepoSyncResults _mergeAdvisorySyncReportADD(org.rhq.core.domain.content.ContentSource contentSource, AdvisorySyncReport report, org.rhq.core.domain.content.RepoSyncResults syncResults, StringBuilder progress)
           
 org.rhq.core.domain.content.RepoSyncResults _mergeAdvisorySyncReportREMOVE(org.rhq.core.domain.content.ContentSource contentSource, AdvisorySyncReport report, org.rhq.core.domain.content.RepoSyncResults syncResults, StringBuilder progress)
           
 org.rhq.core.domain.content.RepoSyncResults _mergeDistributionSyncReportADD(org.rhq.core.domain.content.ContentSource contentSource, DistributionSyncReport report, org.rhq.core.domain.content.RepoSyncResults syncResults, StringBuilder progress)
           
 org.rhq.core.domain.content.RepoSyncResults _mergeDistributionSyncReportREMOVE(org.rhq.core.domain.content.ContentSource contentSource, DistributionSyncReport report, org.rhq.core.domain.content.RepoSyncResults syncResults, StringBuilder progress)
           
 org.rhq.core.domain.content.RepoSyncResults _mergePackageSyncReportADD(org.rhq.core.domain.content.ContentSource contentSource, org.rhq.core.domain.content.Repo repo, Collection<ContentProviderPackageDetails> newPackages, Map<ContentProviderPackageDetailsKey,org.rhq.core.domain.content.PackageVersionContentSource> previous, org.rhq.core.domain.content.RepoSyncResults syncResults, StringBuilder progress, int addCount)
           
 org.rhq.core.domain.content.RepoSyncResults _mergePackageSyncReportREMOVE(org.rhq.core.domain.content.ContentSource contentSource, org.rhq.core.domain.content.Repo repo, PackageSyncReport report, Map<ContentProviderPackageDetailsKey,org.rhq.core.domain.content.PackageVersionContentSource> previous, org.rhq.core.domain.content.RepoSyncResults syncResults, StringBuilder progress)
           
 org.rhq.core.domain.content.RepoSyncResults _mergePackageSyncReportUPDATE(org.rhq.core.domain.content.ContentSource contentSource, PackageSyncReport report, Map<ContentProviderPackageDetailsKey,org.rhq.core.domain.content.PackageVersionContentSource> previous, org.rhq.core.domain.content.RepoSyncResults syncResults, StringBuilder progress)
           
 void _mergePackageSyncReportUpdateRepo(int contentSourceId)
           
 org.rhq.core.domain.content.ContentSource createContentSource(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.ContentSource contentSource)
          Create the specified content source.
 void deleteContentSource(org.rhq.core.domain.auth.Subject subject, int contentSourceId)
          Deletes the identified content source.
 void deleteContentSourceSyncResults(org.rhq.core.domain.auth.Subject subject, int[] ids)
          Allow a user to purge content source sync results.
 void downloadDistributionBits(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.ContentSource contentSource)
          This will download all the distribution bits associated with a specific content source.
 boolean downloadPackageBits(int resourceId, org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey)
          This will download the actual package bits for that package version from that content source's remote repository.
 org.rhq.core.domain.content.PackageBits downloadPackageBits(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.PackageVersionContentSource pvcs)
          Given a PackageVersionContentSource which contains the ID of a content source, an ID of a package version, and the location of that package version on the remote content source repo, this will download the actual package bits for that package version from that content source's remote repository.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.ContentSource> getAllContentSources(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.util.PageControl pc)
          Returns all ContentSource objects that are configured in the system.
 Set<org.rhq.core.domain.content.ContentSourceType> getAllContentSourceTypes()
          Returns all ContentSourceType objects that are configured in the system.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Repo> getAssociatedRepos(org.rhq.core.domain.auth.Subject subject, int contentSourceId, org.rhq.core.domain.util.PageControl pc)
          Gets the list of imported repos that are associated with a given content source.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.ContentSource> getAvailableContentSourcesForRepo(org.rhq.core.domain.auth.Subject subject, Integer repoId, org.rhq.core.domain.util.PageControl pc)
          Returns all ContentSource objects that are configured in the system but not presently associated with the repo identified by repoId
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Repo> getCandidateRepos(org.rhq.core.domain.auth.Subject subject, int contentSourceId, org.rhq.core.domain.util.PageControl pc)
          Gets the list of candidate repos that are associated with a given content source.
 org.rhq.core.domain.content.ContentSource getContentSource(org.rhq.core.domain.auth.Subject subject, int contentSourceId)
          Returns the ContentSource from its ID.
 org.rhq.core.domain.content.ContentSource getContentSourceByNameAndType(org.rhq.core.domain.auth.Subject subject, String name, String typeName)
          Get a ContentSource by name and ContentSourceType name.
 org.rhq.core.domain.content.ContentSourceSyncResults getContentSourceSyncResults(int resultsId)
          Returns the full sync results object.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.ContentSourceSyncResults> getContentSourceSyncResults(org.rhq.core.domain.auth.Subject subject, int contentSourceId, org.rhq.core.domain.util.PageControl pc)
          Allows the caller to page through a list of historical sync results for a content source.
 org.rhq.core.domain.content.ContentSourceType getContentSourceType(String name)
          Get a ContentSourceType by name.
 long getPackageBitsLength(int resourceId, org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey)
          Returns the length of the package version identified by its PackageDetailsKey.
 long getPackageVersionCountFromContentSource(org.rhq.core.domain.auth.Subject subject, int contentSourceId)
          Returns count of PackageVersions associated with the given content source.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.composite.PackageVersionMetadataComposite> getPackageVersionMetadata(int resourceId, org.rhq.core.domain.util.PageControl pc)
          Requests all metadata for all package versions that the given resource component is subscribed to (see Repo.getResources().
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersionContentSource> getPackageVersionsFromContentSource(org.rhq.core.domain.auth.Subject subject, int contentSourceId, org.rhq.core.domain.util.PageControl pc)
          Returns all the package versions that are served by the content source identified by the given ID.
 List<org.rhq.core.domain.content.PackageVersionContentSource> getPackageVersionsFromContentSourceForRepo(org.rhq.core.domain.auth.Subject subject, int contentSourceId, int repoId)
          Returns all packages from the given repo.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersionContentSource> getPackageVersionsFromContentSources(org.rhq.core.domain.auth.Subject subject, int[] contentSourceIds, org.rhq.core.domain.util.PageControl pc)
          Returns all the package versions that are served by all the content sources identified by the given IDs.
 String getResourceSubscriptionMD5(int resourceId)
          Gets the MD5 hash which identifies a resource "content subscription".
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersionContentSource> getUnloadedPackageVersionsFromContentSourceInRepo(org.rhq.core.domain.auth.Subject subject, int contentSourceId, int repoId, org.rhq.core.domain.util.PageControl pc)
          Returns all the package versions that are served by the content source identified by the given ID but whose package bits have not been loaded yet.
 boolean internalSynchronizeContentSource(int contentSourceId)
          Requests that the identified content source be synchronized.
 org.rhq.core.domain.content.RepoSyncResults mergeAdvisorySyncReport(org.rhq.core.domain.content.ContentSource contentSource, AdvisorySyncReport report, org.rhq.core.domain.content.RepoSyncResults syncResults)
          After a sync has happened, this is responsible for persisting the results.
 org.rhq.core.domain.content.ContentSourceSyncResults mergeContentSourceSyncResults(org.rhq.core.domain.content.ContentSourceSyncResults results)
          Updates an existing sync results object.
 org.rhq.core.domain.content.RepoSyncResults mergeDistributionSyncReport(org.rhq.core.domain.content.ContentSource contentSource, DistributionSyncReport report, org.rhq.core.domain.content.RepoSyncResults syncResults)
          After a sync has happened, this is responsible for persisting the results.
 org.rhq.core.domain.content.RepoSyncResults mergePackageSyncReport(org.rhq.core.domain.content.ContentSource contentSource, org.rhq.core.domain.content.Repo repo, PackageSyncReport report, Map<ContentProviderPackageDetailsKey,org.rhq.core.domain.content.PackageVersionContentSource> previous, org.rhq.core.domain.content.RepoSyncResults syncResults)
          After a sync has happened, this is responsible for persisting the results.
 void mergeRepoImportResults(List<RepoDetails> repos)
          Updates the server with the results of a repo import from a content source.
 long outputDistributionFileBits(org.rhq.core.domain.content.DistributionFile distFile, OutputStream outputStream)
          Requests the bits of a distribution file be streamed down to the caller over the given output stream.
 long outputPackageBitsForChildResource(int parentResourceId, String resourceTypeName, org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey, OutputStream outputStream)
          Requests the bits of a package being used to create a child resource be stream down to the caller over the given output stream.
 long outputPackageVersionBits(org.rhq.core.domain.content.PackageVersion packageVersion, OutputStream outputStream)
          Requests the bits of a package be streamed down to the caller over the given output stream.
 long outputPackageVersionBits(org.rhq.core.domain.content.PackageVersion packageVersion, OutputStream outputStream, long startByte, long endByte)
          Requests a range of bits from a package.
 long outputPackageVersionBitsGivenResource(int resourceId, org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey, OutputStream outputStream)
          Requests that the actual content data (the "bits") of the identified package version be streamed down to the caller over the given output stream that the caller provides.
 long outputPackageVersionBitsRangeGivenResource(int resourceId, org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey, OutputStream outputStream, long startByte, long endByte)
          Requests that the actual content data (the "bits") of the identified package version be streamed down to the caller over the given output stream that the caller provides.
 org.rhq.core.domain.content.ContentSourceSyncResults persistContentSourceSyncResults(org.rhq.core.domain.content.ContentSourceSyncResults results)
          Creates a new sync results object.
 void purgeOrphanedPackageVersions(org.rhq.core.domain.auth.Subject subject)
          This will look for any PackageVersions that are "orphaned" (that is, is not related to any existing content source or repo and is not installed anywhere) and will remove any orphans that it finds.
 org.rhq.core.domain.content.ContentSource simpleCreateContentSource(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.ContentSource contentSource)
          Adds the specified content source to the database but does not attempt to create or start the server-side plugin provider implementation associated with it.
 void synchronizeAndLoadContentSource(org.rhq.core.domain.auth.Subject subject, int contentSourceId)
          Requests that the identified content source be synchronized and if not lazy-loading to also download its packages' bits.
 void testContentSourceConnection(int contentSourceId)
          Given a content source ID, this will test that the adapter responsible for pulling data from the content source's remote repository can actually connect to that repository, and if not, throw an Exception.
 org.rhq.core.domain.content.ContentSource updateContentSource(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.ContentSource contentSource, boolean syncNow)
          Update an existing ContentSource object and restarts its underlying adapter.
 

Method Detail

purgeOrphanedPackageVersions

void purgeOrphanedPackageVersions(org.rhq.core.domain.auth.Subject subject)
This will look for any PackageVersions that are "orphaned" (that is, is not related to any existing content source or repo and is not installed anywhere) and will remove any orphans that it finds. This means it will delete orphaned PackageVersion definitions and (if loaded) their PackageBits.

Parameters:
subject - user requesting the purge

deleteContentSource

void deleteContentSource(org.rhq.core.domain.auth.Subject subject,
                         int contentSourceId)
Deletes the identified content source. Any package versions that originated from this content source but are still related to one or more repos will remain.

Parameters:
subject - An authenticated user making the request.
contentSourceId - The id of the content source to be deleted.

getAllContentSourceTypes

Set<org.rhq.core.domain.content.ContentSourceType> getAllContentSourceTypes()
Returns all ContentSourceType objects that are configured in the system.

Returns:
all content source types

getAvailableContentSourcesForRepo

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.ContentSource> getAvailableContentSourcesForRepo(org.rhq.core.domain.auth.Subject subject,
                                                                                                               Integer repoId,
                                                                                                               org.rhq.core.domain.util.PageControl pc)
Returns all ContentSource objects that are configured in the system but not presently associated with the repo identified by repoId

Parameters:
subject - user asking to perform this
repoId - the identifier for the repo
pc - pagination controls
Returns:
all content sources that are not presently associated with the repo identified by repoId

getAllContentSources

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.ContentSource> getAllContentSources(org.rhq.core.domain.auth.Subject subject,
                                                                                                  org.rhq.core.domain.util.PageControl pc)
Returns all ContentSource objects that are configured in the system.

Parameters:
subject - user asking to perform this
pc - pagination controls
Returns:
all content sources

getContentSourceType

org.rhq.core.domain.content.ContentSourceType getContentSourceType(String name)
Get a ContentSourceType by name. null will be returned if there is no content source type by that name.

Parameters:
name - the name of the ContentSourceType to be returned
Returns:
ContentSourceType found. null if none found

getContentSource

org.rhq.core.domain.content.ContentSource getContentSource(org.rhq.core.domain.auth.Subject subject,
                                                           int contentSourceId)
Returns the ContentSource from its ID.

Parameters:
subject - user asking to perform this
contentSourceId - identifies the content source to return
Returns:
the content source object, null if the ID is invalid

getContentSourceByNameAndType

org.rhq.core.domain.content.ContentSource getContentSourceByNameAndType(org.rhq.core.domain.auth.Subject subject,
                                                                        String name,
                                                                        String typeName)
Get a ContentSource by name and ContentSourceType name. null will be returned if there is no content source with the given criteria.

Parameters:
subject - user asking to perform this
name - the name of the ContentSource to be returned
typeName - the name of the ContentSourceType
Returns:
ContentSource found. null if none found

getAssociatedRepos

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Repo> getAssociatedRepos(org.rhq.core.domain.auth.Subject subject,
                                                                                       int contentSourceId,
                                                                                       org.rhq.core.domain.util.PageControl pc)
Gets the list of imported repos that are associated with a given content source.

Parameters:
subject - user asking to perform this
contentSourceId - the id of a content source.
pc - pagination controls
Returns:
list of associated repos

getCandidateRepos

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Repo> getCandidateRepos(org.rhq.core.domain.auth.Subject subject,
                                                                                      int contentSourceId,
                                                                                      org.rhq.core.domain.util.PageControl pc)
Gets the list of candidate repos that are associated with a given content source.

Parameters:
subject - user asking to perform this
contentSourceId - the id of a content source.
pc - pagination controls
Returns:
list of candidate repos

getContentSourceSyncResults

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.ContentSourceSyncResults> getContentSourceSyncResults(org.rhq.core.domain.auth.Subject subject,
                                                                                                                    int contentSourceId,
                                                                                                                    org.rhq.core.domain.util.PageControl pc)
Allows the caller to page through a list of historical sync results for a content source.

Parameters:
subject - user asking to perform this
contentSourceId - The id of a content source.
pc - pagination controls
Returns:
the list of results

deleteContentSourceSyncResults

void deleteContentSourceSyncResults(org.rhq.core.domain.auth.Subject subject,
                                    int[] ids)
Allow a user to purge content source sync results.

Parameters:
subject - user asking to perform this
ids - the IDs of the ContentSourceSyncResults to delete

createContentSource

org.rhq.core.domain.content.ContentSource createContentSource(org.rhq.core.domain.auth.Subject subject,
                                                              org.rhq.core.domain.content.ContentSource contentSource)
                                                              throws ContentSourceException
Create the specified content source.

Parameters:
subject - The user making the request.
contentSource - A content source to be created.
Returns:
The created content source.
Throws:
ContentSourceException

updateContentSource

org.rhq.core.domain.content.ContentSource updateContentSource(org.rhq.core.domain.auth.Subject subject,
                                                              org.rhq.core.domain.content.ContentSource contentSource,
                                                              boolean syncNow)
                                                              throws ContentSourceException
Update an existing ContentSource object and restarts its underlying adapter. This also forces the adapter to immediately sync with the remote repository. Note that this will only update the content source's basic fields like name, description, etc. as well as its configuration. Specifically, it will not update the other relationships like its repos. Use #addContentSourcesToRepo(Subject, int, int[]) for things like that.

Parameters:
subject - wanting to update the ContentSource
contentSource - to be updated
syncNow - if you wish to resync the ContentSource after updating
Returns:
the ContentSource that was updated
Throws:
ContentSourceException

testContentSourceConnection

void testContentSourceConnection(int contentSourceId)
                                 throws Exception
Given a content source ID, this will test that the adapter responsible for pulling data from the content source's remote repository can actually connect to that repository, and if not, throw an Exception.

Parameters:
contentSourceId - the id of the content source on which to test the connection
Throws:
Exception - if the test failed

synchronizeAndLoadContentSource

void synchronizeAndLoadContentSource(org.rhq.core.domain.auth.Subject subject,
                                     int contentSourceId)
Requests that the identified content source be synchronized and if not lazy-loading to also download its packages' bits. This ensures that the server maintains an accurate list of what is available on the content source by seeing what was added, removed or updated since the last time the content source was synchronized. This method is performed asynchronously - the calling thread will not block and will return immediately.

Parameters:
subject - the user asking to perform this
contentSourceId - identifies the content source to synchronize
Throws:
Exception - if failed to kick off the synchronize job

getPackageVersionsFromContentSource

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersionContentSource> getPackageVersionsFromContentSource(org.rhq.core.domain.auth.Subject subject,
                                                                                                                               int contentSourceId,
                                                                                                                               org.rhq.core.domain.util.PageControl pc)
Returns all the package versions that are served by the content source identified by the given ID.

Parameters:
subject - the user asking to perform this
contentSourceId - The id of a content source.
pc - pagination controls
Returns:
all package versions that the content source will be providing content for. The object returned also contains the location where those package versions are located in the content source

getPackageVersionsFromContentSourceForRepo

List<org.rhq.core.domain.content.PackageVersionContentSource> getPackageVersionsFromContentSourceForRepo(org.rhq.core.domain.auth.Subject subject,
                                                                                                         int contentSourceId,
                                                                                                         int repoId)
Returns all packages from the given repo. This call takes into account the content source to provide any extra data on the package versions that exist for the particular mapping of content source and package, such as the location attribute.

Parameters:
subject - user retrieving the data
contentSourceId - content source from which the packages are retrieved
repoId - repo from which the packages are retrieved
Returns:
all package versions that the content source will be providing content for. The object returned also contains the location where those package versions are located in the content source

getPackageVersionCountFromContentSource

long getPackageVersionCountFromContentSource(org.rhq.core.domain.auth.Subject subject,
                                             int contentSourceId)
Returns count of PackageVersions associated with the given content source.

Parameters:
subject - caller requesting count
contentSourceId - to lookup
Returns:
count if any

getPackageBitsLength

long getPackageBitsLength(int resourceId,
                          org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey)
Returns the length of the package version identified by its PackageDetailsKey. This method ensures that the given resource is subscribed to a repo that contains the package version.

Parameters:
resourceId -
packageDetailsKey -
Returns:
the length of the package version

getPackageVersionsFromContentSources

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersionContentSource> getPackageVersionsFromContentSources(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                int[] contentSourceIds,
                                                                                                                                org.rhq.core.domain.util.PageControl pc)
Returns all the package versions that are served by all the content sources identified by the given IDs.

Parameters:
subject - the user asking to perform this
contentSourceIds -
pc -
Returns:
all package versions that the content sources will be providing content for. The object returned also contains the location where those package versions are located in the content source

getUnloadedPackageVersionsFromContentSourceInRepo

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersionContentSource> getUnloadedPackageVersionsFromContentSourceInRepo(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                             int contentSourceId,
                                                                                                                                             int repoId,
                                                                                                                                             org.rhq.core.domain.util.PageControl pc)
Returns all the package versions that are served by the content source identified by the given ID but whose package bits have not been loaded yet.

Parameters:
subject - the user asking to perform this
contentSourceId -
pc -
Returns:
all unloaded package versions that the content source will be providing content for. The object returned also contains the location where those package versions are located in the content source

downloadDistributionBits

void downloadDistributionBits(org.rhq.core.domain.auth.Subject subject,
                              org.rhq.core.domain.content.ContentSource contentSource)
This will download all the distribution bits associated with a specific content source.

Parameters:
subject -
contentSource -

downloadPackageBits

boolean downloadPackageBits(int resourceId,
                            org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey)
This will download the actual package bits for that package version from that content source's remote repository.

Parameters:
resourceId -
packageDetailsKey -
packageVersionId -
Returns:

downloadPackageBits

org.rhq.core.domain.content.PackageBits downloadPackageBits(org.rhq.core.domain.auth.Subject subject,
                                                            org.rhq.core.domain.content.PackageVersionContentSource pvcs)
Given a PackageVersionContentSource which contains the ID of a content source, an ID of a package version, and the location of that package version on the remote content source repo, this will download the actual package bits for that package version from that content source's remote repository.

An exception will be thrown if the package bits could not be loaded.

This method is potentially a long running operation. Its transaction timeout should be extended appropriately.

If the content source where the package version is found is flagged to NEVER download package bits, this will immediately return null.

Parameters:
subject - the user asking to perform this
pvcs -
Returns:
information about the package bits that were downloaded - note that this will NOT have the actual bits inside it - we will not load the package bits in memory for obvious reasons. This will be null if the content source is configured to never actually download package bits.

internalSynchronizeContentSource

boolean internalSynchronizeContentSource(int contentSourceId)
                                         throws Exception
Requests that the identified content source be synchronized. This ensures that the server maintains an accurate list of what is available on the content source by seeing what was added, removed or updated since the last time the content source was synchronized.

Do not call this method unless you know what you are doing. It is potentially a long running process and will block the calling thread. In addition, this method must never be called from inside a transaction, because it can be long running. You probably want to call #synchronizeAndLoadContentSource(int).

Parameters:
contentSourceId - identifies the content source to synchronize
Returns:
true if the synchronization is complete; false if there is already a synchronization already in progress and this call did nothing and aborted.
Throws:
Exception - if failed to synchronize

persistContentSourceSyncResults

org.rhq.core.domain.content.ContentSourceSyncResults persistContentSourceSyncResults(org.rhq.core.domain.content.ContentSourceSyncResults results)
Creates a new sync results object. Note that this will return null if the given results object has a status of INPROGRESS but there is already a sync results object that is still INPROGRESS and has been in that state for less than 24 hours. Use this to prohibit the system from synchronizing on the same content source concurrently.

Parameters:
results - the results that should be persisted
Returns:
the persisted object, or null if another sync is currently inprogress.

mergeContentSourceSyncResults

org.rhq.core.domain.content.ContentSourceSyncResults mergeContentSourceSyncResults(org.rhq.core.domain.content.ContentSourceSyncResults results)
Updates an existing sync results object. Do not use this method to create a new sync results object - use persistContentSourceSyncResults(ContentSourceSyncResults) for that.

Parameters:
results - the existing results that should be or merged
Returns:
the merged object

getContentSourceSyncResults

org.rhq.core.domain.content.ContentSourceSyncResults getContentSourceSyncResults(int resultsId)
Returns the full sync results object.

Parameters:
resultsId - the ID of the object to return
Returns:
the full sync results

mergeRepoImportResults

void mergeRepoImportResults(List<RepoDetails> repos)
Updates the server with the results of a repo import from a content source.

Parameters:
repos - list of repo data received from the content source; should not be null

mergePackageSyncReport

org.rhq.core.domain.content.RepoSyncResults mergePackageSyncReport(org.rhq.core.domain.content.ContentSource contentSource,
                                                                   org.rhq.core.domain.content.Repo repo,
                                                                   PackageSyncReport report,
                                                                   Map<ContentProviderPackageDetailsKey,org.rhq.core.domain.content.PackageVersionContentSource> previous,
                                                                   org.rhq.core.domain.content.RepoSyncResults syncResults)
After a sync has happened, this is responsible for persisting the results.

Parameters:
contentSource - content source that was just sync'ed
report - information on what the current inventory should look like
previous - information from the previous inventory, before the sync happened
syncResults - sync results object that should be updated to track this method's progress
Returns:
the updated syncResults that includes more summary information in the results string that indicates what was done

mergeDistributionSyncReport

org.rhq.core.domain.content.RepoSyncResults mergeDistributionSyncReport(org.rhq.core.domain.content.ContentSource contentSource,
                                                                        DistributionSyncReport report,
                                                                        org.rhq.core.domain.content.RepoSyncResults syncResults)
After a sync has happened, this is responsible for persisting the results.

Parameters:
contentSource - content source that was just sync'ed
report - information on what the current inventory should look like
syncResults - sync results object that should be updated to track this method's progress
Returns:
the updated syncResults that includes more summary information in the results string that indicates what was done

mergeAdvisorySyncReport

org.rhq.core.domain.content.RepoSyncResults mergeAdvisorySyncReport(org.rhq.core.domain.content.ContentSource contentSource,
                                                                    AdvisorySyncReport report,
                                                                    org.rhq.core.domain.content.RepoSyncResults syncResults)
After a sync has happened, this is responsible for persisting the results.

Parameters:
contentSource - content source that was just sync'ed
report - information on what the current inventory should look like
syncResults - sync results object that should be updated to track this method's progress
Returns:
the updated syncResults that includes more summary information in the results string that indicates what was done

_mergePackageSyncReportUpdateRepo

void _mergePackageSyncReportUpdateRepo(int contentSourceId)

_mergePackageSyncReportREMOVE

org.rhq.core.domain.content.RepoSyncResults _mergePackageSyncReportREMOVE(org.rhq.core.domain.content.ContentSource contentSource,
                                                                          org.rhq.core.domain.content.Repo repo,
                                                                          PackageSyncReport report,
                                                                          Map<ContentProviderPackageDetailsKey,org.rhq.core.domain.content.PackageVersionContentSource> previous,
                                                                          org.rhq.core.domain.content.RepoSyncResults syncResults,
                                                                          StringBuilder progress)

_mergePackageSyncReportADD

org.rhq.core.domain.content.RepoSyncResults _mergePackageSyncReportADD(org.rhq.core.domain.content.ContentSource contentSource,
                                                                       org.rhq.core.domain.content.Repo repo,
                                                                       Collection<ContentProviderPackageDetails> newPackages,
                                                                       Map<ContentProviderPackageDetailsKey,org.rhq.core.domain.content.PackageVersionContentSource> previous,
                                                                       org.rhq.core.domain.content.RepoSyncResults syncResults,
                                                                       StringBuilder progress,
                                                                       int addCount)

_mergePackageSyncReportUPDATE

org.rhq.core.domain.content.RepoSyncResults _mergePackageSyncReportUPDATE(org.rhq.core.domain.content.ContentSource contentSource,
                                                                          PackageSyncReport report,
                                                                          Map<ContentProviderPackageDetailsKey,org.rhq.core.domain.content.PackageVersionContentSource> previous,
                                                                          org.rhq.core.domain.content.RepoSyncResults syncResults,
                                                                          StringBuilder progress)

_mergeDistributionSyncReportREMOVE

org.rhq.core.domain.content.RepoSyncResults _mergeDistributionSyncReportREMOVE(org.rhq.core.domain.content.ContentSource contentSource,
                                                                               DistributionSyncReport report,
                                                                               org.rhq.core.domain.content.RepoSyncResults syncResults,
                                                                               StringBuilder progress)

_mergeDistributionSyncReportADD

org.rhq.core.domain.content.RepoSyncResults _mergeDistributionSyncReportADD(org.rhq.core.domain.content.ContentSource contentSource,
                                                                            DistributionSyncReport report,
                                                                            org.rhq.core.domain.content.RepoSyncResults syncResults,
                                                                            StringBuilder progress)

_mergeAdvisorySyncReportADD

org.rhq.core.domain.content.RepoSyncResults _mergeAdvisorySyncReportADD(org.rhq.core.domain.content.ContentSource contentSource,
                                                                        AdvisorySyncReport report,
                                                                        org.rhq.core.domain.content.RepoSyncResults syncResults,
                                                                        StringBuilder progress)

_mergeAdvisorySyncReportREMOVE

org.rhq.core.domain.content.RepoSyncResults _mergeAdvisorySyncReportREMOVE(org.rhq.core.domain.content.ContentSource contentSource,
                                                                           AdvisorySyncReport report,
                                                                           org.rhq.core.domain.content.RepoSyncResults syncResults,
                                                                           StringBuilder progress)

getPackageVersionMetadata

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.composite.PackageVersionMetadataComposite> getPackageVersionMetadata(int resourceId,
                                                                                                                                   org.rhq.core.domain.util.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.

Note that the returned object has the package version IDs that can be used to retrieve the actual content bits of the package versions via a call to #retrievePackageVersionBits(int, int).

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
See Also:
getResourceSubscriptionMD5(int)

getResourceSubscriptionMD5

String getResourceSubscriptionMD5(int resourceId)
Gets the MD5 hash which identifies a resource "content subscription". This MD5 hash will change when any repo the resource is subscribed to has changed its contents (that is, if a package version was added/updated/removed from it).

Parameters:
resourceId - identifies the resource requesting the MD5; any change to any package version in any of the resource's subscribed repos will determine the MD5
Returns:
the MD5
See Also:
getPackageVersionMetadata(int, PageControl)

outputPackageVersionBitsGivenResource

long outputPackageVersionBitsGivenResource(int resourceId,
                                           org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey,
                                           OutputStream outputStream)
Requests that the actual content data (the "bits") of the identified package version be streamed down to the caller over the given output stream that the caller provides. This method will not be responsible for closing the stream when its done, the caller needs to close it. This may be a time-consuming method call because if the bits have not yet been loaded (i.e. the content source where the package version lives is lazy loading then this may be the time when it is downloaded from the remote repository.

This is the same as calling outputPackageVersionBitsRangeGivenResource(int, PackageDetailsKey, OutputStream, long, long) with the start/end bytes of 0 and -1 respectively.

Parameters:
resourceId - identifies the resource making the request; if this resource is not allowed to see the package version (due to the fact that it is not subscribed to a repo that is serving that package version), an exception is thrown
packageDetailsKey - identifies the PackageVersion whose PackageBits are to be streamed
outputStream - a stream that the caller prepared where this method will write the actual content
Returns:
the number of bytes written to the output stream

outputPackageVersionBitsRangeGivenResource

long outputPackageVersionBitsRangeGivenResource(int resourceId,
                                                org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey,
                                                OutputStream outputStream,
                                                long startByte,
                                                long endByte)
Requests that the actual content data (the "bits") of the identified package version be streamed down to the caller over the given output stream that the caller provides. This method will not be responsible for closing the stream when its done, the caller needs to close it. This may be a time-consuming method call because if the bits have not yet been loaded (i.e. the content source where the package version lives is lazy loading then this may be the time when it is downloaded from the remote repository.

Parameters:
resourceId - identifies the resource making the request; if this resource is not allowed to see the package version (due to the fact that it is not subscribed to a repo that is serving that package version), an exception is thrown
packageDetailsKey - identifies the PackageVersion whose PackageBits are to be streamed
outputStream - a stream that the caller prepared where this method will write the actual content
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

outputPackageBitsForChildResource

long outputPackageBitsForChildResource(int parentResourceId,
                                       String resourceTypeName,
                                       org.rhq.core.domain.content.PackageDetailsKey packageDetailsKey,
                                       OutputStream outputStream)
Requests the bits of a package being used to create a child resource be stream down to the caller over the given output stream. This method will not take care of closing the stream when it is finished; it is the caller's responsibility. This may be a time-consuming method call because if the bits have not yet been loaded (i.e. the content source where the package version lives is lazy loading then this may be the time when it is downloaded from the remote repository.

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

outputPackageVersionBits

long outputPackageVersionBits(org.rhq.core.domain.content.PackageVersion packageVersion,
                              OutputStream outputStream)
Requests the bits of a package be streamed down to the caller over the given output stream. This method will not take care of closing the stream when it is finished; it is the caller's responsibility. This may be a time-consuming method call because if the bits have not yet been loaded (i.e. the content source where the package version lives is lazy loading then this may be the time when it is downloaded from the remote repository.

Parameters:
packageVersion - packageVersion to fetch
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

outputPackageVersionBits

long outputPackageVersionBits(org.rhq.core.domain.content.PackageVersion packageVersion,
                              OutputStream outputStream,
                              long startByte,
                              long endByte)
Requests a range of bits from a package. This range of bits will be streamed down to the caller over the given output stream. This method will not take care of closing the stream when it is finished; it is the caller's responsibility. This may be a time-consuming method call because if the bits have not yet been loaded (i.e. the content source where the package version lives is lazy loading then this may be the time when it is downloaded from the remote repository.

Parameters:
packageVersion - packageVersion to fetch
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 - start index
endByte - end index
Returns:
the number of bytes written to the output stream

outputDistributionFileBits

long outputDistributionFileBits(org.rhq.core.domain.content.DistributionFile distFile,
                                OutputStream outputStream)
Requests the bits of a distribution file be streamed down to the caller over the given output stream. This method will not take care of closing the stream when it is finished; it is the caller's responsibility.

Parameters:
distFile - distribution file to fetch
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

simpleCreateContentSource

org.rhq.core.domain.content.ContentSource simpleCreateContentSource(org.rhq.core.domain.auth.Subject subject,
                                                                    org.rhq.core.domain.content.ContentSource contentSource)
                                                                    throws ContentSourceException
Adds the specified content source to the database but does not attempt to create or start the server-side plugin provider implementation associated with it.

This should only be used for test purposes.

Parameters:
subject - may not be null
contentSource - may not be null
Returns:
instance after being persisted; will contain a populated ID value
Throws:
ContentSourceException - if the content source cannot be created, such as if the data in the given object are not valid


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