org.eclipse.ecf.provider.rss.channel
Class RssFeed

java.lang.Object
  extended by org.eclipse.ecf.provider.rss.channel.RssFeed
All Implemented Interfaces:
java.io.Serializable

public class RssFeed
extends java.lang.Object
implements java.io.Serializable

Represents a particular RSS feed.

Author:
Sergey Yakovlev
See Also:
Serialized Form

Field Summary
static java.lang.String SSE_NAMESPACE
           
static java.lang.String SSE_NAMESPACE_URI
           
 
Constructor Summary
RssFeed(java.lang.String title, java.lang.String link, java.lang.String description)
          Constructs a feed with the specified title, link and description.
RssFeed(java.lang.String title, java.net.URL link, java.lang.String description)
          Constructs a feed with the specified title, link and description.
 
Method Summary
 void addExtension(org.w3c.dom.Element newElement)
          Adds a new extension element.
 boolean addItem(RssItem newItem)
          Appends the specified item element to the end of the item list (optional operation).
 void addNamespace(java.lang.String nsName, java.lang.String nsURI)
          Adds a new namespace
 java.lang.String getDescription()
          Gets phrase or sentence describing the channel.
 java.util.List getExtensions()
          Gets the rss extensions.
 java.util.List getItems()
          Gets the item list within this feed.
 java.lang.String getLanguage()
          Gets the language the channel is written in.
 java.net.URL getLink()
          Gets the URL to the HTML website corresponding to the channel.
 java.util.Properties getNamespaces()
          Gets the namespace list that is associated with this feed.
 java.lang.String getNamespaceURI(java.lang.String nsName)
          Gets the namespace URI.
 SseSharing getSharing()
          Gets the sharing element
 java.lang.String getTitle()
          Gets the name of the channel
 RSSVersion getVersion()
          Gets the RSS version of this feed.
static RssFeed load(java.io.File fromFile)
          Reads a feed from the file specified as RSS feed.
 RssFeed merge(RssFeed mergeFeed)
          Merge specified RSS feed with this feed.
 void save(java.io.File toFile)
          Stores this feed to the specified file.
 void setDescription(java.lang.String description)
          Sets phrase or sentence describing the channel.
 void setExtensions(java.util.List extensions)
          Sets the rss extensions.
 void setLanguage(java.lang.String language)
          Sets the language the channel is written in.
 void setLink(java.lang.String link)
          Sets the URL to the HTML website corresponding to the channel.
 void setLink(java.net.URL link)
          Sets the URL to the HTML website corresponding to the channel.
 void setSharing(SseSharing sharing)
          Sets a sharing element.
 void setTitle(java.lang.String title)
          Sets the name of the channel
 void setVersion(RSSVersion version)
          Sets the RSS version of this feed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSE_NAMESPACE

public static final java.lang.String SSE_NAMESPACE
See Also:
Constant Field Values

SSE_NAMESPACE_URI

public static final java.lang.String SSE_NAMESPACE_URI
See Also:
Constant Field Values
Constructor Detail

RssFeed

public RssFeed(java.lang.String title,
               java.net.URL link,
               java.lang.String description)
Constructs a feed with the specified title, link and description.

Parameters:
title - - the title to use
link - - the link
description - - the description

RssFeed

public RssFeed(java.lang.String title,
               java.lang.String link,
               java.lang.String description)
Constructs a feed with the specified title, link and description.

Parameters:
title - - the title to use
link - - the link
description - - the description
Method Detail

load

public static RssFeed load(java.io.File fromFile)
                    throws java.io.IOException,
                           ParseException
Reads a feed from the file specified as RSS feed.

Parameters:
fromFile - - The file containing the RSS feed to load.
Returns:
loaded feed or null if none in use.
Throws:
java.io.IOException - - If any IO errors occur.
ParseException - - If any parse errors occur during processing.

addItem

public boolean addItem(RssItem newItem)
Appends the specified item element to the end of the item list (optional operation).

Parameters:
newItem - - item element to be appended to the item list.
Returns:
true (as per the general contract of the Collection.add method).

getTitle

public java.lang.String getTitle()
Gets the name of the channel

Returns:
a title as a string

getDescription

public java.lang.String getDescription()
Gets phrase or sentence describing the channel.

Returns:
a description as a string

getLanguage

public java.lang.String getLanguage()
Gets the language the channel is written in.

Returns:
a language as a string

getVersion

public RSSVersion getVersion()
Gets the RSS version of this feed.

Returns:
a RSSVersion object

getLink

public java.net.URL getLink()
Gets the URL to the HTML website corresponding to the channel.

Returns:
a link as a URL

getSharing

public SseSharing getSharing()
Gets the sharing element

Returns:
a SseSharing object.

getItems

public java.util.List getItems()
Gets the item list within this feed.

Returns:
an item list

setTitle

public void setTitle(java.lang.String title)
Sets the name of the channel

Parameters:
title - - the String containing the title representation.

setDescription

public void setDescription(java.lang.String description)
Sets phrase or sentence describing the channel.

Parameters:
description - - the String containing the description representation.

setLanguage

public void setLanguage(java.lang.String language)
Sets the language the channel is written in.

Parameters:
language - - the String containing the language representation.

setVersion

public void setVersion(RSSVersion version)
Sets the RSS version of this feed.

Parameters:
version - - the RSSVersion object containing the RSS version

setLink

public void setLink(java.net.URL link)
Sets the URL to the HTML website corresponding to the channel.

Parameters:
link - - the URL object containing the link.

setLink

public void setLink(java.lang.String link)
Sets the URL to the HTML website corresponding to the channel.

Parameters:
link - - the String containing the link representation.

setSharing

public void setSharing(SseSharing sharing)
Sets a sharing element.

Parameters:
sharing - - the SseSharing object

merge

public RssFeed merge(RssFeed mergeFeed)
Merge specified RSS feed with this feed. NOTE: We only deal with "item" elements when merging, so any other changes made in the merge document are ignored. Remember that the goal of SSE isn't to replicate RSS files, it is to replicate items via RSS.

Parameters:
mergeFeed - - RSS feed to be merged with this feed.
Returns:
- a reference to this object.

save

public void save(java.io.File toFile)
          throws java.io.IOException
Stores this feed to the specified file.

Parameters:
toFile - - a output file.
Throws:
java.io.IOException - - If any IO errors occur.

addNamespace

public void addNamespace(java.lang.String nsName,
                         java.lang.String nsURI)
Adds a new namespace

Parameters:
nsName - The qualified name of the namespace.
nsURI - The namespace URI.

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String nsName)
Gets the namespace URI.

Parameters:
nsName - The qualified name of the namespace.
Returns:
The namespace URI.

getNamespaces

public java.util.Properties getNamespaces()
Gets the namespace list that is associated with this feed.

Returns:
Returns the namespaces.

addExtension

public void addExtension(org.w3c.dom.Element newElement)
Adds a new extension element.

Parameters:
newElement - The element to add.

getExtensions

public java.util.List getExtensions()
Gets the rss extensions.

Returns:
Returns the rss extensions.

setExtensions

public void setExtensions(java.util.List extensions)
Sets the rss extensions.

Parameters:
extensions - The rss extensions to set.