2020-04-27 14:52:31 +02:00
|
|
|
|
2019-10-24 11:36:59 +02:00
|
|
|
package eu.dnetlib.dhp.collection.worker;
|
|
|
|
|
2019-10-03 12:22:44 +02:00
|
|
|
import org.apache.commons.io.IOUtils;
|
2019-04-03 16:05:16 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2020-04-28 11:23:29 +02:00
|
|
|
import eu.dnetlib.dhp.application.ArgumentApplicationParser;
|
|
|
|
import eu.dnetlib.dhp.collection.worker.utils.CollectorPluginFactory;
|
|
|
|
import eu.dnetlib.message.MessageManager;
|
|
|
|
|
2019-04-03 16:05:16 +02:00
|
|
|
/**
|
2020-04-27 14:52:31 +02:00
|
|
|
* DnetCollectortWorkerApplication is the main class responsible to start the Dnet Collection into HDFS. This module
|
|
|
|
* will be executed on the hadoop cluster and taking in input some parameters that tells it which is the right collector
|
|
|
|
* plugin to use and where store the data into HDFS path
|
2019-04-03 16:05:16 +02:00
|
|
|
*
|
|
|
|
* @author Sandro La Bruzzo
|
|
|
|
*/
|
2019-10-02 14:45:12 +02:00
|
|
|
public class DnetCollectorWorkerApplication {
|
2019-04-03 16:05:16 +02:00
|
|
|
|
2020-04-27 14:52:31 +02:00
|
|
|
private static final Logger log = LoggerFactory.getLogger(DnetCollectorWorkerApplication.class);
|
|
|
|
|
2020-04-29 19:09:07 +02:00
|
|
|
private static final CollectorPluginFactory collectorPluginFactory = new CollectorPluginFactory();
|
2020-04-27 14:52:31 +02:00
|
|
|
|
|
|
|
private static ArgumentApplicationParser argumentParser;
|
|
|
|
|
|
|
|
/** @param args */
|
|
|
|
public static void main(final String[] args) throws Exception {
|
|
|
|
|
|
|
|
argumentParser = new ArgumentApplicationParser(
|
|
|
|
IOUtils
|
|
|
|
.toString(
|
|
|
|
DnetCollectorWorker.class
|
|
|
|
.getResourceAsStream(
|
|
|
|
"/eu/dnetlib/collector/worker/collector_parameter.json")));
|
|
|
|
argumentParser.parseArgument(args);
|
|
|
|
log.info("hdfsPath =" + argumentParser.get("hdfsPath"));
|
|
|
|
log.info("json = " + argumentParser.get("apidescriptor"));
|
|
|
|
final MessageManager manager = new MessageManager(
|
|
|
|
argumentParser.get("rabbitHost"),
|
|
|
|
argumentParser.get("rabbitUser"),
|
|
|
|
argumentParser.get("rabbitPassword"),
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
null);
|
|
|
|
final DnetCollectorWorker worker = new DnetCollectorWorker(collectorPluginFactory, argumentParser, manager);
|
|
|
|
worker.collect();
|
|
|
|
}
|
2019-04-03 16:05:16 +02:00
|
|
|
}
|