org.rhq.core.domain.content
Class ContentSource

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

public class ContentSource
extends Object
implements Serializable

Represents a real connection to an external source system. The type of external source system is described by the ContentSourceType attribute of this class. The other attributes in this class serve to configure and control the connection to the package source.

See Also:
Serialized Form

Field Summary
static String QUERY_FIND_ALL
           
static String QUERY_FIND_ALL_WITH_CONFIG
           
static String QUERY_FIND_AVAILABLE_BY_REPO_ID
           
static String QUERY_FIND_BY_ID_WITH_CONFIG
           
static String QUERY_FIND_BY_NAME_AND_TYPENAME
           
static String QUERY_FIND_BY_REPO_ID
           
 
Constructor Summary
ContentSource()
           
ContentSource(String name, ContentSourceType contentSourceType)
           
 
Method Summary
 RepoContentSource addRepo(Repo repo)
          Directly assign a repo to this content source.
 void addSyncResult(ContentSourceSyncResults syncResult)
           
 boolean equals(Object obj)
           
 Configuration getConfiguration()
          Values that dictate how this content source will function.
 ContentSourceType getContentSourceType()
          Describes the capabilities of this content source.
 long getCreationDate()
          Timestamp of when this content source was created.
 String getDescription()
          User defined description to help distinguish the content source in the UI.
 DownloadMode getDownloadMode()
          Download mode indicates where (and even if) package bits are downloaded, when they are downloaded.
 int getId()
           
 long getLastModifiedDate()
          Timestamp of the last time the configuration of this content source was changed.
 String getLoadErrorMessage()
          If not null, this will be an error message to indicate what errors occurred during the last attempt to load package bits from this content source.
 String getName()
          User defined programmatic name of this repo source.
 Set<RepoContentSource> getRepoContentSources()
          Returns the explicit mapping entities.
 Set<Repo> getRepos()
          The repos that this content source provides content to.
 List<ContentSourceSyncResults> getSyncResults()
          The list of sync results - order not ensured
 String getSyncSchedule()
          Periodically, the content source plugin adapter will be asked to synchronize with the remote content source repository.
 int hashCode()
           
 boolean isLazyLoad()
          If true, the content bits for all packages coming from this content source will only be loaded on demand.
 RepoContentSource removeRepo(Repo repo)
          Removes the repo from this content source, if it exists.
 void setConfiguration(Configuration configuration)
           
 void setContentSourceType(ContentSourceType contentSourceType)
           
 void setCreationDate(long creationDate)
           
 void setDescription(String description)
           
 void setDownloadMode(DownloadMode downloadMode)
           
 void setId(int id)
           
 void setLastModifiedDate(long lastModifiedDate)
           
 void setLazyLoad(boolean lazyLoad)
           
 void setLoadErrorMessage(String loadErrorMessage)
           
 void setName(String name)
           
 void setSyncResults(List<ContentSourceSyncResults> syncResults)
           
 void setSyncSchedule(String syncSchedule)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_FIND_ALL

public static final String QUERY_FIND_ALL
See Also:
Constant Field Values

QUERY_FIND_ALL_WITH_CONFIG

public static final String QUERY_FIND_ALL_WITH_CONFIG
See Also:
Constant Field Values

QUERY_FIND_BY_NAME_AND_TYPENAME

public static final String QUERY_FIND_BY_NAME_AND_TYPENAME
See Also:
Constant Field Values

QUERY_FIND_BY_ID_WITH_CONFIG

public static final String QUERY_FIND_BY_ID_WITH_CONFIG
See Also:
Constant Field Values

QUERY_FIND_BY_REPO_ID

public static final String QUERY_FIND_BY_REPO_ID
See Also:
Constant Field Values

QUERY_FIND_AVAILABLE_BY_REPO_ID

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

ContentSource

public ContentSource()

ContentSource

public ContentSource(String name,
                     ContentSourceType contentSourceType)
Method Detail

getId

public int getId()

setId

public void setId(int id)

getContentSourceType

public ContentSourceType getContentSourceType()
Describes the capabilities of this content source.


setContentSourceType

public void setContentSourceType(ContentSourceType contentSourceType)

getName

public String getName()
User defined programmatic name of this repo source. This name should not contain spaces or special characters.


setName

public void setName(String name)

getDescription

public String getDescription()
User defined description to help distinguish the content source in the UI.


setDescription

public void setDescription(String description)

isLazyLoad

public boolean isLazyLoad()
If true, the content bits for all packages coming from this content source will only be loaded on demand. This means the package contents will only be loaded when they are asked for the very first time. If false, the content source should attempt to download all packages as soon as possible.


setLazyLoad

public void setLazyLoad(boolean lazyLoad)

getDownloadMode

public DownloadMode getDownloadMode()
Download mode indicates where (and even if) package bits are downloaded, when they are downloaded. Note that if this value is DownloadMode.NEVER, isLazyLoad() is effectively ignored since package bits will never be loaded.

Returns:
the download mode

setDownloadMode

public void setDownloadMode(DownloadMode downloadMode)

getSyncSchedule

public String getSyncSchedule()
Periodically, the content source plugin adapter will be asked to synchronize with the remote content source repository. This gives the adapter a chance to see if any content has been added, updated or removed from the remote repository. 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)

getLoadErrorMessage

public String getLoadErrorMessage()
If not null, this will be an error message to indicate what errors occurred during the last attempt to load package bits from this content source. If null, either no error occurred or this content source has yet to attempt to load package bits for any of its packages.


setLoadErrorMessage

public void setLoadErrorMessage(String loadErrorMessage)

getConfiguration

public Configuration getConfiguration()
Values that dictate how this content source will function. These values fulfill the configuration definition defined in the content source type associated with this instance. In other words, these values indicate what underlying source of packages to use and how to connect to it.


setConfiguration

public void setConfiguration(Configuration configuration)

getCreationDate

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


setCreationDate

public void setCreationDate(long creationDate)

getLastModifiedDate

public long getLastModifiedDate()
Timestamp of the last time the configuration of this content source was changed. It is not necessarily the last time any other part of this content source 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)

getSyncResults

public List<ContentSourceSyncResults> getSyncResults()
The list of sync results - order not ensured


addSyncResult

public void addSyncResult(ContentSourceSyncResults syncResult)

setSyncResults

public void setSyncResults(List<ContentSourceSyncResults> syncResults)

getRepoContentSources

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

Returns:
the mapping entities
See Also:
getRepoContentSources()

getRepos

public Set<Repo> getRepos()
The repos that this content source provides content to.

The returned set is not backed by this entity - if you want to alter the set of associated repos, use getRepoContentSources() or addRepo(Repo), removeRepo(Repo).


addRepo

public RepoContentSource addRepo(Repo repo)
Directly assign a repo to this content source.

Parameters:
repo -
Returns:
the mapping that was added

removeRepo

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

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

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


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