Package org.apache.wiki.rss

# Interface RSSGenerator

All Superinterfaces:
  `org.apache.wiki.api.engine.Initializable`

All Known Implementing Classes:
  `DefaultRSSGenerator`

public interface RSSGenerator extends org.apache.wiki.api.engine.Initializable
The master class for generating different kinds of Feeds (including RSS1.0, 2.0 and Atom).

This class can produce quite a few different styles of feeds. The following modes are available:

- wiki - All the changes to the given page are enumerated and announced as diffs.
- full - Each page is only considered once. This produces a very RecentChanges-style feed, where each page is only listed once, even if it has changed multiple times.
- blog - Each page change is assumed to be a blog entry, so no diffs are produced, but the page content is always completely in the entry in rendered HTML.

Since:
  1.7.5.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ATOM`
Parameter value to represent Atom feeds.
`static final String`
`MODE_BLOG`
Parameter value to represent a 'blog' style feed.
`static final String`
`MODE_FULL`
Parameter value to represent a 'full' style feed.
`static final String`
`MODE_WIKI`
Parameter value to represent a 'wiki' style feed.
`static final String`
`PROP_CHANNEL_DESCRIPTION`
Defines the property name for the RSS channel description.
`static final String`
`PROP_CHANNEL_LANGUAGE`
Defines the property name for the RSS channel language.
`static final String`
`PROP_CHANNEL_TITLE`
Defines the property name for the RSS channel title.
`static final String`
`PROP_GENERATE_RSS`
Defines the property name for the RSS generator main switch.
`static final String`
`PROP_INTERVAL`
Defines the property name for the RSS generation interval in seconds.
`static final String`
`PROP_RSS_AUTHOR`
Defines the property name for the RSS author.
`static final String`
`PROP_RSS_AUTHOREMAIL`
Defines the property name for the RSS author email.
`static final String`
`PROP_RSSFILE`
Defines the property name for the RSS file that the wiki should generate.
`static final String`
`RSS10`
Parameter value to represent RSS 1.0 feeds.
`static final String`
`RSS20`
Parameter value to represent RSS 2.0 feeds.

## Method Summary

Modifier and Type
Method
Description
`static String`
`format(String s)`
Does the required formatting and entity replacement for XML.
`String`
`generate()`
Generates the RSS resource.
`String`
`generateBlogRSS(org.apache.wiki.api.core.Context wikiContext, List<org.apache.wiki.api.core.Page> changed, Feed feed)`
Creates RSS from modifications as if this page was a blog (using the WeblogPlugin).
`String`
`generateFeed(org.apache.wiki.api.core.Context wikiContext, List<org.apache.wiki.api.core.Page> changed, String mode, String type)`
Generates a feed based on a context and list of changes.
`String`
`generateFullWikiRSS(org.apache.wiki.api.core.Context wikiContext, Feed feed)`
Generates an RSS feed for the entire wiki.
`String`
`generateWikiPageRSS(org.apache.wiki.api.core.Context wikiContext, List<org.apache.wiki.api.core.Page> changed, Feed feed)`
Create RSS/Atom as if this page was a wikipage (in contrast to Blog mode).
`static String`
`getContentType(String mode)`
Returns the content type of this RSS feed.
`String`
`getRssFile()`
returns the rss file.
`boolean`
`isEnabled()`
Returns `true` if RSS generation is enabled.
`void`
`setEnabled(boolean enabled)`
Turns RSS generation on or off.

### Methods inherited from interface org.apache.wiki.api.engine.Initializable

`initialize`

## Field Details

### RSS10

static final String RSS10
Parameter value to represent RSS 1.0 feeds. Value is `"rss10"`.

See Also:
  - Constant Field Values

### RSS20

static final String RSS20
Parameter value to represent RSS 2.0 feeds. Value is `"rss20"`.

See Also:
  - Constant Field Values

### ATOM

static final String ATOM
Parameter value to represent Atom feeds. Value is `"atom"`.

See Also:
  - Constant Field Values

### MODE_BLOG

static final String MODE_BLOG
Parameter value to represent a 'blog' style feed. Value is `"blog"`.

See Also:
  - Constant Field Values

### MODE_WIKI

static final String MODE_WIKI
Parameter value to represent a 'wiki' style feed. Value is `"wiki"`.

See Also:
  - Constant Field Values

### MODE_FULL

static final String MODE_FULL
Parameter value to represent a 'full' style feed. Value is `"full"`.

See Also:
  - Constant Field Values

### PROP_CHANNEL_DESCRIPTION

static final String PROP_CHANNEL_DESCRIPTION
Defines the property name for the RSS channel description. Default value for the channel description is an empty string.

Since:
  1.7.6.
See Also:
  - Constant Field Values

### PROP_CHANNEL_LANGUAGE

static final String PROP_CHANNEL_LANGUAGE
Defines the property name for the RSS channel language. Default value for the language is "en-us".

Since:
  1.7.6.
See Also:
  - Constant Field Values

### PROP_CHANNEL_TITLE

static final String PROP_CHANNEL_TITLE
Defines the property name for the RSS channel title. Value is `"jspwiki.rss.channelTitle"`.

See Also:
  - Constant Field Values

### PROP_GENERATE_RSS

static final String PROP_GENERATE_RSS
Defines the property name for the RSS generator main switch.

Since:
  1.7.6.
See Also:
  - Constant Field Values

### PROP_RSSFILE

static final String PROP_RSSFILE
Defines the property name for the RSS file that the wiki should generate.

Since:
  1.7.6.
See Also:
  - Constant Field Values

### PROP_INTERVAL

static final String PROP_INTERVAL
Defines the property name for the RSS generation interval in seconds.

Since:
  1.7.6.
See Also:
  - Constant Field Values

### PROP_RSS_AUTHOR

static final String PROP_RSS_AUTHOR
Defines the property name for the RSS author. Value is `"jspwiki.rss.author"`.

See Also:
  - Constant Field Values

### PROP_RSS_AUTHOREMAIL

static final String PROP_RSS_AUTHOREMAIL
Defines the property name for the RSS author email. Value is `"jspwiki.rss.author.email"`.

See Also:
  - Constant Field Values

## Method Details

### generate

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.

Returns:
  A RSS 1.0 feed in the "full" mode.

### generateFeed

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

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

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

Returns:
  whether RSS generation is currently enabled

### setEnabled

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 `generate()` or `generateFeed(Context, List, String, String)` methods output anything.

Parameters:
  `enabled` - whether RSS generation is considered enabled.

### getRssFile

String getRssFile()
returns the rss file.

Returns:
  the rss file.

### generateFullWikiRSS

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

Parameters:
  `wikiContext` - A WikiContext
  `feed` - A Feed to generate the feed to.
Returns:
  feed.getString().

### generateWikiPageRSS

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

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

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

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.

### format

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

Parameters:
  `s` - String to format.
Returns:
  A formatted string.

### getContentType

static String getContentType(String mode)
Returns the content type of this RSS feed.

Parameters:
  `mode` - the RSS mode: `RSS10`, `RSS20` or `ATOM`.
Returns:
  the content type
Since:
  2.3.15