Apache Nutch is an extensible and scalable web crawler
NUTCH-2718: file names of configuration files of index writers and exchanges are configurable.
r0ann3l6f5eab3aa355
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xmlindex 41a337a02..fd201c7de 100644--- a/conf/nutch-default.xml+++ b/conf/nutch-default.xml@@ -1314,6 +1314,20 @@</description></property>+<property>+ <name>indexer.indexwriters.file</name>+ <value>index-writers.xml</value>+ <description>The configuration file for index writers.</description>+</property>++<!-- Exchanges properties -->++<property>+ <name>exchanges.exchanges.file</name>+ <value>exchanges.xml</value>+ <description>The configuration file used by the Exchange component.</description>+</property>+<!-- URL normalizer properties --><property>diff --git a/src/java/org/apache/nutch/exchange/Exchanges.java b/src/java/org/apache/nutch/exchange/Exchanges.javaindex 1f443d4c1..1e0518b6b 100644--- a/src/java/org/apache/nutch/exchange/Exchanges.java+++ b/src/java/org/apache/nutch/exchange/Exchanges.java@@ -96,8 +96,10 @@ public class Exchanges {* @return An array with each exchange's configuration.*/private ExchangeConfig[] loadConfigurations(Configuration conf) {+ String filename = conf.get("exchanges.exchanges.file",+ "exchanges.xml");InputSource inputSource = new InputSource(- conf.getConfResourceAsInputStream("exchanges.xml"));+ conf.getConfResourceAsInputStream(filename));final List<ExchangeConfig> configList = new LinkedList<>();@@ -120,7 +122,7 @@ public class Exchanges {}} catch (SAXException | IOException | ParserConfigurationException e) {- LOG.warn(e.toString());+ LOG.error(e.toString());}return configList.toArray(new ExchangeConfig[0]);diff --git a/src/java/org/apache/nutch/indexer/IndexWriters.java b/src/java/org/apache/nutch/indexer/IndexWriters.javaindex 9fac2e2fe..96232aad6 100644--- a/src/java/org/apache/nutch/indexer/IndexWriters.java+++ b/src/java/org/apache/nutch/indexer/IndexWriters.java@@ -115,8 +115,10 @@ public class IndexWriters {* @param conf Nutch configuration instance.*/private IndexWriterConfig[] loadWritersConfiguration(Configuration conf) {+ String filename = conf.get("indexer.indexwriters.file",+ "index-writers.xml");InputStream ssInputStream = conf- .getConfResourceAsInputStream("index-writers.xml");+ .getConfResourceAsInputStream(filename);InputSource inputSource = new InputSource(ssInputStream);try {@@ -136,7 +138,7 @@ public class IndexWriters {return indexWriterConfigs;} catch (SAXException | IOException | ParserConfigurationException e) {- LOG.warn(e.toString());+ LOG.error(e.toString());return new IndexWriterConfig[0];}}