diff --git a/docs/index.rst b/docs/index.rst index 1791e37..2b24161 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,14 +1,18 @@ +############################# +Software Artifact Processor +############################# + This library has been initially designed to deposit software artifacts programmatically in Zenodo. It is actually a general-purpose library capable of analyzing a list of -software artifacts (represented by the metadata) and export them. +software artifacts (represented by the metadata) and process them. -The library currently offers two exporters: +The library currently offers two processors: * **ZenodoExporter**: deposit the software artifact in Zenodo obtaining a DOI; * **BibLaTeXExporter**: export the software artifact in a ``bib`` file using the BibLaTeX format. -Other exporters can be easily added in the future by extending the ``SoftwareArtifactExporter`` class. +Other processors can be easily added in the future by extending the ``SoftwareArtifactProcessor`` class. The core class of the library is Analyser, which must be initialized with: diff --git a/src/main/java/org/gcube/common/software/analyser/Analyser.java b/src/main/java/org/gcube/common/software/analyser/Analyser.java index bceb169..9745fd9 100644 --- a/src/main/java/org/gcube/common/software/analyser/Analyser.java +++ b/src/main/java/org/gcube/common/software/analyser/Analyser.java @@ -13,7 +13,7 @@ import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode; import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode; -import org.gcube.common.software.export.SoftwareArtifactExporter; +import org.gcube.common.software.export.SoftwareArtifactProcessor; import org.gcube.common.software.model.ExporterConfig; import org.gcube.common.software.model.GlobalConfig; import org.gcube.common.software.model.SoftwareArtifactConfig; @@ -118,7 +118,7 @@ public class Analyser { GlobalConfig globalConfig = getGlobalConfig(globalConfiguration); - Map> availableExporters = SoftwareArtifactExporter.getAvailableExporters(); + Map> availableExporters = SoftwareArtifactProcessor.getAvailableExporters(); Map requestedExporters = globalConfig.getExporters(); checkExporters(availableExporters.keySet(), requestedExporters.keySet()); @@ -148,12 +148,12 @@ public class Analyser { for(String className : requestedExporters.keySet()) { logger.debug("Going to export with {}", className); - Class exporterClass = availableExporters.get(className); + Class exporterClass = availableExporters.get(className); ExporterConfig exporterConfig = requestedExporters.get(className); exporterConfig = actualizeExporterConfig(exporterConfig, softwareVersionConfig); - SoftwareArtifactExporter sve = exporterClass.newInstance(); + SoftwareArtifactProcessor sve = exporterClass.newInstance(); sve.setOutputDirectory(outputDirectory); sve.setGlobalConfig(globalConfig); sve.setSoftwareVersionConfig(softwareVersionConfig); diff --git a/src/main/java/org/gcube/common/software/export/SoftwareArtifactExporter.java b/src/main/java/org/gcube/common/software/export/SoftwareArtifactProcessor.java similarity index 79% rename from src/main/java/org/gcube/common/software/export/SoftwareArtifactExporter.java rename to src/main/java/org/gcube/common/software/export/SoftwareArtifactProcessor.java index d931c88..a345261 100644 --- a/src/main/java/org/gcube/common/software/export/SoftwareArtifactExporter.java +++ b/src/main/java/org/gcube/common/software/export/SoftwareArtifactProcessor.java @@ -13,22 +13,22 @@ import org.gcube.common.software.model.SoftwareArtifactConfig; /** * @author Luca Frosini (ISTI - CNR) */ -public abstract class SoftwareArtifactExporter { +public abstract class SoftwareArtifactProcessor { - protected static Map> availableExporters; + protected static Map> availableProcessors; static { - availableExporters = new HashMap<>(); + availableProcessors = new HashMap<>(); add(ZenodoExporter.class); add(BibLaTeXExporter.class); } - private static void add(Class clz) { - availableExporters.put(clz.getSimpleName(), clz); + private static void add(Class clz) { + availableProcessors.put(clz.getSimpleName(), clz); } - public static Map> getAvailableExporters() { - return availableExporters; + public static Map> getAvailableExporters() { + return availableProcessors; } protected File outputDirectory; @@ -41,7 +41,7 @@ public abstract class SoftwareArtifactExporter { protected final String exportFileNameExtension; - protected SoftwareArtifactExporter(String exportFileNameExtension) { + protected SoftwareArtifactProcessor(String exportFileNameExtension) { this.exportFileNameExtension = exportFileNameExtension; } diff --git a/src/main/java/org/gcube/common/software/export/biblatex/BibLaTeXExporter.java b/src/main/java/org/gcube/common/software/export/biblatex/BibLaTeXExporter.java index 5f1d69c..024bc3f 100644 --- a/src/main/java/org/gcube/common/software/export/biblatex/BibLaTeXExporter.java +++ b/src/main/java/org/gcube/common/software/export/biblatex/BibLaTeXExporter.java @@ -9,7 +9,7 @@ import java.util.Set; import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode; -import org.gcube.common.software.export.SoftwareArtifactExporter; +import org.gcube.common.software.export.SoftwareArtifactProcessor; import org.gcube.common.software.model.ElaborationType; import org.gcube.common.software.model.Variables; import org.gcube.common.software.utils.FileUtils; @@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory; /** * @author Luca Frosini (ISTI - CNR) */ -public class BibLaTeXExporter extends SoftwareArtifactExporter { +public class BibLaTeXExporter extends SoftwareArtifactProcessor { private static final Logger logger = LoggerFactory.getLogger(BibLaTeXExporter.class); diff --git a/src/main/java/org/gcube/common/software/export/zenodo/ZenodoExporter.java b/src/main/java/org/gcube/common/software/export/zenodo/ZenodoExporter.java index 43f37c7..d92a891 100644 --- a/src/main/java/org/gcube/common/software/export/zenodo/ZenodoExporter.java +++ b/src/main/java/org/gcube/common/software/export/zenodo/ZenodoExporter.java @@ -30,7 +30,7 @@ import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode; import org.gcube.common.gxhttp.request.GXHTTPStringRequest; import org.gcube.common.software.analyser.AnalyserFactory; import org.gcube.common.software.config.Config; -import org.gcube.common.software.export.SoftwareArtifactExporter; +import org.gcube.common.software.export.SoftwareArtifactProcessor; import org.gcube.common.software.model.ElaborationType; import org.gcube.common.software.model.SoftwareArtifactConfig; import org.gcube.common.software.model.SoftwareArtifactFile; @@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory; /** * @author Luca Frosini (ISTI - CNR) */ -public class ZenodoExporter extends SoftwareArtifactExporter { +public class ZenodoExporter extends SoftwareArtifactProcessor { private static final Logger logger = LoggerFactory.getLogger(ZenodoExporter.class);