322 lines
18 KiB
HTML
322 lines
18 KiB
HTML
<!DOCTYPE html>
|
|
<!--
|
|
| Generated by Apache Maven Doxia at 2016-04-24
|
|
| Rendered using Apache Maven Fluido Skin 1.3.0
|
|
-->
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta name="author" content="mkurz" />
|
|
<meta name="Date-Creation-yyyymmdd" content="20110815" />
|
|
<meta name="Date-Revision-yyyymmdd" content="20160424" />
|
|
<meta http-equiv="Content-Language" content="en" />
|
|
<title>ROME - Rss and atOM utilitiEs (ROME) Plugins Mechanism</title>
|
|
<link rel="stylesheet" href="../css/apache-maven-fluido-1.3.0.min.css" />
|
|
<link rel="stylesheet" href="../css/site.css" />
|
|
<link rel="stylesheet" href="../css/print.css" media="print" />
|
|
|
|
|
|
<script type="text/javascript" src="../js/apache-maven-fluido-1.3.0.min.js"></script>
|
|
|
|
|
|
</head>
|
|
<body class="topBarDisabled">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="http://github.com/rometools/rome">
|
|
<img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
|
|
src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"
|
|
alt="Fork me on GitHub">
|
|
</a>
|
|
|
|
|
|
|
|
|
|
<div class="container-fluid">
|
|
<div id="banner">
|
|
<div class="pull-left">
|
|
<a href="../index.html" id="bannerLeft">
|
|
<img src="../images/romelogo.png" alt="ROME"/>
|
|
</a>
|
|
</div>
|
|
<div class="pull-right"> </div>
|
|
<div class="clear"><hr/></div>
|
|
</div>
|
|
|
|
<div id="breadcrumbs">
|
|
<ul class="breadcrumb">
|
|
|
|
|
|
|
|
|
|
|
|
<li id="publishDate" class="pull-right">Last Published: 2016-04-24</li> <li class="divider pull-right">|</li>
|
|
<li id="projectVersion" class="pull-right">Version: 1.7.0-SNAPSHOT</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<div class="row-fluid">
|
|
<div id="leftColumn" class="span3">
|
|
<div class="well sidebar-nav">
|
|
|
|
|
|
<ul class="nav nav-list">
|
|
<li class="nav-header">Rome</li>
|
|
|
|
<li>
|
|
|
|
<a href="../index.html" title="Overview">
|
|
<i class="none"></i>
|
|
Overview</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../HowRomeWorks/index.html" title="How Rome Works">
|
|
<i class="icon-chevron-right"></i>
|
|
How Rome Works</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../RssAndAtOMUtilitiEsROMEV0.5AndAboveTutorialsAndArticles/index.html" title="Tutorials And Articles">
|
|
<i class="none"></i>
|
|
Tutorials And Articles</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../ROMEReleases/index.html" title="Releases">
|
|
<i class="icon-chevron-right"></i>
|
|
Releases</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../ROMEDevelopmentProposals/index.html" title="ROME Development Proposals">
|
|
<i class="none"></i>
|
|
ROME Development Proposals</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../Modules/index.html" title="Modules">
|
|
<i class="icon-chevron-right"></i>
|
|
Modules</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../Fetcher/index.html" title="Fetcher">
|
|
<i class="icon-chevron-right"></i>
|
|
Fetcher</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../Opml/index.html" title="OPML">
|
|
<i class="none"></i>
|
|
OPML</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../Propono/index.html" title="Propono">
|
|
<i class="none"></i>
|
|
Propono</a>
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<a href="../Certiorem/index.html" title="Certiorem">
|
|
<i class="icon-chevron-right"></i>
|
|
Certiorem</a>
|
|
</li>
|
|
<li class="nav-header">Project Documentation</li>
|
|
|
|
<li>
|
|
|
|
<a href="../project-info.html" title="Project Information">
|
|
<i class="icon-chevron-right"></i>
|
|
Project Information</a>
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
<hr class="divider" />
|
|
|
|
<div id="poweredBy">
|
|
<div class="clear"></div>
|
|
<div class="clear"></div>
|
|
<div class="clear"></div>
|
|
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
|
|
<img class="builtBy" alt="Built by Maven" src="../images/logos/maven-feather.png" />
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div id="bodyColumn" class="span9" >
|
|
|
|
<div class="section">
|
|
<h2>Plugins Mechanism<a name="Plugins_Mechanism"></a></h2>
|
|
<p>ROME has been designed around a plugin mechanism. All the supported feed types (RSSs and Atom) is done by plugins included in the distribution.</p>
|
|
<p>Parsing feeds, generating feeds, converting feeds from a concrete feed to a SyndFeed and vice versa, parsing modules and generating modules is done using plugins.</p>
|
|
<p>Plugins for new functionality can be added and default plugins can be easily replaced with alternate plugins.</p>
|
|
<div class="section">
|
|
<h3>Plugins definition files<a name="Plugins_definition_files"></a></h3>
|
|
<p>Plugins are defined in a properties file, the <tt>rome.properties</tt> file.</p>
|
|
<p>The default plugins definition file is included in the ROME JAR file, <tt>com/sun/syndication/rome.properties</tt>, this is the first plugins definition file to be processed. It defines the default parsers, generators and converters for feeds and modules ROME provides.</p>
|
|
<p>After loading the default plugins definition file, ROME looks for additional plugins definition files in all the CLASSPATH entries, this time at root level, <tt>/rome.properties</tt>. And appends the plugins definitions to the existing ones. Note that if there are several <tt>/rome.properties</tt> files in the different CLASSPATH entries all of them are processed. The order of processing depends on how the <tt>ClassLoader</tt> processes the CLASSPATH entries, this is normally done in the order of appearance -of the entry- in the CLASSPATH.</p>
|
|
<p>For each type of plugin (parser, generator, converter, ect) a list of available plugins is built following the read order just described. The plugins classes are then loaded and instantiated. All plugins have some kind of primary key. In the case or parsers, generators and converters the primary key is the type of feed they handle. In the case of modules, the primary key is the module URI. If a plugin list definition (the aggregation of all the plugins of the same time from all the <tt>rome.properties</tt>) contains more than one plugin with the same primary key, the latter one is the one that will be used(this enables replacing default plugins with custom ones).</p>
|
|
<p>The plugins are read, loaded and managed by the implementation class <tt>com.rometools.rome.io.impl.PluginManager</tt>. This class is an abstract class and it is extended to provide support for each type of plugin.</p></div>
|
|
<div class="section">
|
|
<h3>Parser Plugins<a name="Parser_Plugins"></a></h3>
|
|
<p>Parser plugins are managed by the <tt>com.rometools.rome.io.impl.FeedParsers</tt> class (subclass of the <tt>PluginManager</tt>). This plugin manager looks for the <tt>WireFeedParser.classes</tt> property in all the <tt>rome.properties</tt> files. The fully qualified names of the parser classes must be separated by whitespaces or commas. For example, the default <tt>rome.properties</tt> file parser plugins definition is as follows:</p>
|
|
<div class="source">
|
|
<pre>
|
|
# Feed Parser implementation classes
|
|
#
|
|
WireFeedParser.classes=com.rometools.rome.io.impl.RSS090Parser \
|
|
com.rometools.rome.io.impl.RSS091NetscapeParser \
|
|
com.rometools.rome.io.impl.RSS091UserlandParser \
|
|
com.rometools.rome.io.impl.RSS092Parser \
|
|
com.rometools.rome.io.impl.RSS093Parser \
|
|
com.rometools.rome.io.impl.RSS094Parser \
|
|
com.rometools.rome.io.impl.RSS10Parser \
|
|
com.rometools.rome.io.impl.RSS20wNSParser \
|
|
com.rometools.rome.io.impl.RSS20Parser \
|
|
com.rometools.rome.io.impl.Atom03Parser
|
|
</pre></div>
|
|
<p>All the classes defined in this property have to implement the <tt>com.rometools.rome.io.WireFeedParser</tt> interface. Parser instances must be thread safe. The return value of the <tt>getType()</tt> method is used as the primary key. If more than one parser returns the same type, the latter one prevails.</p></div>
|
|
<div class="section">
|
|
<h3>Generator Plugins<a name="Generator_Plugins"></a></h3>
|
|
<p>Generator plugins are managed by the <tt>com.rometools.rome.io.impl.FeedGenerators</tt> class (subclass of the <tt>PluginManager</tt>). This plugin manager looks for the <tt>WireFeedGenerator.classes</tt> property in all the <tt>rome.properties</tt> files. The fully qualified names of the generator classes must be separated by whitespaces or commas. For example, the default <tt>rome.properties</tt> file generator plugins definition is as follows:</p>
|
|
<div class="source">
|
|
<pre>
|
|
# Feed Generator implementation classes
|
|
#
|
|
WireFeedGenerator.classes=com.rometools.rome.io.impl.RSS090Generator \
|
|
com.rometools.rome.io.impl.RSS091NetscapeGenerator \
|
|
com.rometools.rome.io.impl.RSS091UserlandGenerator \
|
|
com.rometools.rome.io.impl.RSS092Generator \
|
|
com.rometools.rome.io.impl.RSS093Generator \
|
|
com.rometools.rome.io.impl.RSS094Generator \
|
|
com.rometools.rome.io.impl.RSS10Generator \
|
|
com.rometools.rome.io.impl.RSS20Generator \
|
|
com.rometools.rome.io.impl.Atom03Generator
|
|
</pre></div>
|
|
<p>All the classes defined in this property have to implement the <tt>com.rometools.rome.io.WireFeedGenerator</tt> interface. Generator instances must be thread safe. The return value of the <tt>getType()</tt> method is used as the primary key. If more than one generator returns the same type, the latter one prevails.</p></div>
|
|
<div class="section">
|
|
<h3>Converter Plugins<a name="Converter_Plugins"></a></h3>
|
|
<p>Converter plugins are managed by the <tt>com.rometools.rome.synd.impl.Converters</tt> class (subclass of the <tt>PluginManager</tt>). This plugin manager looks for the <tt>Converter.classes</tt> property in all the <tt>rome.properties</tt> files. The fully qualified names of the converter classes must be separated by whitespaces or commas. For example, the default <tt>rome.properties</tt> file converter plugins definition is as follows:</p>
|
|
<div class="source">
|
|
<pre>
|
|
# Feed Conversor implementation classes
|
|
#
|
|
Converter.classes=com.rometools.rome.feed.synd.impl.ConverterForAtom03 \
|
|
com.rometools.rome.feed.synd.impl.ConverterForRSS090 \
|
|
com.rometools.rome.feed.synd.impl.ConverterForRSS091Netscape \
|
|
com.rometools.rome.feed.synd.impl.ConverterForRSS091Userland \
|
|
com.rometools.rome.feed.synd.impl.ConverterForRSS092 \
|
|
com.rometools.rome.feed.synd.impl.ConverterForRSS093 \
|
|
com.rometools.rome.feed.synd.impl.ConverterForRSS094 \
|
|
com.rometools.rome.feed.synd.impl.ConverterForRSS10 \
|
|
com.rometools.rome.feed.synd.impl.ConverterForRSS20
|
|
</pre></div>
|
|
<p>All the classes defined in this property have to implement the <tt>com.rometools.rome.synd.Converter</tt> interface. Converter instances must be thread safe. The return value of the <tt>getType()</tt> method is used as the primary key. If more than one converter returns the same type, the latter one prevails.</p></div>
|
|
<div class="section">
|
|
<h3>Module Plugins<a name="Module_Plugins"></a></h3>
|
|
<p>There are 2 types of module plugins, module parser plugins and module generator plugins. They use a same pattern feed parsers and generators use.</p>
|
|
<p>The main difference is that support for module plugins has to be wired in the feed parser and generator plugins. The default feed parser and generator plugins supporting module plugins are: RSS 1.0, RSS 2.0 and Atom 0.3.</p>
|
|
<p>It is important to understand that this wiring is for modules support. Once a feed parser or generator has modules support, new modules can be used just by adding them to right property in the <tt>rome.properties</tt> file. No code changes are required.</p>
|
|
<p>Module parsers and generators are defined at feed and item level. This allow selective handling of modules, for example handling Syndication module at feed level only.</p>
|
|
<p>Module parser plugins are managed by the <tt>com.rometools.rome.io.impl.ModuleParsers</tt> class (subclass of the <tt>PluginManager</tt>). This plugin manager looks for the <tt>.feed.ModuleParser.classes</tt> and the <tt>.item.ModuleParser.classes</tt> properties in all the <tt>rome.properties</tt> files. must be the type defined by the parser (ie: rss_1.0, atom_0.3). The fully qualified names of the module parser classes must be separated by whitespaces or commas. For example, the default <tt>rome.properties</tt> file modules parser plugins definition is as follows:</p>
|
|
<div class="source">
|
|
<pre>
|
|
# Parsers for Atom 0.3 feed modules
|
|
#
|
|
atom_0.3.feed.ModuleParser.classes=com.rometools.rome.io.impl.SyModuleParser \
|
|
com.rometools.rome.io.impl.DCModuleParser
|
|
|
|
# Parsers for Atom 0.3 entry modules
|
|
#
|
|
atom_0.3.item.ModuleParser.classes=com.rometools.rome.io.impl.DCModuleParser
|
|
|
|
# Parsers for RSS 1.0 feed modules
|
|
#
|
|
rss_1.0.feed.ModuleParser.classes=com.rometools.rome.io.impl.SyModuleParser \
|
|
com.rometools.rome.io.impl.DCModuleParser
|
|
|
|
# Parsers for RSS 1.0 item modules
|
|
#
|
|
rss_1.0.item.ModuleParser.classes=com.rometools.rome.io.impl.DCModuleParser
|
|
|
|
# Parsers for RSS 2.0 feed modules
|
|
#
|
|
rss_2.0.feed.ModuleParser.classes=
|
|
|
|
# Parsers for RSS 2.0 item modules
|
|
#
|
|
rss_2.0.item.ModuleParser.classes=
|
|
</pre></div>
|
|
<p>All the classes defined in this property have to implement the <tt>com.rometools.rome.io.ModuleParser</tt> interface. ModuleParser instances must be thread safe. The return value of the <tt>getNamesapceUri()</tt> method is used as the primary key. If more than one module parser returns the same URI, the latter one prevails.</p>
|
|
<p>Module generator plugins are managed by the <tt>com.rometools.rome.io.impl.GeneratorParsers</tt> class (subclass of the <tt>PluginManager</tt>). This plugin manager looks for the <tt>.feed.ModuleGenerator.classes</tt> and the <tt>.item.ModuleGenerator.classes</tt> properties in all the <tt>rome.properties</tt> files. must be the type defined by the generator (ie: rss_1.0, atom_0.3). The fully qualified names of the module generator classes must be separated by whitespaces or commas. For example, the default <tt>rome.properties</tt> file modules generator plugins definition is as follows:</p>
|
|
<div class="source">
|
|
<pre>
|
|
# Generators for Atom 0.3 feed modules
|
|
#
|
|
atom_0.3.feed.ModuleGenerator.classes=com.rometools.rome.io.impl.SyModuleGenerator \
|
|
com.rometools.rome.io.impl.DCModuleGenerator
|
|
|
|
# Generators for Atom 0.3 entry modules
|
|
#
|
|
atom_0.3.item.ModuleGenerator.classes=com.rometools.rome.io.impl.DCModuleGenerator
|
|
|
|
# Generators for RSS 1.0 feed modules
|
|
#
|
|
rss_1.0.feed.ModuleGenerator.classes=com.rometools.rome.io.impl.SyModuleGenerator \
|
|
com.rometools.rome.io.impl.DCModuleGenerator
|
|
|
|
# Generators for RSS_1.0 entry modules
|
|
#
|
|
rss_1.0.item.ModuleGenerator.classes=com.rometools.rome.io.impl.DCModuleGenerator
|
|
|
|
# Generators for RSS 2.0 feed modules
|
|
#
|
|
rss_2.0.feed.ModuleGenerator.classes=
|
|
|
|
# Generators for RSS_2.0 entry modules
|
|
#
|
|
rss_2.0.item.ModuleGenerator.classes=
|
|
</pre></div>
|
|
<p>All the classes defined in this property have to implement the <tt>com.rometools.rome.io.ModuleGenerator</tt> interface. ModuleGenerator instances must be thread safe. The return value of the <tt>getNamesapceUri()</tt> method is used as the primary key. If more than one module generator returns the same URI, the latter one prevails.</p>
|
|
<p>See also: a step-by-step <a href="./RssAndAtOMUtilitiEsROMEV0.5TutorialDefiningACustomModuleBeanParserAndGenerator.html">tutorial for implementing a custom module</a>.</p></div></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<footer>
|
|
<div class="container-fluid">
|
|
<div class="row span12">Copyright © 2016.
|
|
All Rights Reserved.
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|