public class RSSGenerator extends Object
This class can produce quite a few different styles of feeds. The following modes are available:
Modifier and Type | Field and Description |
---|---|
static String |
ATOM
Parameter value to represent Atom feeds.
|
static String |
MODE_BLOG
Parameter value to represent a 'blog' style feed.
|
static String |
MODE_FULL
Parameter value to represent a 'full' style feed.
|
static String |
MODE_WIKI
Parameter value to represent a 'wiki' style feed.
|
static String |
PROP_CHANNEL_DESCRIPTION
Defines the property name for the RSS channel description.
|
static String |
PROP_CHANNEL_LANGUAGE
Defines the property name for the RSS channel language.
|
static String |
PROP_CHANNEL_TITLE
Defines the property name for the RSS channel title.
|
static String |
PROP_GENERATE_RSS
Defines the property name for the RSS generator main switch.
|
static String |
PROP_INTERVAL
Defines the property name for the RSS generation interval in seconds.
|
static String |
PROP_RSS_AUTHOR
Defines the property name for the RSS author.
|
static String |
PROP_RSS_AUTHOREMAIL
Defines the property name for the RSS author email.
|
static String |
PROP_RSSFILE
Defines the property name for the RSS file that the wiki should generate.
|
static String |
RSS10
Parameter value to represent RSS 1.0 feeds.
|
static String |
RSS20
Parameter value to represent RSS 2.0 feeds.
|
Constructor and Description |
---|
RSSGenerator(WikiEngine engine,
Properties properties)
Initialize the RSS generator for a given WikiEngine.
|
Modifier and Type | Method and Description |
---|---|
static String |
format(String s)
Does the required formatting and entity replacement for XML.
|
String |
generate()
Generates the RSS resource.
|
protected String |
generateBlogRSS(WikiContext wikiContext,
List<WikiPage> changed,
Feed feed)
Creates RSS from modifications as if this page was a blog (using the WeblogPlugin).
|
String |
generateFeed(WikiContext wikiContext,
List<WikiPage> changed,
String mode,
String type)
Generates a feed based on a context and list of changes.
|
protected String |
generateFullWikiRSS(WikiContext wikiContext,
Feed feed)
Generates an RSS feed for the entire wiki.
|
protected String |
generateWikiPageRSS(WikiContext wikiContext,
List<WikiPage> 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.
|
boolean |
isEnabled()
Returns
true if RSS generation is enabled. |
void |
setEnabled(boolean enabled)
Turns RSS generation on or off.
|
public static final String RSS10
public static final String RSS20
public static final String ATOM
public static final String MODE_BLOG
public static final String MODE_WIKI
public static final String MODE_FULL
public static final String PROP_CHANNEL_DESCRIPTION
public static final String PROP_CHANNEL_LANGUAGE
public static final String PROP_CHANNEL_TITLE
public static final String PROP_GENERATE_RSS
public static final String PROP_RSSFILE
public static final String PROP_INTERVAL
public static final String PROP_RSS_AUTHOR
public static final String PROP_RSS_AUTHOREMAIL
public RSSGenerator(WikiEngine engine, Properties properties)
engine
- The WikiEngine.properties
- The properties.NoRequiredPropertyException
- If something is missing from the given property set.public static String format(String s)
s
- String to format.public String generate()
public static String getContentType(String mode)
public String generateFeed(WikiContext wikiContext, List<WikiPage> changed, String mode, String type) throws ProviderException, IllegalArgumentException
wikiContext
- The WikiContextchanged
- A list of Entry objectsmode
- The mode (wiki/blog)type
- The type (RSS10, RSS20, ATOM). Default is RSS 1.0ProviderException
- If the underlying provider failed.IllegalArgumentException
- If an illegal mode is given.public boolean isEnabled()
true
if RSS generation is enabled.public void setEnabled(boolean enabled)
generate()
or
generateFeed(WikiContext, List, String, String)
methods output anything.enabled
- whether RSS generation is considered enabled.protected String generateFullWikiRSS(WikiContext wikiContext, Feed feed)
wikiContext
- A WikiContextfeed
- A Feed to generate the feed to.protected String generateWikiPageRSS(WikiContext wikiContext, List<WikiPage> changed, Feed feed)
wikiContext
- The WikiContextchanged
- A List of changed WikiPages.feed
- A Feed object to fill.protected String generateBlogRSS(WikiContext wikiContext, List<WikiPage> changed, Feed feed) throws ProviderException
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.ProviderException
- If reading of pages was not possible.Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.