标签:nutch2.2.1 配置文件
public static Configuration create() {
Configuration conf = new Configuration();
setUUID(conf);
addNutchResources(conf);
return conf;
} private static Configuration addNutchResources(Configuration conf) {
conf.addResource("nutch-default.xml");
conf.addResource("nutch-site.xml");
return conf;
}/** Create a {@link Configuration} from supplied properties.
* @param addNutchResources if true, then first <code>nutch-default.xml</code>,
* and then <code>nutch-site.xml</code> will be loaded prior to applying the
* properties. Otherwise these resources won't be used.
* @param nutchProperties a set of properties to define (or override)
*/
public static Configuration create(boolean addNutchResources, Properties nutchProperties) {
Configuration conf = new Configuration();
setUUID(conf);
if (addNutchResources) {
addNutchResources(conf);
}
for (Entry<Object, Object> e : nutchProperties.entrySet()) {
conf.set(e.getKey().toString(), e.getValue().toString());
}
return conf;
} private NutchConfiguration() {} // singleton public static void main(String[] args) throws Exception {
final int res = ToolRunner.run(NutchConfiguration.create(),
new SolrIndexerJob(), args);
System.exit(res);
}
【Nutch2.2.1源码分析之一】Nutch加载配置文件的方法
标签:nutch2.2.1 配置文件
原文地址:http://blog.csdn.net/jediael_lu/article/details/38762433