Package org.apache.wiki.rss

# Class DefaultRSSGenerator

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

All Implemented Interfaces:
  `Initializable`, `RSSGenerator`

public class DefaultRSSGenerator extends Object implements RSSGenerator
Default implementation for `RSSGenerator`.

## Field Summary

### Fields inherited from interface org.apache.wiki.rss.RSSGenerator

`ATOM, MODE_BLOG, MODE_FULL, MODE_WIKI, PROP_CHANNEL_DESCRIPTION, PROP_CHANNEL_LANGUAGE, PROP_CHANNEL_TITLE, PROP_GENERATE_RSS, PROP_INTERVAL, PROP_RSS_AUTHOR, PROP_RSS_AUTHOREMAIL, PROP_RSSFILE, RSS10, RSS20`

## Constructor Summary

Constructors
Constructor
Description
`DefaultRSSGenerator(Engine engine, Properties properties)`
Builds the RSS generator for a given Engine.

## Method Summary

Modifier and Type
Method
Description
`String`
`generate()`
Generates the RSS resource.
`String`
`generateBlogRSS(Context wikiContext, List<Page> changed, Feed feed)`
Creates RSS from modifications as if this page was a blog (using the WeblogPlugin).
`String`
`generateFeed(Context wikiContext, List<Page> changed, String mode, String type)`
Generates a feed based on a context and list of changes.
`String`
`generateFullWikiRSS(Context wikiContext, Feed feed)`
Generates an RSS feed for the entire wiki.
`String`
`generateWikiPageRSS(Context wikiContext, List<Page> changed, Feed feed)`
Create RSS/Atom as if this page was a wikipage (in contrast to Blog mode).
`String`
`getRssFile()`
returns the rss file.
`void`
`initialize(Engine engine, Properties properties)`
Start the RSS generator & generator thread
`boolean`
`isEnabled()`
Returns `true` if RSS generation is enabled.
`void`
`setEnabled(boolean enabled)`
Turns RSS generation on or off.

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

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

## Constructor Details

### DefaultRSSGenerator

public DefaultRSSGenerator(Engine engine, Properties properties)
Builds the RSS generator for a given Engine.

Parameters:
  `engine` - The Engine.
  `properties` - The properties.

## Method Details

### initialize

public void initialize(Engine engine, Properties properties)
Start the RSS generator & generator thread

Specified by:
  `initialize` in interface `Initializable`

### generate

public String generate()
Generates the RSS resource. You probably want to output this result into a file or something, or serve as output from a servlet.

Specified by:
  `generate` in interface `RSSGenerator`
Returns:
  A RSS 1.0 feed in the "full" mode.

### generateFeed

public String generateFeed(Context wikiContext, List<Page> changed, String mode, String type) throws IllegalArgumentException
Generates a feed based on a context and list of changes.

Specified by:
  `generateFeed` in interface `RSSGenerator`
Parameters:
  `wikiContext` - The WikiContext
  `changed` - A list of Entry objects
  `mode` - The mode (wiki/blog)
  `type` - The type (RSS10, RSS20, ATOM). Default is RSS 1.0
Returns:
  Fully formed XML.
Throws:
  `IllegalArgumentException` - If an illegal mode is given.

### isEnabled

public boolean isEnabled()
Returns `true` if RSS generation is enabled.

Specified by:
  `isEnabled` in interface `RSSGenerator`
Returns:
  whether RSS generation is currently enabled

### setEnabled

public void setEnabled(boolean enabled)
Turns RSS generation on or off. This setting is used to set the "enabled" flag only for use by callers, and does not actually affect whether the `RSSGenerator.generate()` or `RSSGenerator.generateFeed(Context, List, String, String)` methods output anything.

Specified by:
  `setEnabled` in interface `RSSGenerator`
Parameters:
  `enabled` - whether RSS generation is considered enabled.

### getRssFile

public String getRssFile()
returns the rss file.

Specified by:
  `getRssFile` in interface `RSSGenerator`
Returns:
  the rss file.

### generateFullWikiRSS

public String generateFullWikiRSS(Context wikiContext, Feed feed)
Generates an RSS feed for the entire wiki. Each item should be an instance of the RSSItem class.

Specified by:
  `generateFullWikiRSS` in interface `RSSGenerator`
Parameters:
  `wikiContext` - A WikiContext
  `feed` - A Feed to generate the feed to.
Returns:
  feed.getString().

### generateWikiPageRSS

public String generateWikiPageRSS(Context wikiContext, List<Page> changed, Feed feed)
Create RSS/Atom as if this page was a wikipage (in contrast to Blog mode).

Specified by:
  `generateWikiPageRSS` in interface `RSSGenerator`
Parameters:
  `wikiContext` - The WikiContext
  `changed` - A List of changed WikiPages.
  `feed` - A Feed object to fill.
Returns:
  the RSS representation of the wiki context

### generateBlogRSS

public String generateBlogRSS(Context wikiContext, List<Page> changed, Feed feed)
Creates RSS from modifications as if this page was a blog (using the WeblogPlugin).

Specified by:
  `generateBlogRSS` in interface `RSSGenerator`
Parameters:
  `wikiContext` - The WikiContext, as usual.
  `changed` - A list of the changed pages.
  `feed` - A valid Feed object. The feed will be used to create the RSS/Atom, depending on which kind of an object you want to put in it.
Returns:
  A String of valid RSS or Atom.