Class RssChannel


  • public class RssChannel
    extends java.lang.Object
    This class implements a RSS Channel parser/container.
    Version:
    $Revision: 106888 $
    • Constructor Detail

      • RssChannel

        public RssChannel​(java.lang.String url,
                          long ufreq)
                   throws RssException
        Create a new RssChannel. Fill this object with the data located at the given URI. Set the update frequency.
        Parameters:
        url - the URL of the RSS channel (a remote location using http or https)
        ufreq - the update frequency, in minutes
        Throws:
        RssException - if an error occured while getting or parsing the RSS
      • RssChannel

        public RssChannel​(java.lang.String url,
                          long ufreq,
                          int timeout)
                   throws RssException
        Create a new RssChannel. Fill this object with the data located at the given URI. Set the update frequency.
        Parameters:
        url - the URL of the RSS channel (a remote location using http or https)
        ufreq - the update frequency, in minutes
        timeout - the time (in milliseconds) to wait for a connection to become available. Default value is 3000 (3 seconds). Default value will be used if zero or a negative value is specified.
        Throws:
        RssException - if an error occured while getting or parsing the RSS
      • RssChannel

        public RssChannel​(java.io.File file)
                   throws RssException
        Create a new RssChannel. Fill this object with the data located at the given URI. Set the update frequency.
        Parameters:
        file - the RSS XML file to read
        Throws:
        RssException - if an error occured while reading or parsing the RSS
      • RssChannel

        public RssChannel​(java.lang.String url,
                          long ufreq,
                          java.util.Set<RssEventListener> eventListeners)
                   throws RssException
        Create a new RssChannel. Fill this object with the data located at the given URI. Set the update frequency.
        Parameters:
        url - the URL of the RSS channel (a remote location using http or https)
        ufreq - the update frequency, in minutes
        eventListeners - Set of RssEventListener
        Throws:
        RssException - if an error occured while getting or parsing the RSS
        Since:
        JCMS 6.3
      • RssChannel

        public RssChannel​(java.lang.String url,
                          long ufreq,
                          int timeout,
                          java.util.Set<RssEventListener> eventListeners)
                   throws RssException
        Create a new RssChannel. Fill this object with the data located at the given URI. Set the update frequency.
        Parameters:
        url - the URL of the RSS channel (a remote location using http or https)
        ufreq - the update frequency, in minutes
        timeout - the time (in milliseconds) to wait for a connection to become available. Default value is 3000 (3 seconds). Default value will be used if zero or a negative value is specified.
        eventListeners - Set of RssEventListener
        Throws:
        RssException - if an error occured while getting or parsing the RSS
        Since:
        JCMS 6.3
      • RssChannel

        public RssChannel​(java.io.File file,
                          java.util.Set<RssEventListener> eventListeners)
                   throws RssException
        Create a new RssChannel. Fill this object with the data located at the given URI. Set the update frequency.
        Parameters:
        file - the RSS XML file to read
        eventListeners - Set of RssEventListener
        Throws:
        RssException - if an error occured while reading or parsing the RSS
        Since:
        JCMS 6.3
    • Method Detail

      • needToRefresh

        public boolean needToRefresh()
        Determine if the channel must be refreshed
        Returns:
        true if the channel must be refreshed
      • getLastUpdate

        public java.util.Date getLastUpdate()
        Retrieve the Date at which this RssChannel was last build and parsed.
        Returns:
        the last update Date.
      • getNextUpdate

        public java.util.Date getNextUpdate()
        Retrieve the Date at which this RssChannel should be left and parsed again.
        Returns:
        the next update Date == last update + (ttl || ufreq).
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getVersion

        public java.lang.String getVersion()
        Retrieve the RSS version of this channel (such as 0.91, 1.0 for rdf, 2.0, ...).
        Returns:
        the rss version.
      • setVersion

        public void setVersion​(java.lang.String version)
        Set the RSS version of this channel.
        Parameters:
        version - the rss version (such as 0.91, 1.0 for rdf, 2.0, ...)
      • getTitle

        public java.lang.String getTitle()
        Retrieve the title of this RSS.
        Returns:
        the rss' title.
      • setTitle

        public void setTitle​(java.lang.String title)
        Set the title of this RSS.
        Parameters:
        title - the new title value
      • getLink

        public java.lang.String getLink()
        Get the value of link.
        Returns:
        Value of link.
      • setLink

        public void setLink​(java.lang.String v)
        Set the value of link.
        Parameters:
        v - Value to assign to link.
      • getDescription

        public java.lang.String getDescription()
        Get the value of description.
        Returns:
        Value of description.
      • setDescription

        public void setDescription​(java.lang.String v)
        Set the value of description.
        Parameters:
        v - Value to assign to description.
      • getRating

        public java.lang.String getRating()
        Get the value of rating.
        Returns:
        Value of rating.
      • setRating

        public void setRating​(java.lang.String v)
        Set the value of rating.
        Parameters:
        v - Value to assign to rating.
      • getLanguage

        public java.lang.String getLanguage()
        Get the value of language.
        Returns:
        Value of language.
      • setLanguage

        public void setLanguage​(java.lang.String v)
        Set the value of language.
        Parameters:
        v - Value to assign to language.
      • getCopyright

        public java.lang.String getCopyright()
        Get the value of copyright.
        Returns:
        Value of copyright.
      • setCopyright

        public void setCopyright​(java.lang.String v)
        Set the value of copyright.
        Parameters:
        v - Value to assign to copyright.
      • getManagingEditor

        public java.lang.String getManagingEditor()
        Get the value of managingEditor.
        Returns:
        Value of managingEditor.
      • setManagingEditor

        public void setManagingEditor​(java.lang.String v)
        Set the value of managingEditor.
        Parameters:
        v - Value to assign to managingEditor.
      • getWebMaster

        public java.lang.String getWebMaster()
        Get the value of webMaster.
        Returns:
        Value of webMaster.
      • setWebMaster

        public void setWebMaster​(java.lang.String v)
        Set the value of webMaster.
        Parameters:
        v - Value to assign to webMaster.
      • getImageTitle

        public java.lang.String getImageTitle()
        Get the value of imageTitle.
        Returns:
        Value of imageTitle.
      • setImageTitle

        public void setImageTitle​(java.lang.String v)
        Set the value of imageTitle.
        Parameters:
        v - Value to assign to imageTitle.
      • getImageUrl

        public java.lang.String getImageUrl()
        Get the value of imageUrl.
        Returns:
        Value of imageUrl.
      • setImageUrl

        public void setImageUrl​(java.lang.String v)
        Set the value of imageUrl.
        Parameters:
        v - Value to assign to imageUrl.
      • getImageLink

        public java.lang.String getImageLink()
        Get the value of imageLink.
        Returns:
        Value of imageLink.
      • setImageLink

        public void setImageLink​(java.lang.String val)
        Set the value of imageLink.
        Parameters:
        val - Value to assign to imageLink.
      • setImageWidthStr

        public void setImageWidthStr​(java.lang.String widthStr)
        Set the value of imageWidth.
        Parameters:
        widthStr - Value to assign to imageWidth.
      • getImageWidth

        public int getImageWidth()
        Get the value of imageWidth.
        Returns:
        Value of imageWidth.
      • setImageWidth

        public void setImageWidth​(int v)
        Set the value of imageWidth.
        Parameters:
        v - Value to assign to imageWidth.
      • setImageHeightStr

        public void setImageHeightStr​(java.lang.String heightStr)
        Set the value of imageHeight.
        Parameters:
        heightStr - Value to assign to imageHeight.
      • getImageHeight

        public int getImageHeight()
        Get the value of imageHeight.
        Returns:
        Value of imageHeight.
      • setImageHeight

        public void setImageHeight​(int v)
        Set the value of imageHeight.
        Parameters:
        v - Value to assign to imageHeight.
      • getImageDescription

        public java.lang.String getImageDescription()
        Get the value of imageDescription.
        Returns:
        Value of imageDescription.
      • setImageDescription

        public void setImageDescription​(java.lang.String v)
        Set the value of imageDescription.
        Parameters:
        v - Value to assign to imageDescription.
      • getTextinputTitle

        public java.lang.String getTextinputTitle()
        Get the value of textinputTitle.
        Returns:
        Value of textinputTitle.
      • setTextinputTitle

        public void setTextinputTitle​(java.lang.String v)
        Set the value of textinputTitle.
        Parameters:
        v - Value to assign to textinputTitle.
      • getTextinputDescription

        public java.lang.String getTextinputDescription()
        Get the value of textinputDescription.
        Returns:
        Value of textinputDescription.
      • setTextinputDescription

        public void setTextinputDescription​(java.lang.String v)
        Set the value of textinputDescription.
        Parameters:
        v - Value to assign to textinputDescription.
      • getTextinputName

        public java.lang.String getTextinputName()
        Get the value of textinputName.
        Returns:
        Value of textinputName.
      • setTextinputName

        public void setTextinputName​(java.lang.String v)
        Set the value of textinputName.
        Parameters:
        v - Value to assign to textinputName.
      • getTextinputLink

        public java.lang.String getTextinputLink()
        Get the value of textinputLink.
        Returns:
        Value of textinputLink.
      • setTextinputLink

        public void setTextinputLink​(java.lang.String v)
        Set the value of textinputLink.
        Parameters:
        v - Value to assign to textinputLink.
      • getPubDate

        @Deprecated
        public java.lang.String getPubDate()
        Deprecated.
        Get the value of pubDate. This method is deprecated. getPublicationDate must be use instead This method returns date in ISO 8601 format
        Returns:
        Value of pubDate.
      • setPubDate

        @Deprecated
        public void setPubDate​(java.lang.String v)
        Deprecated.
        Set the value of pubDate. This methos is deprecated and setPublication(Date date) must be use instead
        Parameters:
        v - Value to assign to pubDate.
      • getLastBuildDate

        @Deprecated
        public java.lang.String getLastBuildDate()
        Deprecated.
        Get the value of lastBuildDate.This method is deprecated. getBuildDate must be use instead This method returns date in ISO 8601 format
        Returns:
        Value of lastBuildDate.
      • setLastBuildDate

        @Deprecated
        public void setLastBuildDate​(java.lang.String v)
        Deprecated.
        Set the value of lastBuildDate. This methos is deprecated and setBuildDate(Date date) must be use instead
        Parameters:
        v - Value to assign to lastBuildDate.
      • getBuildDate

        public java.util.Date getBuildDate()
        Returns:
        the buildDate
      • setBuildDate

        public void setBuildDate​(java.util.Date buildDate)
        Parameters:
        buildDate - the buildDate to set
      • getDocs

        public java.lang.String getDocs()
        Get the value of docs.
        Returns:
        Value of docs.
      • setDocs

        public void setDocs​(java.lang.String v)
        Set the value of docs.
        Parameters:
        v - Value to assign to docs.
      • getItemList

        public java.util.List<RssItem> getItemList()
        Retrieve the list of RssItem of this feed.
        Returns:
        a list of RssItem, never return null.
      • setItemList

        public void setItemList​(java.util.List<RssItem> list)
        Set the list of RssItem of this feed.
        Parameters:
        list - a list list of RssItem, must not be null
      • getTtl

        public long getTtl()
        Retrieve the number of minutes indicating how long this channel can be cached before being refreshed from the source.
        Returns:
        the "time to live" in minutes.
      • setTtl

        public void setTtl​(long ttl)
        Set the time to live of this RssChannel
        Parameters:
        ttl - time to live in minutes.
      • setTtl

        public void setTtl​(java.lang.String ttlStr)
        Set the time to live of this RssChannel
        Parameters:
        ttlStr - time to live in minutes.
      • getUfreq

        public long getUfreq()
        Retrieve the update frequency of this RssChannel.
        Returns:
        the update frequency in minutes.
      • setUfreq

        public void setUfreq​(long ufreq)
        Set the update frequency of this RssChannel.
        Parameters:
        ufreq - the new update frequency value, in minutes.
      • getSource

        public java.lang.String getSource()
        Retrieve the source of this RssChannel (used only for debugging purpose).
        Returns:
        source of the channel (url or file path)
      • getPublicationDate

        public java.util.Date getPublicationDate()
        Returns:
        the publicationDate
      • setPublicationDate

        public void setPublicationDate​(java.util.Date publicationDate)
        Parameters:
        publicationDate - the publicationDate to set
      • getId

        public java.lang.String getId()
        Returns:
        the id
      • setId

        public void setId​(java.lang.String id)
        Parameters:
        id - the id to set
      • convertDate

        public static java.util.Date convertDate​(java.lang.String date)
      • setListeners

        public void setListeners​(java.util.Set<RssEventListener> listeners)
        Parameters:
        listeners - the RssEventListener Set to set
        Since:
        JCMS 9.0.1
      • addListeners

        public void addListeners​(java.util.Set<RssEventListener> listeners)
        Add RssEventListener list to existing listeners
        Parameters:
        listeners - the Set
        Since:
        JCMS 6.3
      • generateID

        public static java.lang.String generateID​(java.lang.String id,
                                                  int maxLength)
        compute a id from parameter. If the id length is less than maxLength parameter, the id is returned. Else the id is truncated and an MD5sum of id is added to the length of the string
        Parameters:
        id - the string which should be an id
        maxLength - the max length of the id
        Returns:
        the computed id