info.magnolia.module.rssaggregator.generator
Class AbstractSyndFeedGenerator

java.lang.Object
  extended by info.magnolia.module.rssaggregator.generator.AbstractSyndFeedGenerator
All Implemented Interfaces:
FeedGenerator
Direct Known Subclasses:
PlanetFeedGenerator, RSSModuleFeedGenerator

public abstract class AbstractSyndFeedGenerator
extends Object
implements FeedGenerator

Convenience base class providing plumbing required for generating a Feed from a SyndFeed. The generated feed will by default be of type "". Subclasses need implement the template methods loadFeedEntries() and setFeedInfo(SyndFeed) to have a Feed generated.

Author:
Rob van der Linden Vooren
See Also:
FeedGenerator, SyndFeed, Feed

Constructor Summary
AbstractSyndFeedGenerator()
           
 
Method Summary
 Feed generate()
          Generate a SyndFeed.
abstract  List<com.sun.syndication.feed.synd.SyndEntry> loadFeedEntries()
          Template method for subclasses to implement in order to provide the feed entries to include in the Feed to generate.
protected  com.sun.syndication.feed.synd.SyndFeedImpl newSyndFeed()
          Construct a new SyndFeed instance.
abstract  void setFeedInfo(com.sun.syndication.feed.synd.SyndFeed feed)
          Template method for subclasses are to override in order to set appropriate Feed meta data.
protected  String syndFeedToXml(com.sun.syndication.feed.synd.SyndFeed feed)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSyndFeedGenerator

public AbstractSyndFeedGenerator()
Method Detail

generate

public Feed generate()
              throws FeedGenerationException
Generate a SyndFeed.

Specified by:
generate in interface FeedGenerator
Returns:
the generated SyndFeed
Throws:
FeedGenerationException - when an exception occurs while generating the aggregate feed

syndFeedToXml

protected String syndFeedToXml(com.sun.syndication.feed.synd.SyndFeed feed)
                        throws com.sun.syndication.io.FeedException
Throws:
com.sun.syndication.io.FeedException

newSyndFeed

protected com.sun.syndication.feed.synd.SyndFeedImpl newSyndFeed()
Construct a new SyndFeed instance.

Returns:
the new SyndFeed instance

loadFeedEntries

public abstract List<com.sun.syndication.feed.synd.SyndEntry> loadFeedEntries()
Template method for subclasses to implement in order to provide the feed entries to include in the Feed to generate.

Returns:
the feed entries to include in the Feed to generate

setFeedInfo

public abstract void setFeedInfo(com.sun.syndication.feed.synd.SyndFeed feed)
Template method for subclasses are to override in order to set appropriate Feed meta data. Typical use cases would be to set the title , link and description. The given feed will never be null.

Parameters:
feed - the syndication feed that is generated to set the feed meta data for


Copyright © 2014 Magnolia International Ltd.. All Rights Reserved.