org.rhq.enterprise.server.content
Interface RepoManagerLocal

All Known Implementing Classes:
RepoManagerBean

public interface RepoManagerLocal


Method Summary
 void addContentSourcesToRepo(org.rhq.core.domain.auth.Subject subject, int repoId, int[] contentSourceIds)
           
 void addPackageVersionsToRepo(org.rhq.core.domain.auth.Subject subject, int repoId, int[] packageVersionIds)
           
 void addRepoRelationship(org.rhq.core.domain.auth.Subject subject, int repoId, int relatedRepoId, String relationshipTypeName)
          Creates a relationship between two repos.
 String calculateSyncStatus(org.rhq.core.domain.auth.Subject subject, int repoId)
          Get the overall sync status of this Repository.
 void cancelSync(org.rhq.core.domain.auth.Subject subject, int repoId)
          Cancel any running sync job for the given repo
 org.rhq.core.domain.content.Repo createRepo(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.Repo repo)
           
 org.rhq.core.domain.content.RepoGroup createRepoGroup(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.RepoGroup repoGroup)
          Creates a new RepoGroup in the server.
 void deleteCandidatesWithOnlyContentSource(org.rhq.core.domain.auth.Subject subject, int contentSourceId)
          Removes candidate repos whose only content source is the indicated content source.
 boolean deletePackageVersionsFromRepo(org.rhq.core.domain.auth.Subject subject, int repoId, int[] packageVersionId)
           
 void deleteRepo(org.rhq.core.domain.auth.Subject subject, int repoId)
           
 void deleteRepoGroup(org.rhq.core.domain.auth.Subject subject, int repoGroupId)
          Deletes the indicated repo group.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Advisory> findAssociatedAdvisory(org.rhq.core.domain.auth.Subject subject, int repoid, org.rhq.core.domain.util.PageControl pc)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.ContentSource> findAssociatedContentSources(org.rhq.core.domain.auth.Subject subject, int repoId, org.rhq.core.domain.util.PageControl pc)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Distribution> findAssociatedDistributions(org.rhq.core.domain.auth.Subject subject, int repoid, org.rhq.core.domain.util.PageControl pc)
           
 List<org.rhq.core.domain.content.composite.RepoComposite> findAvailableResourceSubscriptions(int resourceId)
          Gets all repos that aren't subscribed to for the given resource.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.composite.RepoComposite> findAvailableResourceSubscriptions(org.rhq.core.domain.auth.Subject subject, int resourceId, org.rhq.core.domain.util.PageControl pc)
          Gets all repos that aren't subscribed to for the given resource.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersion> findPackageVersionsInRepo(org.rhq.core.domain.auth.Subject subject, int repoId, org.rhq.core.domain.util.PageControl pc)
          Returns the set of package versions that can currently be accessed via the given repo.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersion> findPackageVersionsInRepo(org.rhq.core.domain.auth.Subject subject, int repoId, String filter, org.rhq.core.domain.util.PageControl pc)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersion> findPackageVersionsInRepoByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.PackageVersionCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Repo> findRepos(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.util.PageControl pc)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Repo> findReposByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.RepoCriteria criteria)
           
 List<org.rhq.core.domain.content.composite.RepoComposite> findResourceSubscriptions(int resourceId)
          Gets all repos that are subscribed to by the given resource.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.composite.RepoComposite> findResourceSubscriptions(org.rhq.core.domain.auth.Subject subject, int resourceId, org.rhq.core.domain.util.PageControl pc)
          Gets all repos that are subscribed to by the given resource.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.Resource> findSubscribedResources(org.rhq.core.domain.auth.Subject subject, int repoId, org.rhq.core.domain.util.PageControl pc)
           
 List<org.rhq.core.domain.content.transfer.SubscribedRepo> findSubscriptions(org.rhq.core.domain.auth.Subject subject, int resourceId)
          Gets all repos that are subscribed to by the given resource.
 org.rhq.core.domain.content.PackageVersion getLatestPackageVersion(org.rhq.core.domain.auth.Subject subject, int packageId, int repoId)
           
 org.rhq.core.domain.content.RepoSyncResults getMostRecentSyncResults(org.rhq.core.domain.auth.Subject subject, int repoId)
          Get the most recent RepoSyncResults for this Repo
 long getPackageVersionCountFromRepo(org.rhq.core.domain.auth.Subject subject, int repoId)
           
 org.rhq.core.domain.content.Repo getRepo(org.rhq.core.domain.auth.Subject subject, int repoId)
           
 List<org.rhq.core.domain.content.Repo> getRepoByName(String name)
          Returns all repos that match the given name.
 org.rhq.core.domain.content.RepoGroup getRepoGroup(org.rhq.core.domain.auth.Subject subject, int repoGroupId)
          Returns the repo group with the given id; throws an error if one does not exist at that id.
 org.rhq.core.domain.content.RepoGroup getRepoGroupByName(String name)
          Returns the repo group with the given name if it exists.
 org.rhq.core.domain.content.RepoGroupType getRepoGroupTypeByName(org.rhq.core.domain.auth.Subject subject, String name)
          Returns the repo group type with the given name.
 org.rhq.core.domain.content.RepoSyncResults getRepoSyncResults(int resultsId)
          Returns the full sync results object.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.RepoSyncResults> getRepoSyncResults(org.rhq.core.domain.auth.Subject subject, int repoId, org.rhq.core.domain.util.PageControl pc)
          Allows the caller to page through a list of historical sync results for a content source.
 void importCandidateRepo(org.rhq.core.domain.auth.Subject subject, List<Integer> repoIds)
          Changes the specified repos from being candidates in the system into full blown repositories, allowing their packages to be syncced and resources to subscribe to them.
 int internalSynchronizeRepos(org.rhq.core.domain.auth.Subject subject, Integer[] repoIds)
          Performs the actual synchronization of the given repos.
 org.rhq.core.domain.content.RepoSyncResults mergeRepoSyncResults(org.rhq.core.domain.content.RepoSyncResults results)
          Updates an existing sync results object.
 org.rhq.core.domain.content.RepoSyncResults persistRepoSyncResults(org.rhq.core.domain.content.RepoSyncResults results)
          Creates a new sync results object.
 void processRepoImportReport(org.rhq.core.domain.auth.Subject subject, RepoImportReport report, int contentSourceId, StringBuilder result)
          Handles a repo report from a content source, adding and removing candidate repos as necessary into the database.
 void removeContentSourcesFromRepo(org.rhq.core.domain.auth.Subject subject, int repoId, int[] contentSourceIds)
           
 void removeOwnershipOfSubject(int subjectId)
          When a user gets deleted, all of his/her repos remain intact but become unassigned to any user.
 void simpleAddContentSourcesToRepo(org.rhq.core.domain.auth.Subject subject, int repoId, int[] contentSourceIds)
          Associates content sources with the given repo.
 void subscribeResourceToRepos(org.rhq.core.domain.auth.Subject subject, int resourceId, int[] repoIds)
           
 int synchronizeRepos(org.rhq.core.domain.auth.Subject subject, int[] repoIds)
          Schedules jobs to synchronize the content associated with the repoIds passed in.
 void unsubscribeResourceFromRepos(org.rhq.core.domain.auth.Subject subject, int resourceId, int[] repoIds)
           
 org.rhq.core.domain.content.Repo updateRepo(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.Repo repo)
           
 

Method Detail

findRepos

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Repo> findRepos(org.rhq.core.domain.auth.Subject subject,
                                                                              org.rhq.core.domain.util.PageControl pc)
See Also:
RepoManagerRemote.findRepos(Subject, PageControl)

findAssociatedContentSources

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.ContentSource> findAssociatedContentSources(org.rhq.core.domain.auth.Subject subject,
                                                                                                          int repoId,
                                                                                                          org.rhq.core.domain.util.PageControl pc)

findResourceSubscriptions

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.composite.RepoComposite> findResourceSubscriptions(org.rhq.core.domain.auth.Subject subject,
                                                                                                                 int resourceId,
                                                                                                                 org.rhq.core.domain.util.PageControl pc)
Gets all repos that are subscribed to by the given resource.

Parameters:
subject -
resourceId -
pc -
Returns:
the list of subscriptions

findAvailableResourceSubscriptions

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.composite.RepoComposite> findAvailableResourceSubscriptions(org.rhq.core.domain.auth.Subject subject,
                                                                                                                          int resourceId,
                                                                                                                          org.rhq.core.domain.util.PageControl pc)
Gets all repos that aren't subscribed to for the given resource.

Parameters:
subject -
resourceId -
pc -
Returns:
the list of available repos for the given resource

findResourceSubscriptions

List<org.rhq.core.domain.content.composite.RepoComposite> findResourceSubscriptions(int resourceId)
Gets all repos that are subscribed to by the given resource.

Parameters:
resourceId -
Returns:
the list of subscriptions

findAvailableResourceSubscriptions

List<org.rhq.core.domain.content.composite.RepoComposite> findAvailableResourceSubscriptions(int resourceId)
Gets all repos that aren't subscribed to for the given resource.

Parameters:
resourceId -
Returns:
the list of available repos for the given resource

findPackageVersionsInRepo

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersion> findPackageVersionsInRepo(org.rhq.core.domain.auth.Subject subject,
                                                                                                        int repoId,
                                                                                                        org.rhq.core.domain.util.PageControl pc)
Returns the set of package versions that can currently be accessed via the given repo.

Parameters:
subject - user asking to perform this
repoId - identifies the repo
pc - pagination controls
Returns:
the package versions that are available in the repo

findPackageVersionsInRepo

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersion> findPackageVersionsInRepo(org.rhq.core.domain.auth.Subject subject,
                                                                                                        int repoId,
                                                                                                        String filter,
                                                                                                        org.rhq.core.domain.util.PageControl pc)
See Also:
RepoManagerRemote.findPackageVersionsInRepo(Subject, int, String, PageControl)

deletePackageVersionsFromRepo

boolean deletePackageVersionsFromRepo(org.rhq.core.domain.auth.Subject subject,
                                      int repoId,
                                      int[] packageVersionId)
See Also:
RepoManagerRemote#deletePackageVersionsFromRepo(Subject, int, int)

getLatestPackageVersion

org.rhq.core.domain.content.PackageVersion getLatestPackageVersion(org.rhq.core.domain.auth.Subject subject,
                                                                   int packageId,
                                                                   int repoId)
See Also:
RepoManagerRemote.getLatestPackageVersion(Subject, int, int)

calculateSyncStatus

String calculateSyncStatus(org.rhq.core.domain.auth.Subject subject,
                           int repoId)
Get the overall sync status of this Repository. This is a summation of all the syncs. There is a weight to the status since this returns the most 'relevant' status: 1) ContentSourceSyncStatus.FAILURE 2) ContentSourceSyncStatus.INPROGRESS 3) ContentSourceSyncStatus.SUCCESS

Parameters:
subject - caller
repoId - to calc status for
Returns:
String summary of the status of this Repository

addContentSourcesToRepo

void addContentSourcesToRepo(org.rhq.core.domain.auth.Subject subject,
                             int repoId,
                             int[] contentSourceIds)
                             throws Exception
Throws:
Exception

simpleAddContentSourcesToRepo

void simpleAddContentSourcesToRepo(org.rhq.core.domain.auth.Subject subject,
                                   int repoId,
                                   int[] contentSourceIds)
                                   throws Exception
Associates content sources with the given repo. Unlike addContentSourcesToRepo(Subject, int, int[]), no further operations will be performed, such as any initial synchronization or initialization.

This should only be used for test purposes.

Parameters:
subject - may not be null
repoId - must refer to a valid repo in the system
contentSourceIds - may not be null
Throws:
Exception - if there is an error making the association

removeContentSourcesFromRepo

void removeContentSourcesFromRepo(org.rhq.core.domain.auth.Subject subject,
                                  int repoId,
                                  int[] contentSourceIds)
                                  throws RepoException
Throws:
RepoException

getPackageVersionCountFromRepo

long getPackageVersionCountFromRepo(org.rhq.core.domain.auth.Subject subject,
                                    int repoId)

addRepoRelationship

void addRepoRelationship(org.rhq.core.domain.auth.Subject subject,
                         int repoId,
                         int relatedRepoId,
                         String relationshipTypeName)
Creates a relationship between two repos. The relationship will be marked as being the specified type. For relationships where the order matters, think of the repoId as being the source of the relationship and relatedRepoId as being the destination or target of it.

Parameters:
subject - user making the relationship
repoId - must reference a valid repo in the system the user has permissions to access
relatedRepoId - must reference a valid repo in the system the user has permissions to access
relationshipTypeName - must identify an existing relationship in the database

deleteCandidatesWithOnlyContentSource

void deleteCandidatesWithOnlyContentSource(org.rhq.core.domain.auth.Subject subject,
                                           int contentSourceId)
Removes candidate repos whose only content source is the indicated content source.

Parameters:
subject - user performing the delete
contentSourceId - identifies the content source

processRepoImportReport

void processRepoImportReport(org.rhq.core.domain.auth.Subject subject,
                             RepoImportReport report,
                             int contentSourceId,
                             StringBuilder result)
Handles a repo report from a content source, adding and removing candidate repos as necessary into the database.

Parameters:
subject - user triggering the report processing
report - cannot be null
contentSourceId - identifies the content source that
result - buffer used to store the results of dealing with the report

importCandidateRepo

void importCandidateRepo(org.rhq.core.domain.auth.Subject subject,
                         List<Integer> repoIds)
                         throws RepoException
Changes the specified repos from being candidates in the system into full blown repositories, allowing their packages to be syncced and resources to subscribe to them.

Parameters:
subject - user performing the import
repoIds - the repos being imported; they must refer to repos in the database and must be flagged as candidates (i.e. an error will occur if an already imported repo is specified)
Throws:
RepoException - if one or more of the repo IDs does not exist in the DB or is not a candidate

removeOwnershipOfSubject

void removeOwnershipOfSubject(int subjectId)
When a user gets deleted, all of his/her repos remain intact but become unassigned to any user. This way no links to packages are broken upon user deletion and repository manager can then decide what to do with the leftover repos.

This method therefore sets the owner of all repos owned by provided subject to null.

Parameters:
subjectId -

addPackageVersionsToRepo

void addPackageVersionsToRepo(org.rhq.core.domain.auth.Subject subject,
                              int repoId,
                              int[] packageVersionIds)
See Also:
RepoManagerRemote.addPackageVersionsToRepo(Subject, int, int[])

createRepo

org.rhq.core.domain.content.Repo createRepo(org.rhq.core.domain.auth.Subject subject,
                                            org.rhq.core.domain.content.Repo repo)
                                            throws RepoException
Throws:
RepoException
See Also:
RepoManagerRemote.createRepo(Subject, Repo)

deleteRepo

void deleteRepo(org.rhq.core.domain.auth.Subject subject,
                int repoId)
See Also:
RepoManagerRemote.deleteRepo(Subject, int)

createRepoGroup

org.rhq.core.domain.content.RepoGroup createRepoGroup(org.rhq.core.domain.auth.Subject subject,
                                                      org.rhq.core.domain.content.RepoGroup repoGroup)
                                                      throws RepoException
Creates a new RepoGroup in the server.

Parameters:
subject - represents the user creating the group
repoGroup - group data to create
Returns:
group instance populated after persisting
Throws:
RepoException - if a repo group already exists with this name

deleteRepoGroup

void deleteRepoGroup(org.rhq.core.domain.auth.Subject subject,
                     int repoGroupId)
Deletes the indicated repo group.

Parameters:
subject - user deleting the group
repoGroupId - identifies the group being deleted

getRepo

org.rhq.core.domain.content.Repo getRepo(org.rhq.core.domain.auth.Subject subject,
                                         int repoId)
See Also:
RepoManagerRemote.getRepo(Subject, int)

getRepoGroup

org.rhq.core.domain.content.RepoGroup getRepoGroup(org.rhq.core.domain.auth.Subject subject,
                                                   int repoGroupId)
Returns the repo group with the given id; throws an error if one does not exist at that id.

Parameters:
subject - user whose permissions will be checked for access to the repo
repoGroupId - identifies the repo group to be retrieved
Returns:
details describing the repo group

getRepoGroupTypeByName

org.rhq.core.domain.content.RepoGroupType getRepoGroupTypeByName(org.rhq.core.domain.auth.Subject subject,
                                                                 String name)
Returns the repo group type with the given name.

Parameters:
subject - user whose permissions will be checked for access to the group type
name - identifies the repo group type
Returns:
details of the group type; null if no group is found with the name

getRepoByName

List<org.rhq.core.domain.content.Repo> getRepoByName(String name)
Returns all repos that match the given name. The returned list should only be of size 0 or 1.

Parameters:
name - name of the repo to match
Returns:
list of matching repos; presumably of size 0 or 1

getRepoGroupByName

org.rhq.core.domain.content.RepoGroup getRepoGroupByName(String name)
Returns the repo group with the given name if it exists.

Parameters:
name - name of the repo group to match
Returns:
repo group with the given name; null if one does not

findReposByCriteria

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Repo> findReposByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                        org.rhq.core.domain.criteria.RepoCriteria criteria)
See Also:
RepoManagerRemote.findPackageVersionsInRepoByCriteria(Subject, PackageVersionCriteria)

findPackageVersionsInRepoByCriteria

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.PackageVersion> findPackageVersionsInRepoByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                  org.rhq.core.domain.criteria.PackageVersionCriteria criteria)
See Also:
RepoManagerRemote.findPackageVersionsInRepo(Subject, int, String, PageControl)

subscribeResourceToRepos

void subscribeResourceToRepos(org.rhq.core.domain.auth.Subject subject,
                              int resourceId,
                              int[] repoIds)
See Also:
RepoManagerRemote.subscribeResourceToRepos(Subject, int, int[])

unsubscribeResourceFromRepos

void unsubscribeResourceFromRepos(org.rhq.core.domain.auth.Subject subject,
                                  int resourceId,
                                  int[] repoIds)
See Also:
RepoManagerRemote.unsubscribeResourceFromRepos(Subject, int, int[])

findSubscribedResources

org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.Resource> findSubscribedResources(org.rhq.core.domain.auth.Subject subject,
                                                                                                 int repoId,
                                                                                                 org.rhq.core.domain.util.PageControl pc)
See Also:
RepoManagerRemote.findSubscribedResources(Subject, int, PageControl)

updateRepo

org.rhq.core.domain.content.Repo updateRepo(org.rhq.core.domain.auth.Subject subject,
                                            org.rhq.core.domain.content.Repo repo)
                                            throws RepoException
Throws:
RepoException
See Also:
RepoManagerRemote.updateRepo(Subject, Repo)

findAssociatedDistributions

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Distribution> findAssociatedDistributions(org.rhq.core.domain.auth.Subject subject,
                                                                                                        int repoid,
                                                                                                        org.rhq.core.domain.util.PageControl pc)
See Also:
RepoManagerRemote#findAssociatedDistributions(Subject, int, PageControl)

findAssociatedAdvisory

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.Advisory> findAssociatedAdvisory(org.rhq.core.domain.auth.Subject subject,
                                                                                               int repoid,
                                                                                               org.rhq.core.domain.util.PageControl pc)
See Also:
RepoManagerRemote#findAssociatedAdvisory(Subject, int, PageControl)

synchronizeRepos

int synchronizeRepos(org.rhq.core.domain.auth.Subject subject,
                     int[] repoIds)
                     throws Exception
Schedules jobs to synchronize the content associated with the repoIds passed in.

Parameters:
repoIds - to synchronize; may not be null
Returns:
count of the number of repositories synced.
Throws:
Exception - if there is an error connecting with the plugin container

internalSynchronizeRepos

int internalSynchronizeRepos(org.rhq.core.domain.auth.Subject subject,
                             Integer[] repoIds)
                             throws InterruptedException
Performs the actual synchronization of the given repos.

Parameters:
subject - user performing the sync
repoIds - identifies all repos to be syncced
Returns:
number of repos successfully syncced
Throws:
Exception - if any errors occur
InterruptedException

cancelSync

void cancelSync(org.rhq.core.domain.auth.Subject subject,
                int repoId)
                throws ContentException
Cancel any running sync job for the given repo

Parameters:
repoId - you want to cancel the sync for
Throws:
ContentException

persistRepoSyncResults

org.rhq.core.domain.content.RepoSyncResults persistRepoSyncResults(org.rhq.core.domain.content.RepoSyncResults 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.

mergeRepoSyncResults

org.rhq.core.domain.content.RepoSyncResults mergeRepoSyncResults(org.rhq.core.domain.content.RepoSyncResults results)
Updates an existing sync results object. Do not use this method to create a new sync results object - use #persistContentRepoSyncResults(RepoSyncResults) for that.

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

getRepoSyncResults

org.rhq.core.domain.util.PageList<org.rhq.core.domain.content.RepoSyncResults> getRepoSyncResults(org.rhq.core.domain.auth.Subject subject,
                                                                                                  int repoId,
                                                                                                  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

getRepoSyncResults

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

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

getMostRecentSyncResults

org.rhq.core.domain.content.RepoSyncResults getMostRecentSyncResults(org.rhq.core.domain.auth.Subject subject,
                                                                     int repoId)
Get the most recent RepoSyncResults for this Repo

Parameters:
subject - caller
repoId - to fetch most recent sync results for
Returns:
RepoSyncResults if found, null if not

findSubscriptions

List<org.rhq.core.domain.content.transfer.SubscribedRepo> findSubscriptions(org.rhq.core.domain.auth.Subject subject,
                                                                            int resourceId)
Gets all repos that are subscribed to by the given resource.

Parameters:
subject -
resourceId -
Returns:


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