org.rhq.core.domain.content
Class Repo

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

public class Repo
extends Object
implements Serializable

A repo represents a set of related PackageVersions. The packages in this repo are populated by its ContentSources. The relationship with content sources is weak; that is, content sources can come and go, even as the packages contained in the repo remain.

See Also:
Serialized Form

Field Summary
static String QUERY_CHECK_REPO_OWNED_BY_SUBJECT_ID
           
static String QUERY_CHECK_REPO_VISIBLE_BY_SUBJECT_ID
           
static String QUERY_FIND_ALL_IMPORTED_REPOS
           
static String QUERY_FIND_ALL_IMPORTED_REPOS_ADMIN
           
static String QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID
           
static String QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_ADMIN
           
static String QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_ADMIN_COUNT
           
static String QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_COUNT
           
static String QUERY_FIND_BY_IDS
           
static String QUERY_FIND_BY_NAME
           
static String QUERY_FIND_CANDIDATE_BY_CONTENT_SOURCE_ID
           
static String QUERY_FIND_CANDIDATES_WITH_ONLY_CONTENT_SOURCE
           
static String QUERY_FIND_IMPORTED_BY_CONTENT_SOURCE_ID
           
static String QUERY_FIND_IMPORTED_BY_CONTENT_SOURCE_ID_FETCH_CCS
           
static String QUERY_FIND_REPO_COMPOSITES_BY_RESOURCE_ID
           
static String QUERY_FIND_REPO_COMPOSITES_BY_RESOURCE_ID_COUNT
           
static String QUERY_FIND_REPOS_BY_RESOURCE_ID
           
static String QUERY_FIND_SUBSCRIBER_RESOURCES
           
static String QUERY_UPDATE_REMOVE_OWNER_FROM_REPOS_OWNED_BY_SUBJECT
           
 
Constructor Summary
Repo()
           
Repo(String name)
           
 
Method Summary
 RepoContentSource addContentSource(ContentSource contentSource)
          Directly assign a content source to this repo.
 RepoPackageVersion addPackageVersion(PackageVersion packageVersion)
          Directly assign a package version to this repo.
 RepoRepoGroup addRepoGroup(RepoGroup repoGroup)
          Directly assign a repogroup to this repo.
 RepoRepoRelationship addRepoRelationship(RepoRelationship repoRelationship)
          Directly assign a reporelationship to this repo.
 ResourceRepo addResource(Resource resource)
          Directly subscribe a resource to this repo.
 void addSyncResult(RepoSyncResults syncResult)
           
 boolean equals(Object obj)
           
 Set<ContentSource> getContentSources()
          The content sources that this repo serves up.
 long getCreationDate()
          Timestamp of when this repo was created.
 String getDescription()
          User specified description of the repo.
 int getId()
           
 long getLastModifiedDate()
          Timestamp of the last time the sources of this repo was changed.
 String getName()
          Programmatic name of the repo.
 Subject getOwner()
           
 Set<PackageVersion> getPackageVersions()
          The package versions that this repo serves up.
 Set<RepoAdvisory> getRepoAdvisories()
           
 Set<RepoContentSource> getRepoContentSources()
          Returns the explicit mapping entities.
 Set<RepoDistribution> getRepoDistributions()
          Returns the explicit mapping entities.
 Set<RepoGroup> getRepoGroups()
          The repogroups that this repo belongs to.
 Set<RepoPackageVersion> getRepoPackageVersions()
          Returns the explicit mapping entities.
 Set<RepoRelationship> getRepoRelationships()
          The reporelationships that this repo belongs to.
 Set<RepoRepoGroup> getRepoRepoGroups()
          Returns the explicit mapping entities.
 Set<RepoRepoRelationship> getRepoRepoRelationships()
          Returns the explicit mapping entities.
 Set<ResourceRepo> getResourceRepos()
          Returns the explicit mapping entities.
 Set<Resource> getResources()
          The resources subscribed to this repo.
 List<RepoSyncResults> getSyncResults()
          The list of sync results - order ENSURED by the incrementing ID of this object
 String getSyncSchedule()
          Periodically, the Repo will be asked to synchronize with the remote ContentProviders associated with it This attribute defines the schedule, as a cron string.
 String getSyncStatus()
          Get the overall sync status of this Repository.
 int hashCode()
           
 boolean isCandidate()
          Indicates if the repo is an imported (i.e. subscribable) repo in RHQ or is just a candidate for import, such as those introduced by a content source.
 boolean isPrivate()
          Private repositories are only accessible by their owners or RepositoryManagers.
 RepoContentSource removeContentSource(ContentSource contentSource)
          Removes the content source from this repo, if it exists.
 RepoPackageVersion removePackageVersion(PackageVersion packageVersion)
          Removes the package version from this repo, if it exists.
 RepoRepoGroup removeRepoGroup(RepoGroup repoGroup)
          Removes association with a repo group, if it exists.
 RepoRepoRelationship removeRepoRelationship(RepoRelationship repoRelationship)
          Removes association with a repo relationship, if it exists.
 ResourceRepo removeResource(Resource resource)
          Unsubscribes the resource from this repo, if it exists.
 void setCandidate(boolean candidate)
           
 void setCreationDate(long creationDate)
           
 void setDescription(String description)
           
 void setId(int id)
           
 void setLastModifiedDate(long lastModifiedDate)
           
 void setName(String name)
           
 void setOwner(Subject owner)
           
 void setPrivate(boolean priv)
           
 void setRepoAdvisories(Set<RepoAdvisory> repoAdvisories)
           
 void setSyncSchedule(String syncSchedule)
           
 void setSyncStatus(String syncStatusIn)
          Set the sync status for this repo.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_FIND_ALL_IMPORTED_REPOS_ADMIN

public static final String QUERY_FIND_ALL_IMPORTED_REPOS_ADMIN
See Also:
Constant Field Values

QUERY_FIND_ALL_IMPORTED_REPOS

public static final String QUERY_FIND_ALL_IMPORTED_REPOS
See Also:
Constant Field Values

QUERY_FIND_BY_IDS

public static final String QUERY_FIND_BY_IDS
See Also:
Constant Field Values

QUERY_FIND_BY_NAME

public static final String QUERY_FIND_BY_NAME
See Also:
Constant Field Values

QUERY_FIND_IMPORTED_BY_CONTENT_SOURCE_ID_FETCH_CCS

public static final String QUERY_FIND_IMPORTED_BY_CONTENT_SOURCE_ID_FETCH_CCS
See Also:
Constant Field Values

QUERY_FIND_IMPORTED_BY_CONTENT_SOURCE_ID

public static final String QUERY_FIND_IMPORTED_BY_CONTENT_SOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_CANDIDATE_BY_CONTENT_SOURCE_ID

public static final String QUERY_FIND_CANDIDATE_BY_CONTENT_SOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_SUBSCRIBER_RESOURCES

public static final String QUERY_FIND_SUBSCRIBER_RESOURCES
See Also:
Constant Field Values

QUERY_FIND_REPOS_BY_RESOURCE_ID

public static final String QUERY_FIND_REPOS_BY_RESOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_REPO_COMPOSITES_BY_RESOURCE_ID

public static final String QUERY_FIND_REPO_COMPOSITES_BY_RESOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_REPO_COMPOSITES_BY_RESOURCE_ID_COUNT

public static final String QUERY_FIND_REPO_COMPOSITES_BY_RESOURCE_ID_COUNT
See Also:
Constant Field Values

QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_ADMIN

public static final String QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_ADMIN
See Also:
Constant Field Values

QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_ADMIN_COUNT

public static final String QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_ADMIN_COUNT
See Also:
Constant Field Values

QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID

public static final String QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID
See Also:
Constant Field Values

QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_COUNT

public static final String QUERY_FIND_AVAILABLE_REPO_COMPOSITES_BY_RESOURCE_ID_COUNT
See Also:
Constant Field Values

QUERY_FIND_CANDIDATES_WITH_ONLY_CONTENT_SOURCE

public static final String QUERY_FIND_CANDIDATES_WITH_ONLY_CONTENT_SOURCE
See Also:
Constant Field Values

QUERY_CHECK_REPO_VISIBLE_BY_SUBJECT_ID

public static final String QUERY_CHECK_REPO_VISIBLE_BY_SUBJECT_ID
See Also:
Constant Field Values

QUERY_CHECK_REPO_OWNED_BY_SUBJECT_ID

public static final String QUERY_CHECK_REPO_OWNED_BY_SUBJECT_ID
See Also:
Constant Field Values

QUERY_UPDATE_REMOVE_OWNER_FROM_REPOS_OWNED_BY_SUBJECT

public static final String QUERY_UPDATE_REMOVE_OWNER_FROM_REPOS_OWNED_BY_SUBJECT
See Also:
Constant Field Values
Constructor Detail

Repo

public Repo()

Repo

public Repo(String name)
Method Detail

getId

public int getId()

setId

public void setId(int id)

getName

public String getName()
Programmatic name of the repo.


setName

public void setName(String name)

getDescription

public String getDescription()
User specified description of the repo.


setDescription

public void setDescription(String description)

getCreationDate

public long getCreationDate()
Timestamp of when this repo was created.


setCreationDate

public void setCreationDate(long creationDate)

getLastModifiedDate

public long getLastModifiedDate()
Timestamp of the last time the sources of this repo was changed. It is not necessarily the last time any other part of this repo object was changed (for example, this last modified date does not necessarily correspond to the time when the description was modified).


setLastModifiedDate

public void setLastModifiedDate(long lastModifiedDate)

isCandidate

public boolean isCandidate()
Indicates if the repo is an imported (i.e. subscribable) repo in RHQ or is just a candidate for import, such as those introduced by a content source.


setCandidate

public void setCandidate(boolean candidate)

getSyncSchedule

public String getSyncSchedule()
Periodically, the Repo will be asked to synchronize with the remote ContentProviders associated with it This attribute defines the schedule, as a cron string. The default will be set for everyday at 3:00am local time. If this content source should never automatically sync, this should be null, but an empty string would also indicate this, too.

Returns:
sync schedule as a cron string or null if the sync should not automatically occur

setSyncSchedule

public void setSyncSchedule(String syncSchedule)

getResourceRepos

public Set<ResourceRepo> getResourceRepos()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getResources()

getResources

public Set<Resource> getResources()
The resources subscribed to this repo.

The returned set is not backed by this entity - if you want to alter the set of associated resources, use getResourceRepos() or addResource(Resource), removeResource(Resource).


addResource

public ResourceRepo addResource(Resource resource)
Directly subscribe a resource to this repo.

Parameters:
resource -
Returns:
the mapping that was added

removeResource

public ResourceRepo removeResource(Resource resource)
Unsubscribes the resource from this repo, if it exists. If it was already subscribed, the mapping that was removed is returned; if not, null is returned.

Parameters:
resource - the resource to unsubscribe from this repo
Returns:
the mapping that was removed or null if the resource was not subscribed to this repo

getRepoContentSources

public Set<RepoContentSource> getRepoContentSources()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getContentSources()

getRepoDistributions

public Set<RepoDistribution> getRepoDistributions()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getContentSources()

getRepoAdvisories

public Set<RepoAdvisory> getRepoAdvisories()

setRepoAdvisories

public void setRepoAdvisories(Set<RepoAdvisory> repoAdvisories)

getSyncStatus

public String getSyncStatus()
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

Returns:
String summary of the status of this Repository

getContentSources

public Set<ContentSource> getContentSources()
The content sources that this repo serves up. These are the content sources that provide or provided packages for this repo. This relationship is weak; a content source may not be in this set but the packages it loaded into this repo may still exist.

The returned set is not backed by this entity - if you want to alter the set of associated content sources, use getRepoContentSources() or addContentSource(ContentSource), removeContentSource(ContentSource).


addContentSource

public RepoContentSource addContentSource(ContentSource contentSource)
Directly assign a content source to this repo.

Parameters:
contentSource -
Returns:
the mapping that was added

removeContentSource

public RepoContentSource removeContentSource(ContentSource contentSource)
Removes the content source from this repo, if it exists. If it does exist, the mapping that was removed is returned; if the given content source did not exist as one that is a member of this repo, null is returned.

Parameters:
contentSource - the content source to remove from this repo
Returns:
the mapping that was removed or null if the content source was not mapped to this repo

getRepoPackageVersions

public Set<RepoPackageVersion> getRepoPackageVersions()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getPackageVersions()

getPackageVersions

public Set<PackageVersion> getPackageVersions()
The package versions that this repo serves up. Subscribers to this repo will have access to the returned set of package versions. These are package versions that were directly assigned to the repo and those that were assigned via its relationship with its content sources. This is the relationship that should be consulted when determining what package versions this repo exposes - do not look at the indirect relationship from content sources to package versions. When content sources are assigned to this repo, this package version relationship will be automatically managed.

The returned set is not backed by this entity - if you want to alter the set of associated package versions, use getRepoPackageVersions() or addPackageVersion(PackageVersion), removePackageVersion(PackageVersion).


addPackageVersion

public RepoPackageVersion addPackageVersion(PackageVersion packageVersion)
Directly assign a package version to this repo.

Parameters:
packageVersion -
Returns:
the mapping that was added

removePackageVersion

public RepoPackageVersion removePackageVersion(PackageVersion packageVersion)
Removes the package version from this repo, if it exists. If it does exist, the mapping that was removed is returned; if the given package version did not exist as one that is a member of this repo, null is returned.

Parameters:
packageVersion - the package version to remove from this repo
Returns:
the mapping that was removed or null if the package version was not mapped to this repo

getRepoRepoGroups

public Set<RepoRepoGroup> getRepoRepoGroups()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getRepoGroups()

getRepoGroups

public Set<RepoGroup> getRepoGroups()
The repogroups that this repo belongs to.

The returned set is not backed by this entity - if you want to alter the set of associated repogroups, use getRepoRepoGroups() or addRepoGroup(RepoGroup), removeRepoGroup(RepoGroup).


addRepoGroup

public RepoRepoGroup addRepoGroup(RepoGroup repoGroup)
Directly assign a repogroup to this repo.

Parameters:
repoGroup -
Returns:
the mapping that was added

removeRepoGroup

public RepoRepoGroup removeRepoGroup(RepoGroup repoGroup)
Removes association with a repo group, if it exists. If it does exist, the mapping that was removed is returned; if the given repo group did not exist as one that is a associated to this repo, null is returned.

Parameters:
repoGroup - the repo group to disassociate from this repo
Returns:
the mapping that was removed or null if the repo group was not associated with this repo

getRepoRepoRelationships

public Set<RepoRepoRelationship> getRepoRepoRelationships()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
getRepoRelationships()

getRepoRelationships

public Set<RepoRelationship> getRepoRelationships()
The reporelationships that this repo belongs to.

The returned set is not backed by this entity - if you want to alter the set of associated repoRelationships, use getRepoRepoRelationships() or addRepoRelationship(RepoRelationship), removeRepoRelationship(RepoRelationship).


addRepoRelationship

public RepoRepoRelationship addRepoRelationship(RepoRelationship repoRelationship)
Directly assign a reporelationship to this repo.

Parameters:
repoRelationship -
Returns:
the mapping that was added

removeRepoRelationship

public RepoRepoRelationship removeRepoRelationship(RepoRelationship repoRelationship)
Removes association with a repo relationship, if it exists. If it does exist, the mapping that was removed is returned; if the given repo relationship did not exist as one that is a associated to this repo, null is returned.

Parameters:
repoRelationship - the repo relationship to disassociate from this repo
Returns:
the mapping that was removed or null if the repo relationship was not associated with this repo

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

setSyncStatus

public void setSyncStatus(String syncStatusIn)
Set the sync status for this repo.

Parameters:
syncStatusIn -

addSyncResult

public void addSyncResult(RepoSyncResults syncResult)

getSyncResults

@NotNull
public List<RepoSyncResults> getSyncResults()
The list of sync results - order ENSURED by the incrementing ID of this object


getOwner

public Subject getOwner()
Returns:
the owner

setOwner

public void setOwner(Subject owner)
Parameters:
owner - the owner to set

isPrivate

public boolean isPrivate()
Private repositories are only accessible by their owners or RepositoryManagers. Private repositories without an owner are only accessible by the RepositoryManagers.

A public repository (whether owned by a specific user or not) is accessible by anyone.

Returns:
whether this repository is private

setPrivate

public void setPrivate(boolean priv)
See Also:
isPrivate()


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