This is an automated email from the ASF dual-hosted git repository.
r0ann3l pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nutch.git
The following commit(s) were added to refs/heads/master by this push:
new 6f5eab3 NUTCH-2718: file names of configuration files of index
writers and exchanges are configurable.
new 6e54f72 Merge pull request #466 from r0ann3l/NUTCH-2718
6f5eab3 is described below
commit 6f5eab3aa35578f24f15ab4fbb44e71a656b9f5b
Author: r0ann3l <[email protected]>
AuthorDate: Wed Aug 28 14:24:10 2019 -0400
NUTCH-2718: file names of configuration files of index writers and
exchanges are configurable.
---
conf/nutch-default.xml | 14 ++++++++++++++
src/java/org/apache/nutch/exchange/Exchanges.java | 6 ++++--
src/java/org/apache/nutch/indexer/IndexWriters.java | 6 ++++--
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xml
index 41a337a..fd201c7 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.java
index 1f443d4..1e0518b 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.java
index 9fac2e2..96232aa 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];
}
}