Author: jerome Date: Fri Mar 31 03:04:43 2006 New Revision: 390392 URL: http://svn.apache.org/viewcvs?rev=390392&view=rev Log: Add a common Pluggable interface to all Extension Points and a package description for plugin
Added: lucene/nutch/trunk/src/java/org/apache/nutch/plugin/Pluggable.java (with props) lucene/nutch/trunk/src/java/org/apache/nutch/plugin/package.html (with props) Modified: lucene/nutch/trunk/src/java/org/apache/nutch/analysis/NutchAnalyzer.java lucene/nutch/trunk/src/java/org/apache/nutch/clustering/OnlineClusterer.java lucene/nutch/trunk/src/java/org/apache/nutch/indexer/IndexingFilter.java lucene/nutch/trunk/src/java/org/apache/nutch/net/URLFilter.java lucene/nutch/trunk/src/java/org/apache/nutch/ontology/Ontology.java lucene/nutch/trunk/src/java/org/apache/nutch/parse/HtmlParseFilter.java lucene/nutch/trunk/src/java/org/apache/nutch/parse/Parser.java lucene/nutch/trunk/src/java/org/apache/nutch/protocol/Protocol.java lucene/nutch/trunk/src/java/org/apache/nutch/searcher/QueryFilter.java Modified: lucene/nutch/trunk/src/java/org/apache/nutch/analysis/NutchAnalyzer.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/analysis/NutchAnalyzer.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/analysis/NutchAnalyzer.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/analysis/NutchAnalyzer.java Fri Mar 31 03:04:43 2006 @@ -22,6 +22,9 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; +// Nutch imports +import org.apache.nutch.plugin.Pluggable; + /** * Extension point for analysis. @@ -30,7 +33,8 @@ * * @author Jérôme Charron */ -public abstract class NutchAnalyzer extends Analyzer { +public abstract class NutchAnalyzer extends Analyzer + implements Pluggable { /** The name of the extension point. */ final static String X_POINT_ID = NutchAnalyzer.class.getName(); Modified: lucene/nutch/trunk/src/java/org/apache/nutch/clustering/OnlineClusterer.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/clustering/OnlineClusterer.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/clustering/OnlineClusterer.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/clustering/OnlineClusterer.java Fri Mar 31 03:04:43 2006 @@ -16,8 +16,11 @@ package org.apache.nutch.clustering; +// Nutch imports +import org.apache.nutch.plugin.Pluggable; import org.apache.nutch.searcher.HitDetails; + /** * An extension point interface for online search results clustering * algorithms. @@ -33,7 +36,7 @@ * @author Dawid Weiss * @version $Id: OnlineClusterer.java,v 1.1 2004/08/09 23:23:52 johnnx Exp $ */ -public interface OnlineClusterer { +public interface OnlineClusterer extends Pluggable { /** The name of the extension point. */ public final static String X_POINT_ID = OnlineClusterer.class.getName(); Modified: lucene/nutch/trunk/src/java/org/apache/nutch/indexer/IndexingFilter.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/indexer/IndexingFilter.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/indexer/IndexingFilter.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/indexer/IndexingFilter.java Fri Mar 31 03:04:43 2006 @@ -16,18 +16,25 @@ package org.apache.nutch.indexer; +// Lucene imports import org.apache.lucene.document.Document; -import org.apache.nutch.parse.Parse; + +// Hadoop imports import org.apache.hadoop.conf.Configurable; +import org.apache.hadoop.io.UTF8; + +// Nutch imports +import org.apache.nutch.parse.Parse; import org.apache.nutch.crawl.CrawlDatum; import org.apache.nutch.crawl.Inlinks; -import org.apache.hadoop.io.UTF8; +import org.apache.nutch.plugin.Pluggable; + /** Extension point for indexing. Permits one to add metadata to the indexed * fields. All plugins found which implement this extension point are run * sequentially on the parse. */ -public interface IndexingFilter extends Configurable { +public interface IndexingFilter extends Pluggable, Configurable { /** The name of the extension point. */ final static String X_POINT_ID = IndexingFilter.class.getName(); Modified: lucene/nutch/trunk/src/java/org/apache/nutch/net/URLFilter.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/net/URLFilter.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/net/URLFilter.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/net/URLFilter.java Fri Mar 31 03:04:43 2006 @@ -16,14 +16,19 @@ package org.apache.nutch.net; +// Hadoop imports import org.apache.hadoop.conf.Configurable; +// Nutch imports +import org.apache.nutch.plugin.Pluggable; + + /** * Interface used to limit which URLs enter Nutch. * Used by the injector and the db updater. */ -public interface URLFilter extends Configurable { +public interface URLFilter extends Pluggable, Configurable { /** The name of the extension point. */ public final static String X_POINT_ID = URLFilter.class.getName(); Modified: lucene/nutch/trunk/src/java/org/apache/nutch/ontology/Ontology.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/ontology/Ontology.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/ontology/Ontology.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/ontology/Ontology.java Fri Mar 31 03:04:43 2006 @@ -16,9 +16,14 @@ package org.apache.nutch.ontology; +// JDK imports import java.util.Iterator; -public interface Ontology { +// Nutch imports +import org.apache.nutch.plugin.Pluggable; + + +public interface Ontology extends Pluggable { /** The name of the extension point. */ public final static String X_POINT_ID = Ontology.class.getName(); Modified: lucene/nutch/trunk/src/java/org/apache/nutch/parse/HtmlParseFilter.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/parse/HtmlParseFilter.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/parse/HtmlParseFilter.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/parse/HtmlParseFilter.java Fri Mar 31 03:04:43 2006 @@ -16,16 +16,22 @@ package org.apache.nutch.parse; -import org.apache.nutch.protocol.Content; +// JDK imports +import org.w3c.dom.DocumentFragment; + +// Hadoop imports import org.apache.hadoop.conf.Configurable; -import org.w3c.dom.DocumentFragment; +// Nutch imports +import org.apache.nutch.plugin.Pluggable; +import org.apache.nutch.protocol.Content; + /** Extension point for DOM-based HTML parsers. Permits one to add additional * metadata to HTML parses. All plugins found which implement this extension * point are run sequentially on the parse. */ -public interface HtmlParseFilter extends Configurable { +public interface HtmlParseFilter extends Pluggable, Configurable { /** The name of the extension point. */ final static String X_POINT_ID = HtmlParseFilter.class.getName(); Modified: lucene/nutch/trunk/src/java/org/apache/nutch/parse/Parser.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/parse/Parser.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/parse/Parser.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/parse/Parser.java Fri Mar 31 03:04:43 2006 @@ -16,14 +16,18 @@ package org.apache.nutch.parse; -import org.apache.nutch.protocol.Content; +// Hadoop imports import org.apache.hadoop.conf.Configurable; +// Nutch imports +import org.apache.nutch.plugin.Pluggable; +import org.apache.nutch.protocol.Content; + /** A parser for content generated by a [EMAIL PROTECTED] org.apache.nutch.protocol.Protocol} * implementation. This interface is implemented by extensions. Nutch's core * contains no page parsing code. */ -public interface Parser extends Configurable { +public interface Parser extends Pluggable, Configurable { /** The name of the extension point. */ public final static String X_POINT_ID = Parser.class.getName(); Added: lucene/nutch/trunk/src/java/org/apache/nutch/plugin/Pluggable.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/plugin/Pluggable.java?rev=390392&view=auto ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/plugin/Pluggable.java (added) +++ lucene/nutch/trunk/src/java/org/apache/nutch/plugin/Pluggable.java Fri Mar 31 03:04:43 2006 @@ -0,0 +1,31 @@ +/** + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nutch.plugin; + +/** + * Defines the capability of a class to be plugged into Nutch. + * This is a common interface that must be implemented by all + * Nutch Extension Points. + * + * @author Jérôme Charron + * + * @see <a href="http://wiki.apache.org/nutch/AboutPlugins">About Plugins</a> + * @see <a href="package-summary.html#package_description"> + * plugin package description</a> + */ +public interface Pluggable { + +} Propchange: lucene/nutch/trunk/src/java/org/apache/nutch/plugin/Pluggable.java ------------------------------------------------------------------------------ svn:eol-style = native Added: lucene/nutch/trunk/src/java/org/apache/nutch/plugin/package.html URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/plugin/package.html?rev=390392&view=auto ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/plugin/package.html (added) +++ lucene/nutch/trunk/src/java/org/apache/nutch/plugin/package.html Fri Mar 31 03:04:43 2006 @@ -0,0 +1,38 @@ +<html> +<body> +The Nutch [EMAIL PROTECTED] org.apache.nutch.plugin.Pluggable Plugin} System. +<p> +<b>The Nutch Plugin System provides a way to extend nutch functionality</b>. +A large part of the functionality of Nutch are provided by plugins: +All of the parsing, indexing and searching that nutch does is actually +accomplished by various plugins. +</p><p> +In writing a plugin, you're actually providing one or more extensions of the +existing extension-points (<i>hooks</i>). +The core Nutch extension-points are themselves defined in a plugin, +the <code>nutch-extensionpoints</code> plugin. +Each extension-point defines an interface that must be implemented by the +extension. The core extension-points and extensions available in Nutch are +listed in the [EMAIL PROTECTED] org.apache.nutch.plugin.Pluggable} interface. +</p> + [EMAIL PROTECTED] <a href="http://wiki.apache.org/nutch/PluginCentral"> + Plugin Central + </a> [EMAIL PROTECTED] <a href="http://wiki.apache.org/nutch/AboutPlugins"> + About Plugins + </a> [EMAIL PROTECTED] <a href="http://wiki.apache.org/nutch/WhyNutchHasAPluginSystem"> + Why Nutch has a Plugin System? + </a> [EMAIL PROTECTED] <a href="http://wiki.apache.org/nutch/WhichTechnicalConceptsAreBehindTheNutchPluginSystem"> + Which technical concepts are behind the nutch plugin system? + </a> [EMAIL PROTECTED] <a href="http://wiki.apache.org/nutch/WhatsTheProblemWithPluginsAndClass-loading"> + What's the problem with Plugins and Class loading? + </a> [EMAIL PROTECTED] <a href="http://wiki.apache.org/nutch/WritingPluginExample"> + Writing Plugin Example + </a> +</body> +</html> Propchange: lucene/nutch/trunk/src/java/org/apache/nutch/plugin/package.html ------------------------------------------------------------------------------ svn:eol-style = native Modified: lucene/nutch/trunk/src/java/org/apache/nutch/protocol/Protocol.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/protocol/Protocol.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/protocol/Protocol.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/protocol/Protocol.java Fri Mar 31 03:04:43 2006 @@ -16,12 +16,17 @@ package org.apache.nutch.protocol; -import org.apache.nutch.crawl.CrawlDatum; -import org.apache.hadoop.io.UTF8; +// Hadoop imports import org.apache.hadoop.conf.Configurable; +import org.apache.hadoop.io.UTF8; + +// Nutch imports +import org.apache.nutch.crawl.CrawlDatum; +import org.apache.nutch.plugin.Pluggable; + /** A retriever of url content. Implemented by protocol extensions. */ -public interface Protocol extends Configurable { +public interface Protocol extends Pluggable, Configurable { /** The name of the extension point. */ public final static String X_POINT_ID = Protocol.class.getName(); Modified: lucene/nutch/trunk/src/java/org/apache/nutch/searcher/QueryFilter.java URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/searcher/QueryFilter.java?rev=390392&r1=390391&r2=390392&view=diff ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/searcher/QueryFilter.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/searcher/QueryFilter.java Fri Mar 31 03:04:43 2006 @@ -16,14 +16,21 @@ package org.apache.nutch.searcher; +// Lucene imports import org.apache.lucene.search.BooleanQuery; + +// Hadoop imports import org.apache.hadoop.conf.Configurable; +// Nutch imports +import org.apache.nutch.plugin.Pluggable; + + /** Extension point for query translation. Permits one to add metadata to a * query. All plugins found which implement this extension point are run * sequentially on the query. */ -public interface QueryFilter extends Configurable { +public interface QueryFilter extends Pluggable, Configurable { /** The name of the extension point. */ final static String X_POINT_ID = QueryFilter.class.getName();