[MGNLRSSAGG-10] Enable easy syndication of any Magnolia content Created: 02/Feb/09  Updated: 09/Feb/15  Resolved: 02/Mar/09

Status: Closed
Project: Magnolia RSS Aggregator Module
Component/s: None
Affects Version/s: 1.0
Fix Version/s: 1.0

Type: Improvement Priority: Major
Reporter: Rob van der Linden Vooren Assignee: Jan Haderka
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File MGNLRSSAGG-10_for_rev22801_v4.patch     Zip Archive custom-news-generator-sample.zip    
Issue Links:
causality
is causing MGNLRSSAGG-53 Bootstrap and mgnl-files folder not g... Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Testcase included:
Yes
Date of First Response:

 Description   

We encountered a use case of needing to syndicate other content than just the aggregate feeds defined in the RSS Module.
As such, I rewrote the FeedGenerator class and the ProduceFeed.jsp to enable us to syndicate any content in the Magnolia repository easily.

Please have a look at the patch and let me know what you think.



 Comments   
Comment by Philipp Bracher [ 03/Feb/09 ]

Without looking at the details, but sounds as this might go into the data module.

Comment by Rob van der Linden Vooren [ 03/Feb/09 ]

Ok Philipp, thanks for your feedback, just see where you guys can use it.
Attached reworked patch to match the latest version of the magnolia-module currently in trunk (rev 22223).

Comment by Jan Haderka [ 03/Feb/09 ]

Attached reworked patch to match the latest version of the magnolia-module currently in trunk (rev 22223).

Thanks. Was about to ask you if you can provide this update

It would be great if you can maybe provide sample of configuration for your other use case? You use it to generate feed from small articles like news on your site or something similar? Or do you use it to generate feeds from other data types in data module?
Looking at your solution it seems flexible enough to generate feed from just about anything.
If I understood it correctly you just extend SyndFeedGenerator and implement all the abstract methods. And then you just have to specify that name of the feed generator in the call to ProduceFeed.jsp. Correct?

Regarding your comment in the JSP - yes, absolutely. JSP should go away completely and be replaced by either filter or servlet registered in /server/filters respectively /server/filters/servlets. JSP was just a poor-man's-hack to see if the POC will work out or not.
Filters are normally registered from the bootstrap files, and reodered to proper position using FilterOrderingTask Have a look at magnolia-module-cache for example of that.
Servlets can be registered in directly in module deployment descriptors. magnolia-module-dms is nice example of how to do this.
Personally this feels more like the kind of work I would do in servlet rather then filter, but no strong preference either way.

As for the resolving different feed generators I think it would be more flexible to have them configured via admin interface, for example under /modules/rssaggregator/config/feedGenerators rather then having to add generator mapping on the fly in jsp page.

BTW, contrary to Philipp, I think it should stay with RSSAggregator module. It looks like a great extension to the module. Thanks.

Comment by Rob van der Linden Vooren [ 04/Feb/09 ]

I have updated the patch (...v2) with some changes (remove unused by hand, I'm in doubt whether the patch deletes?)

  • Moved: info.magnolia.module.rssaggregator.importhandler.ContentMapper to info.magnolia.module.rssaggregator.util.ContentMapper
  • Deleted: FeedGenerator
Comment by Rob van der Linden Vooren [ 04/Feb/09 ]

Hi, thanks for providing the RSS Aggregate Module in the first place .
I attached a sample configuration of custom news aggregation (our other use case).

As for required steps to syndicate <any-content-here> as RSS, the current steps required are:

1) Implement a SyndFeedGenerator by extending the SyndFeedGenerator base class, that maps it to a list of feed entries. A typical usecase obviously, would be to query and map content nodes to feed entries. To achieve this in a simple fashion, have a look at the MagnoliaTemplate and ContentMapper.

2) Implement a SyndFeedGeneratorFactory for your Generator that will create a configured Generator instance based on given request parameters. (See remark R1)

3) Map a logical name for a generator to a SyndFeedGeneratorFactory that is capable of constructing that generator.
Mappings are registered with the SyndFeedGeneratorResolver; The registration of this mapping currently happens in the ProduceFeed.jsp, but as you suggest there will be more elegant ways. (See R2)

4) Make a request (in this case on the JSP) with the appropriate parameters on which the Generator to use can be resolved to see the feed syndication work

R1: Typically I think creating a new instance of your generator won't require any parameters. In the case of the RSSModuleFeedGenerator however, the path to the blog aggregate definition in the JCR was required. This was the reason for introduce factories for Generator construction.

R2: Ideally (as you mentioned) the mappings in the SyndFeedGeneratorResolver are done by means of configuration in the admin interface.

I hope this confirms/clarifies the perspective on the patch where needed. If not, let me know.

Comment by Philipp Bracher [ 05/Feb/09 ]

@Jan: it is up to you to decide what makes sense, I might have easily misunderstood something.

Comment by Rob van der Linden Vooren [ 07/Feb/09 ]

Added updated patch. This patch is what v2 of the patch was, with an additional fix for a bug (introduced when the fix for MGNLRSSAGG-8 was applied) where:

The RSSImportHandler would try to create an instance of the RSSFeedFetcher interface when no feedFetcherClass was configured.
I changed this so that by default the SimpleRSSFeedFetcher implementation would be used.

Also added proper license headers.

Comment by Rob van der Linden Vooren [ 22/Feb/09 ]

Added updated patch (MGNLRSSAGG-10_for_rev22801_v4.patch)

  • Lowered dependency on rome and rome-fetcher from 1.0RC2 to 0.9, in order to prevent a xerces version clash (xercesImpl-2.4.1.jar vs xercesImpl-2.8.1.jar)
  • Assigned test dependencies test scope
  • Replaced JSP with configurable FeedSyndicationServlet
  • Introduced FastRSSFeedFetcher (3 threads)
  • Renamed for clarity
  • Provided updated custom generator sample

Jan, I've tested this patch against magnolia-4.0-rc3.
Please have a review and let me know if this is ready for integration.

Comment by Jan Haderka [ 25/Feb/09 ]

Looks great. I'll review it in details and test it and let you know if I find anything.
For now I have only problem with changing the version of rome used: rome-fetcher 0.9 is not in the repository. Neither in the central nor in the java.net repo.

Comment by Jan Haderka [ 02/Mar/09 ]

Applied. Thanks for the patch. I've made few changes here and there, mainly related to the configuration to simplify it and provide reasonable defaults. The Default feedGenerator is now configured in the module descriptor (same as for the default FeedFetcher). I've also updated dialogs and added functionality to read the title and description from the aggregate defined in the data://rssaggregator. The site url is taken from the server configuration and pointing to the site itself.
Sorry it took so long, but this was a quite big patch and I had to balance it with the other work going on 4.0.

Comment by Rob van der Linden Vooren [ 02/Mar/09 ]

Hi Jan,

Thanks for applying the patch. I'll look through your commit to learn from your configuration simplifications. Furthermore no trouble for it taking a little longer. No-one can do everything at one now can we?

Cheers,

Rob

Comment by Boris Kraft [ 30/Mar/09 ]

Some of this info here should definitely go into the documentation for the RSS module...

Generated at Mon Feb 12 07:04:37 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.