Package org.apache.wiki.rss

# Class Feed

java.lang.Object
org.apache.wiki.rss.Feed

Direct Known Subclasses:
  `AtomFeed`, `RSS10Feed`, `RSS20Feed`

public abstract class Feed extends Object
Represents an abstract feed.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected String`
`m_channelDescription`
`protected String`
`m_channelLanguage`
`protected String`
`m_channelTitle`
`protected final List<Entry>`
`m_entries`
`protected String`
`m_feedURL`
`protected String`
`m_mode`
`protected final Context`
`m_wikiContext`
`static final String`
`VAR_BLOGNAME`
Wiki variable storing the blog's name.

## Constructor Summary

Constructors
Constructor
Description
`Feed(Context context)`
Create a new Feed for a particular WikiContext.

## Method Summary

Modifier and Type
Method
Description
`void`
`addEntry(Entry e)`
Adds a new Entry to the Feed, at the end of the list.
`static String`
`format(String s)`
Does the required formatting and entity replacement for XML.
`String`
`getChannelDescription()`
`String`
`getChannelLanguage()`
`String`
`getChannelTitle()`
`String`
`getFeedURL()`
`protected String`
`getMimeType(javax.servlet.ServletContext c, String name)`
A helper method for figuring out the MIME type for an enclosure.
`static String`
`getSiteName(Context context)`
Figure out a site name for a feed.
`abstract String`
`getString()`
Returns the XML for the feed contents in a String format.
`void`
`setChannelDescription(String description)`
`void`
`setChannelLanguage(String language)`
`void`
`setChannelTitle(String title)`
`void`
`setFeedURL(String feedurl)`
`void`
`setMode(String mode)`
Set the mode of the Feed.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### m_entries

protected final List<Entry> m_entries

### m_feedURL

protected String m_feedURL

### m_channelTitle

protected String m_channelTitle

### m_channelDescription

protected String m_channelDescription

### m_channelLanguage

protected String m_channelLanguage

### m_wikiContext

protected final Context m_wikiContext

### m_mode

protected String m_mode

### VAR_BLOGNAME

public static final String VAR_BLOGNAME
Wiki variable storing the blog's name.

See Also:
  - Constant Field Values

## Constructor Details

### Feed

public Feed(Context context)
Create a new Feed for a particular WikiContext.

Parameters:
  `context` - The WikiContext.

## Method Details

### getSiteName

public static String getSiteName(Context context)
Figure out a site name for a feed.

Parameters:
  `context` - the wiki context
Returns:
  the site name

### setMode

public void setMode(String mode)
Set the mode of the Feed. It can be any of the following:

- `RSSGenerator.MODE_WIKI` - to create a wiki diff list per page.
- `RSSGenerator.MODE_BLOG` - to assume that the Entries are blog entries.
- `RSSGenerator.MODE_FULL` - to create a wiki diff list for the entire blog.

As the Entry list itself is generated elsewhere, this mostly just affects the way that the layout and metadata for each entry is generated.

Parameters:
  `mode` - As defined in RSSGenerator.

### addEntry

public void addEntry(Entry e)
Adds a new Entry to the Feed, at the end of the list.

Parameters:
  `e` - The Entry to add.

### getString

public abstract String getString()
Returns the XML for the feed contents in a String format. All subclasses must implement.

Returns:
  valid XML, ready to be shoved out.

### getChannelDescription

public String getChannelDescription()

Returns:
  Returns the m_channelDescription.

### setChannelDescription

public void setChannelDescription(String description)

Parameters:
  `description` - The m_channelDescription to set.

### getChannelLanguage

public String getChannelLanguage()

Returns:
  Returns the m_channelLanguage.

### setChannelLanguage

public void setChannelLanguage(String language)

Parameters:
  `language` - The m_channelLanguage to set.

### getChannelTitle

public String getChannelTitle()

Returns:
  Returns the m_channelTitle.

### setChannelTitle

public void setChannelTitle(String title)

Parameters:
  `title` - The m_channelTitle to set.

### getFeedURL

public String getFeedURL()

Returns:
  Returns the m_feedURL.

### setFeedURL

public void setFeedURL(String feedurl)

Parameters:
  `feedurl` - The m_feedURL to set.

### getMimeType

protected String getMimeType(javax.servlet.ServletContext c, String name)
A helper method for figuring out the MIME type for an enclosure.

Parameters:
  `c` - A ServletContext
  `name` - The filename
Returns:
  Something sane for a MIME type.

### format

public static String format(String s)
Does the required formatting and entity replacement for XML.

Parameters:
  `s` - The String to format. Null is safe.
Returns:
  A formatted string.