org.rhq.enterprise.server.content
Class RepoManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.content.RepoManagerBean
All Implemented Interfaces:
RepoManagerLocal, RepoManagerRemote

public class RepoManagerBean
extends Object
implements RepoManagerLocal, RepoManagerRemote


Constructor Summary
RepoManagerBean()
           
 
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)
          Associates the package versions (identified by their IDs) to the given repo (also identified by its ID).
 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)
          Creates a new 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[] packageVersionIds)
          Deletes package versions from a repo if they are not referenced by a content source.
 void deleteRepo(org.rhq.core.domain.auth.Subject subject, int repoId)
          Deletes the indicated repo.
 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)
          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> 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)
          Returns all imported repos in the server.
 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)
          Returns all repos that match the given 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)
          Gets all resources that are subscribed to the given repo.
 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.
 long getAdvisoryCountFromRepo(org.rhq.core.domain.auth.Subject subject, int repoId)
           
 long getDistributionCountFromRepo(org.rhq.core.domain.auth.Subject subject, int repoId)
           
 org.rhq.core.domain.content.PackageVersion getLatestPackageVersion(org.rhq.core.domain.auth.Subject subject, int packageId, int repoId)
          Returns the latest package version of the supplied package.
 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)
           
 long getPackageVersionCountFromRepo(org.rhq.core.domain.auth.Subject subject, String filter, int repoId)
           
 org.rhq.core.domain.content.Repo getRepo(org.rhq.core.domain.auth.Subject subject, int repoId)
          Returns the repo with the given id; throws an error if one does not exist at that id.
 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)
          Subscribes the identified resource to the set of identified repos.
 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)
          Unsubscribes the identified resource from the set of identified repos.
 org.rhq.core.domain.content.Repo updateRepo(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.content.Repo repo)
          Update an existing Repo object's basic fields, like name, description, etc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepoManagerBean

public RepoManagerBean()
Method Detail

deleteRepo

public void deleteRepo(org.rhq.core.domain.auth.Subject subject,
                       int repoId)
Description copied from interface: RepoManagerRemote
Deletes the indicated repo. If this deletion orphans package versions (that is, its originating resource or content source has been deleted), this will also purge those orphaned package versions.

Specified by:
deleteRepo in interface RepoManagerLocal
Specified by:
deleteRepo in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
repoId - identifies the repo to delete
See Also:
RepoManagerRemote.deleteRepo(Subject, int)

deleteRepoGroup

public void deleteRepoGroup(org.rhq.core.domain.auth.Subject subject,
                            int repoGroupId)
Description copied from interface: RepoManagerLocal
Deletes the indicated repo group.

Specified by:
deleteRepoGroup in interface RepoManagerLocal
Parameters:
subject - user deleting the group
repoGroupId - identifies the group being deleted

deletePackageVersionsFromRepo

public boolean deletePackageVersionsFromRepo(org.rhq.core.domain.auth.Subject subject,
                                             int repoId,
                                             int[] packageVersionIds)
Description copied from interface: RepoManagerRemote
Deletes package versions from a repo if they are not referenced by a content source.

The package versions themselves are not deleted until some content source or repository is deleted at which point orphans detection is performed.

Specified by:
deletePackageVersionsFromRepo in interface RepoManagerLocal
Specified by:
deletePackageVersionsFromRepo in interface RepoManagerRemote
Returns:
true if all the package versions were successfully deleted, false if some references exist.
See Also:
RepoManagerRemote#deletePackageVersionsFromRepo(Subject, int, int)

findRepos

public 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)
Description copied from interface: RepoManagerRemote
Returns all imported repos in the server.

Specified by:
findRepos in interface RepoManagerLocal
Specified by:
findRepos in interface RepoManagerRemote
Parameters:
subject - user making the request
pc - used for pagination
Returns:
paged list
See Also:
RepoManagerRemote.findRepos(Subject, PageControl)

getRepo

public org.rhq.core.domain.content.Repo getRepo(org.rhq.core.domain.auth.Subject subject,
                                                int repoId)
Description copied from interface: RepoManagerRemote
Returns the repo with the given id; throws an error if one does not exist at that id.

Specified by:
getRepo in interface RepoManagerLocal
Specified by:
getRepo in interface RepoManagerRemote
Parameters:
subject - user whose permissions will be checked for access to the repo
repoId - identifies the repo to be retrieved
Returns:
details describing the repo
See Also:
RepoManagerRemote.getRepo(Subject, int)

getRepoGroup

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

Specified by:
getRepoGroup in interface RepoManagerLocal
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

findAssociatedContentSources

public 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)
Specified by:
findAssociatedContentSources in interface RepoManagerLocal

findSubscribedResources

public 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)
Description copied from interface: RepoManagerRemote
Gets all resources that are subscribed to the given repo.

Specified by:
findSubscribedResources in interface RepoManagerLocal
Specified by:
findSubscribedResources in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
Returns:
the list of subscribers
See Also:
RepoManagerRemote.findSubscribedResources(Subject, int, PageControl)

findResourceSubscriptions

public 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)
Description copied from interface: RepoManagerLocal
Gets all repos that are subscribed to by the given resource.

Specified by:
findResourceSubscriptions in interface RepoManagerLocal
Returns:
the list of subscriptions

findSubscriptions

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

Specified by:
findSubscriptions in interface RepoManagerLocal
Specified by:
findSubscriptions in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
resourceId - The id of the resource.
Returns:
A list of repos.

findAvailableResourceSubscriptions

public 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)
Description copied from interface: RepoManagerLocal
Gets all repos that aren't subscribed to for the given resource.

Specified by:
findAvailableResourceSubscriptions in interface RepoManagerLocal
Returns:
the list of available repos for the given resource

findResourceSubscriptions

public List<org.rhq.core.domain.content.composite.RepoComposite> findResourceSubscriptions(int resourceId)
Description copied from interface: RepoManagerLocal
Gets all repos that are subscribed to by the given resource.

Specified by:
findResourceSubscriptions in interface RepoManagerLocal
Returns:
the list of subscriptions

findAvailableResourceSubscriptions

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

Specified by:
findAvailableResourceSubscriptions in interface RepoManagerLocal
Returns:
the list of available repos for the given resource

findPackageVersionsInRepo

public 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)
Description copied from interface: RepoManagerLocal
Returns the set of package versions that can currently be accessed via the given repo.

Specified by:
findPackageVersionsInRepo in interface RepoManagerLocal
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

public 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)
Description copied from interface: RepoManagerRemote
Returns the set of package versions that can currently be accessed via the given repo.

Specified by:
findPackageVersionsInRepo in interface RepoManagerLocal
Specified by:
findPackageVersionsInRepo in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
repoId - identifies the repo
filter - A repo filter.
pc - pagination controls
Returns:
the package versions that are available in the repo
See Also:
RepoManagerRemote.findPackageVersionsInRepo(Subject, int, String, PageControl)

getLatestPackageVersion

public org.rhq.core.domain.content.PackageVersion getLatestPackageVersion(org.rhq.core.domain.auth.Subject subject,
                                                                          int packageId,
                                                                          int repoId)
Description copied from interface: RepoManagerRemote
Returns the latest package version of the supplied package. The latest version is determined using a comparator which is found using the following rules:
  1. determine the comparator using the package type behavior if one is setup for the package type
  2. If no package behavior exists, use PackageVersion.DEFAULT_COMPARATOR

Specified by:
getLatestPackageVersion in interface RepoManagerLocal
Specified by:
getLatestPackageVersion in interface RepoManagerRemote
Parameters:
subject - the authenticated user
packageId - the id of the package to find the latest version for.
repoId - the repo where to take the package versions of the package from
Returns:
See Also:
RepoManagerRemote.getLatestPackageVersion(Subject, int, int)

updateRepo

public org.rhq.core.domain.content.Repo updateRepo(org.rhq.core.domain.auth.Subject subject,
                                                   org.rhq.core.domain.content.Repo repo)
                                            throws RepoException
Description copied from interface: RepoManagerRemote
Update an existing Repo object's basic fields, like name, description, etc. Note that the given repo's relationships will be ignored and not merged with the existing repo (e.g. is subscribed resources will not be changed, regardless of what the given repo's subscribed resources set it).

Specified by:
updateRepo in interface RepoManagerLocal
Specified by:
updateRepo in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
repo - to be updated
Returns:
Repo that was updated
Throws:
RepoException
See Also:
RepoManagerRemote.updateRepo(Subject, Repo)

createRepo

public org.rhq.core.domain.content.Repo createRepo(org.rhq.core.domain.auth.Subject subject,
                                                   org.rhq.core.domain.content.Repo repo)
                                            throws RepoException
Description copied from interface: RepoManagerRemote
Creates a new Repo. Note that the created repo will not have any content sources assigned and no resources will be subscribed. It is a virgin repo.

Specified by:
createRepo in interface RepoManagerLocal
Specified by:
createRepo in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
repo - a new repo object.
Returns:
the newly created repo
Throws:
RepoException - if a repo already exists with the same name
See Also:
RepoManagerRemote.createRepo(Subject, Repo)

deleteCandidatesWithOnlyContentSource

public void deleteCandidatesWithOnlyContentSource(org.rhq.core.domain.auth.Subject subject,
                                                  int contentSourceId)
Description copied from interface: RepoManagerLocal
Removes candidate repos whose only content source is the indicated content source.

Specified by:
deleteCandidatesWithOnlyContentSource in interface RepoManagerLocal
Parameters:
subject - user performing the delete
contentSourceId - identifies the content source

processRepoImportReport

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

Specified by:
processRepoImportReport in interface RepoManagerLocal
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

public void importCandidateRepo(org.rhq.core.domain.auth.Subject subject,
                                List<Integer> repoIds)
                         throws RepoException
Description copied from interface: RepoManagerLocal
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.

Specified by:
importCandidateRepo in interface RepoManagerLocal
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

public void removeOwnershipOfSubject(int subjectId)
Description copied from interface: RepoManagerLocal
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.

Specified by:
removeOwnershipOfSubject in interface RepoManagerLocal

createRepoGroup

public org.rhq.core.domain.content.RepoGroup createRepoGroup(org.rhq.core.domain.auth.Subject subject,
                                                             org.rhq.core.domain.content.RepoGroup repoGroup)
                                                      throws RepoException
Description copied from interface: RepoManagerLocal
Creates a new RepoGroup in the server.

Specified by:
createRepoGroup in interface RepoManagerLocal
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

getRepoByName

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

Specified by:
getRepoByName in interface RepoManagerLocal
Parameters:
name - name of the repo to match
Returns:
list of matching repos; presumably of size 0 or 1

getRepoGroupByName

public org.rhq.core.domain.content.RepoGroup getRepoGroupByName(String name)
Description copied from interface: RepoManagerLocal
Returns the repo group with the given name if it exists.

Specified by:
getRepoGroupByName in interface RepoManagerLocal
Parameters:
name - name of the repo group to match
Returns:
repo group with the given name; null if one does not

getRepoGroupTypeByName

public org.rhq.core.domain.content.RepoGroupType getRepoGroupTypeByName(org.rhq.core.domain.auth.Subject subject,
                                                                        String name)
Description copied from interface: RepoManagerLocal
Returns the repo group type with the given name.

Specified by:
getRepoGroupTypeByName in interface RepoManagerLocal
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

addContentSourcesToRepo

public void addContentSourcesToRepo(org.rhq.core.domain.auth.Subject subject,
                                    int repoId,
                                    int[] contentSourceIds)
                             throws Exception
Specified by:
addContentSourcesToRepo in interface RepoManagerLocal
Throws:
Exception

simpleAddContentSourcesToRepo

public void simpleAddContentSourcesToRepo(org.rhq.core.domain.auth.Subject subject,
                                          int repoId,
                                          int[] contentSourceIds)
                                   throws Exception
Description copied from interface: RepoManagerLocal
Associates content sources with the given repo. Unlike RepoManagerLocal.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.

Specified by:
simpleAddContentSourcesToRepo in interface RepoManagerLocal
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

addPackageVersionsToRepo

public void addPackageVersionsToRepo(org.rhq.core.domain.auth.Subject subject,
                                     int repoId,
                                     int[] packageVersionIds)
Description copied from interface: RepoManagerRemote
Associates the package versions (identified by their IDs) to the given repo (also identified by its ID).

Specified by:
addPackageVersionsToRepo in interface RepoManagerLocal
Specified by:
addPackageVersionsToRepo in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
repoId - the ID of the repo
packageVersionIds - the list of package version IDs to add to the repo
See Also:
RepoManagerRemote.addPackageVersionsToRepo(Subject, int, int[])

removeContentSourcesFromRepo

public void removeContentSourcesFromRepo(org.rhq.core.domain.auth.Subject subject,
                                         int repoId,
                                         int[] contentSourceIds)
                                  throws RepoException
Specified by:
removeContentSourcesFromRepo in interface RepoManagerLocal
Throws:
RepoException

subscribeResourceToRepos

public void subscribeResourceToRepos(org.rhq.core.domain.auth.Subject subject,
                                     int resourceId,
                                     int[] repoIds)
Description copied from interface: RepoManagerRemote
Subscribes the identified resource to the set of identified repos. Once complete, the resource will be able to access all package content from all content sources that are assigned to the given repos.

Specified by:
subscribeResourceToRepos in interface RepoManagerLocal
Specified by:
subscribeResourceToRepos in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
resourceId - The id of the resource to be subscribed.
repoIds - A list of repos to which the resource is subscribed.
See Also:
RepoManagerRemote.subscribeResourceToRepos(Subject, int, int[])

unsubscribeResourceFromRepos

public void unsubscribeResourceFromRepos(org.rhq.core.domain.auth.Subject subject,
                                         int resourceId,
                                         int[] repoIds)
Description copied from interface: RepoManagerRemote
Unsubscribes the identified resource from the set of identified repos.

Specified by:
unsubscribeResourceFromRepos in interface RepoManagerLocal
Specified by:
unsubscribeResourceFromRepos in interface RepoManagerRemote
Parameters:
subject - The logged in user's subject.
resourceId - The id of the resource to be subscribed.
repoIds - A list of repos to which the resource is subscribed.
See Also:
RepoManagerRemote.unsubscribeResourceFromRepos(Subject, int, int[])

getPackageVersionCountFromRepo

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

getPackageVersionCountFromRepo

public long getPackageVersionCountFromRepo(org.rhq.core.domain.auth.Subject subject,
                                           int repoId)
Specified by:
getPackageVersionCountFromRepo in interface RepoManagerLocal

findReposByCriteria

public 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)
Description copied from interface: RepoManagerRemote
Returns all repos that match the given criteria.

Specified by:
findReposByCriteria in interface RepoManagerLocal
Specified by:
findReposByCriteria in interface RepoManagerRemote
Parameters:
subject - user making the query
criteria - describes how the query should function; may not be null
Returns:
any repos that match the given criteria; empty list if none match
See Also:
RepoManagerRemote.findPackageVersionsInRepoByCriteria(Subject, PackageVersionCriteria)

findPackageVersionsInRepoByCriteria

public 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)
Specified by:
findPackageVersionsInRepoByCriteria in interface RepoManagerLocal
Specified by:
findPackageVersionsInRepoByCriteria in interface RepoManagerRemote
criteria - Caller must add a valid repoId via PackageVersionCriteria.addFilterRepoId(Integer)}
Returns:
PackageVersions for the repo
See Also:
RepoManagerRemote.findPackageVersionsInRepo(Subject, int, String, PageControl)

addRepoRelationship

public void addRepoRelationship(org.rhq.core.domain.auth.Subject subject,
                                int repoId,
                                int relatedRepoId,
                                String relationshipTypeName)
Description copied from interface: RepoManagerLocal
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.

Specified by:
addRepoRelationship in interface RepoManagerLocal
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

getDistributionCountFromRepo

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

findAssociatedDistributions

public 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)
Specified by:
findAssociatedDistributions in interface RepoManagerLocal
See Also:
RepoManagerRemote#findAssociatedDistributions(Subject, int, PageControl)

findAssociatedAdvisory

public 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)
Specified by:
findAssociatedAdvisory in interface RepoManagerLocal
See Also:
RepoManagerRemote#findAssociatedAdvisory(Subject, int, PageControl)

getAdvisoryCountFromRepo

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

calculateSyncStatus

public String calculateSyncStatus(org.rhq.core.domain.auth.Subject subject,
                                  int repoId)
Description copied from interface: RepoManagerLocal
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

Specified by:
calculateSyncStatus in interface RepoManagerLocal
Parameters:
subject - caller
repoId - to calc status for
Returns:
String summary of the status of this Repository

getMostRecentSyncResults

public org.rhq.core.domain.content.RepoSyncResults getMostRecentSyncResults(org.rhq.core.domain.auth.Subject subject,
                                                                            int repoId)
Description copied from interface: RepoManagerLocal
Get the most recent RepoSyncResults for this Repo

Specified by:
getMostRecentSyncResults in interface RepoManagerLocal
Parameters:
subject - caller
repoId - to fetch most recent sync results for
Returns:
RepoSyncResults if found, null if not

synchronizeRepos

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

Specified by:
synchronizeRepos in interface RepoManagerLocal
Specified by:
synchronizeRepos in interface RepoManagerRemote
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

public int internalSynchronizeRepos(org.rhq.core.domain.auth.Subject subject,
                                    Integer[] repoIds)
                             throws InterruptedException
Description copied from interface: RepoManagerLocal
Performs the actual synchronization of the given repos.

Specified by:
internalSynchronizeRepos in interface RepoManagerLocal
Parameters:
subject - user performing the sync
repoIds - identifies all repos to be syncced
Returns:
number of repos successfully syncced
Throws:
InterruptedException

cancelSync

public void cancelSync(org.rhq.core.domain.auth.Subject subject,
                       int repoId)
                throws ContentException
Description copied from interface: RepoManagerLocal
Cancel any running sync job for the given repo

Specified by:
cancelSync in interface RepoManagerLocal
repoId - you want to cancel the sync for
Throws:
ContentException

persistRepoSyncResults

public org.rhq.core.domain.content.RepoSyncResults persistRepoSyncResults(org.rhq.core.domain.content.RepoSyncResults results)
Description copied from interface: RepoManagerLocal
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.

Specified by:
persistRepoSyncResults in interface RepoManagerLocal
Parameters:
results - the results that should be persisted
Returns:
the persisted object, or null if another sync is currently inprogress.

getRepoSyncResults

public 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)
Description copied from interface: RepoManagerLocal
Allows the caller to page through a list of historical sync results for a content source.

Specified by:
getRepoSyncResults in interface RepoManagerLocal
Parameters:
subject - user asking to perform this
pc - pagination controls
Returns:
the list of results

mergeRepoSyncResults

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

Specified by:
mergeRepoSyncResults in interface RepoManagerLocal
Parameters:
results - the existing results that should be or merged
Returns:
the merged object

getRepoSyncResults

public org.rhq.core.domain.content.RepoSyncResults getRepoSyncResults(int resultsId)
Description copied from interface: RepoManagerLocal
Returns the full sync results object.

Specified by:
getRepoSyncResults in interface RepoManagerLocal
Parameters:
resultsId - the ID of the object to return
Returns:
the full sync results


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