2020-04-29 13:24:29 +02:00
|
|
|
|
2020-04-24 15:50:40 +02:00
|
|
|
package eu.dnetlib.doiboost.orcid;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
2020-04-29 13:24:29 +02:00
|
|
|
|
2020-04-24 15:50:40 +02:00
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
|
import org.mortbay.log.Log;
|
|
|
|
|
2020-04-29 13:24:29 +02:00
|
|
|
import eu.dnetlib.dhp.application.ArgumentApplicationParser;
|
|
|
|
|
2020-04-24 15:50:40 +02:00
|
|
|
public class OrcidAuthorsDOIsDataGen extends OrcidDSManager {
|
|
|
|
|
2020-04-29 13:24:29 +02:00
|
|
|
private String activitiesFileNameTarGz;
|
|
|
|
private String outputAuthorsDOIsPath;
|
|
|
|
|
2021-05-14 10:58:12 +02:00
|
|
|
public static void main(String[] args) throws Exception {
|
2020-04-29 13:24:29 +02:00
|
|
|
OrcidAuthorsDOIsDataGen orcidAuthorsDOIsDataGen = new OrcidAuthorsDOIsDataGen();
|
|
|
|
orcidAuthorsDOIsDataGen.loadArgs(args);
|
|
|
|
orcidAuthorsDOIsDataGen.generateAuthorsDOIsData();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void generateAuthorsDOIsData() throws Exception {
|
|
|
|
Configuration conf = initConfigurationObject();
|
|
|
|
FileSystem fs = initFileSystemObject(conf);
|
2020-07-03 23:30:31 +02:00
|
|
|
String tarGzUri = hdfsServerUri.concat(workingPath).concat(activitiesFileNameTarGz);
|
|
|
|
Path outputPath = new Path(hdfsServerUri.concat(workingPath).concat(outputAuthorsDOIsPath));
|
2020-04-29 13:24:29 +02:00
|
|
|
ActivitiesDecompressor.parseGzActivities(conf, tarGzUri, outputPath);
|
|
|
|
}
|
|
|
|
|
2021-05-14 10:58:12 +02:00
|
|
|
private void loadArgs(String[] args) throws Exception {
|
2020-04-29 13:24:29 +02:00
|
|
|
final ArgumentApplicationParser parser = new ArgumentApplicationParser(
|
|
|
|
IOUtils
|
|
|
|
.toString(
|
|
|
|
OrcidAuthorsDOIsDataGen.class
|
|
|
|
.getResourceAsStream(
|
|
|
|
"/eu/dnetlib/dhp/doiboost/create_orcid_authors_dois_data.json")));
|
|
|
|
parser.parseArgument(args);
|
|
|
|
|
|
|
|
hdfsServerUri = parser.get("hdfsServerUri");
|
|
|
|
Log.info("HDFS URI: " + hdfsServerUri);
|
2020-07-03 23:30:31 +02:00
|
|
|
workingPath = parser.get("workingPath");
|
|
|
|
Log.info("Default Path: " + workingPath);
|
2020-04-29 13:24:29 +02:00
|
|
|
activitiesFileNameTarGz = parser.get("activitiesFileNameTarGz");
|
|
|
|
Log.info("Activities File Name: " + activitiesFileNameTarGz);
|
|
|
|
outputAuthorsDOIsPath = parser.get("outputAuthorsDOIsPath");
|
|
|
|
Log.info("Output Authors DOIs Data: " + outputAuthorsDOIsPath);
|
|
|
|
}
|
2020-04-24 15:50:40 +02:00
|
|
|
}
|