Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NucthAnalyzer is now Configurable (Teruhiko Kurosaka)

Jerome Charron08766b1511ad
diff --git a/src/java/org/apache/nutch/analysis/NutchAnalyzer.java b/src/java/org/apache/nutch/analysis/NutchAnalyzer.java
index 6fec6952d..8d94e7a9a 100644
--- a/src/java/org/apache/nutch/analysis/NutchAnalyzer.java
+++ b/src/java/org/apache/nutch/analysis/NutchAnalyzer.java
@@ -22,6 +22,10 @@ import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
+// Hadoop imports
+import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.conf.Configuration;
+
// Nutch imports
import org.apache.nutch.plugin.Pluggable;
@@ -34,16 +38,37 @@ import org.apache.nutch.plugin.Pluggable;
* @author Jérôme Charron
*/
public abstract class NutchAnalyzer extends Analyzer
- implements Pluggable {
+ implements Configurable, Pluggable {
/** The name of the extension point. */
final static String X_POINT_ID = NutchAnalyzer.class.getName();
+ /** The current Configuration */
+ protected Configuration conf = null;
+
/**
* Creates a TokenStream which tokenizes all the text in the provided Reader.
*/
public abstract TokenStream tokenStream(String fieldName, Reader reader);
-
+
+ /* ----------------------------- *
+ * <implementation:Configurable> *
+ * ----------------------------- */
+
+ // Inherited Javadoc
+ public void setConf(Configuration conf) {
+ this.conf = conf;
+ }
+
+ // Inherited Javadoc
+ public Configuration getConf() {
+ return this.conf;
+ }
+
+ /* ------------------------------ *
+ * </implementation:Configurable> *
+ * ------------------------------ */
+
}