Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.fm.rss
Class rssChannel  view rssChannel download rssChannel.java

java.lang.Object
  extended bycom.fm.rss.rssAbstractEntry
      extended bycom.fm.rss.rssChannel
All Implemented Interfaces:
ItemContainer, com.fm.update.Updateable

public class rssChannel
extends rssAbstractEntry
implements ItemContainer, com.fm.update.Updateable

Entities of the class represent RSS channels.


Field Summary
private  java.lang.String creator
          channel RSS feed source URI
private  java.lang.String imageLink
           
private  java.lang.String imageTitle
          number of minutes a channel may be cached
private  java.lang.String imageURL
          image title if image element is present, empty string otherwise
private  boolean isUpdateOperation
          number of days item may be stored.
private  java.util.HashMap itemList
           
private  int keepPeriod
           
private  java.lang.String language
          channel source URI
private  java.lang.String link
          array of the channels items
static int MAX_KEEP_PERIOD
           
private  java.lang.String source
          channel parent URI
private  int ttl
          channel source URI
 
Fields inherited from class com.fm.rss.rssAbstractEntry
dateCreated, description, docAdapter, idHash, title
 
Constructor Summary
rssChannel()
          enough days for human history
 
Method Summary
 boolean addItem(rssItem ni)
          Adds new RSS item to the channel's item list
 void filterItems()
          Filter items
 void filterItems(com.fm.rss.filter.RssItemFilter f)
          Filter items using specified filter
 java.lang.String getCreator()
           
 java.lang.String getImageLink()
           
 java.lang.String getImageTitle()
           
 java.lang.String getImageURL()
           
 java.util.Map getItems()
          Returns Map of the channel items.
 java.util.Vector getItemVector()
          Return Vector of the items Items are unsorted and if user wants the sorted list, the sorting filter should be applied.
 int getKeepPeriod()
          Get keep period in days
 java.lang.String getLanguage()
           
 java.lang.String getLink()
           
 java.lang.String getSource()
           
 int getTtl()
           
 boolean isFresh()
          Returns true if channel has unread(fresh) items
 void parse(org.w3c.dom.Element el)
          Parse given Element object and initialize channel params and item list.
private  void parseJNRFormat(org.w3c.dom.Element el)
          Parse element object representing RSS channel encoded using RSS v1 specification
private  void parseRSSv1(org.w3c.dom.Element el)
          Parse element object representing RSS channel encoded using RSS v1 specification
private  void parseRSSv2(org.w3c.dom.Element el)
          Parse element object representing RSS channels in RSSv2 (and >= 0.91) format.
 void setCreator(java.lang.String creator)
           
 void setDescription(java.lang.String description)
          Overrides default from AbstractEntry
 void setImageLink(java.lang.String imageLink)
           
 void setImageTitle(java.lang.String imageTitle)
           
 void setImageURL(java.lang.String imageURL)
           
 void setItemList(java.util.Map newIMap)
          Replaces the channel's item list with given one.
 void setKeepPeriod(int p)
          Set keep period in days
 void setLanguage(java.lang.String language)
           
 void setLink(java.lang.String link)
           
 void setSource(java.lang.String source)
           
 void setTitle(java.lang.String title)
          Overrides default from AbstractEntry
 void setTtl(int ttl)
           
 org.w3c.dom.Element toDomElement()
          Returns channel as XML document element
 void update()
          Update channel items.
 
Methods inherited from class com.fm.rss.rssAbstractEntry
equals, generateID, getDateCreated, getDescription, getID, getTitle, hashCode, parse, parse, setDateCreated, setID, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

itemList

private java.util.HashMap itemList

link

private java.lang.String link
array of the channels items


source

private java.lang.String source
channel parent URI


creator

private java.lang.String creator
channel RSS feed source URI


language

private java.lang.String language
channel source URI


ttl

private int ttl
channel source URI


imageTitle

private java.lang.String imageTitle
number of minutes a channel may be cached


imageURL

private java.lang.String imageURL
image title if image element is present, empty string otherwise


imageLink

private java.lang.String imageLink

keepPeriod

private int keepPeriod

isUpdateOperation

private boolean isUpdateOperation
number of days item may be stored. if item is older than keepPeriod days it wont be loaded or saved


MAX_KEEP_PERIOD

public static int MAX_KEEP_PERIOD
Constructor Detail

rssChannel

public rssChannel()
enough days for human history

Method Detail

toDomElement

public org.w3c.dom.Element toDomElement()
Returns channel as XML document element

Specified by:
toDomElement in class rssAbstractEntry

update

public void update()
            throws com.fm.update.updateException
Update channel items. This method will connect to the server, retreive RSS feed and aggregate new items (items which have been published after last time this method had been called).

Specified by:
update in interface com.fm.update.Updateable

getItems

public java.util.Map getItems()
Returns Map of the channel items.

Specified by:
getItems in interface ItemContainer

getItemVector

public java.util.Vector getItemVector()
Return Vector of the items Items are unsorted and if user wants the sorted list, the sorting filter should be applied. The items in the list may be sorted naturally, due to extraction order (items appear in the list as they appear in the channel), but such implementation nuances mustn't be taken seriously.


setItemList

public void setItemList(java.util.Map newIMap)
Replaces the channel's item list with given one.


parse

public void parse(org.w3c.dom.Element el)
           throws rssParseException
Parse given Element object and initialize channel params and item list.

As soon as there are more than one description format for RSS channels, the parse method actually does only simple checks for description format and then forwards given Element object to the appropriate private method. The three major description formats are: RSSv1, RSSv2 (by Userland), JNR (internal format based on DublinCore elements, which intended for the local storing of the channels,categories and items data). Since RSSv2 backward compatible with 0.9x formats, the channels described using 0.9x format will be handled with parseRSSv2().

Specified by:
parse in class rssAbstractEntry

parseRSSv1

private void parseRSSv1(org.w3c.dom.Element el)
                 throws rssParseException
Parse element object representing RSS channel encoded using RSS v1 specification


parseRSSv2

private void parseRSSv2(org.w3c.dom.Element el)
                 throws rssParseException
Parse element object representing RSS channels in RSSv2 (and >= 0.91) format.


parseJNRFormat

private void parseJNRFormat(org.w3c.dom.Element el)
                     throws rssParseException
Parse element object representing RSS channel encoded using RSS v1 specification


addItem

public boolean addItem(rssItem ni)
Adds new RSS item to the channel's item list


setTitle

public void setTitle(java.lang.String title)
Overrides default from AbstractEntry

Overrides:
setTitle in class rssAbstractEntry

setDescription

public void setDescription(java.lang.String description)
Overrides default from AbstractEntry

Overrides:
setDescription in class rssAbstractEntry

getSource

public java.lang.String getSource()

setSource

public void setSource(java.lang.String source)

getLanguage

public java.lang.String getLanguage()

setLanguage

public void setLanguage(java.lang.String language)

getCreator

public java.lang.String getCreator()

setCreator

public void setCreator(java.lang.String creator)

getLink

public java.lang.String getLink()

setLink

public void setLink(java.lang.String link)

getTtl

public int getTtl()

setTtl

public void setTtl(int ttl)

getImageTitle

public java.lang.String getImageTitle()

setImageTitle

public void setImageTitle(java.lang.String imageTitle)

getImageURL

public java.lang.String getImageURL()

setImageURL

public void setImageURL(java.lang.String imageURL)

getImageLink

public java.lang.String getImageLink()

setImageLink

public void setImageLink(java.lang.String imageLink)

isFresh

public boolean isFresh()
Returns true if channel has unread(fresh) items


setKeepPeriod

public void setKeepPeriod(int p)
Set keep period in days


getKeepPeriod

public int getKeepPeriod()
Get keep period in days


filterItems

public void filterItems()
Filter items

Remove unwanted items using keepPeriod rule


filterItems

public void filterItems(com.fm.rss.filter.RssItemFilter f)
Filter items using specified filter

Specified by:
filterItems in interface ItemContainer