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_CHANNEL_ID
           
static String QUERY_FIND_BY_CHANNEL_ID
           
static String QUERY_FIND_BY_ID_WITH_CONFIG
           
static String QUERY_FIND_BY_NAME_AND_TYPENAME
           
 
Constructor Summary
ContentSource()
           
ContentSource(String name, ContentSourceType contentSourceType)
           
 
Method Summary
 ChannelContentSource addChannel(Channel channel)
          Directly assign a channel to this content source.
 void addSyncResult(ContentSourceSyncResults syncResult)
           
 boolean equals(Object obj)
           
 Set<ChannelContentSource> getChannelContentSources()
          Returns the explicit mapping entities.
 Set<Channel> getChannels()
          The channels that this content source provides content to.
 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 channel source.
 List<ContentSourceSyncResults> getSyncResults()
          The list of sync results; should be ordered with the latest results first in the list, but this is not guaranteed.
 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.
 ChannelContentSource removeChannel(Channel channel)
          Removes the channel 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_CHANNEL_ID

public static final String QUERY_FIND_BY_CHANNEL_ID
See Also:
Constant Field Values

QUERY_FIND_AVAILABLE_BY_CHANNEL_ID

public static final String QUERY_FIND_AVAILABLE_BY_CHANNEL_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 channel 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; should be ordered with the latest results first in the list, but this is not guaranteed.


addSyncResult

public void addSyncResult(ContentSourceSyncResults syncResult)

setSyncResults

public void setSyncResults(List<ContentSourceSyncResults> syncResults)

getChannelContentSources

public Set<ChannelContentSource> getChannelContentSources()
Returns the explicit mapping entities.

Returns:
the mapping entities
See Also:
#getContentSources()

getChannels

public Set<Channel> getChannels()
The channels 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 channels, use getChannelContentSources() or addChannel(Channel), removeChannel(Channel).


addChannel

public ChannelContentSource addChannel(Channel channel)
Directly assign a channel to this content source.

Parameters:
channel -
Returns:
the mapping that was added

removeChannel

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

Parameters:
channel - the channel to remove from this content source
Returns:
the mapping that was removed or null if the channel 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-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.