Improving naming

This commit is contained in:
luca.frosini 2023-08-30 18:03:06 +02:00
parent b03e4e39b6
commit 967027a3c0
5 changed files with 23 additions and 19 deletions

View File

@ -1,14 +1,18 @@
#############################
Software Artifact Processor
#############################
This library has been initially designed to deposit software artifacts programmatically in Zenodo. 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 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; * **ZenodoExporter**: deposit the software artifact in Zenodo obtaining a DOI;
* **BibLaTeXExporter**: export the software artifact in a ``bib`` file using the BibLaTeX format. * **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: The core class of the library is Analyser, which must be initialized with:

View File

@ -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.ObjectMapper;
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode; import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode; 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.ExporterConfig;
import org.gcube.common.software.model.GlobalConfig; import org.gcube.common.software.model.GlobalConfig;
import org.gcube.common.software.model.SoftwareArtifactConfig; import org.gcube.common.software.model.SoftwareArtifactConfig;
@ -118,7 +118,7 @@ public class Analyser {
GlobalConfig globalConfig = getGlobalConfig(globalConfiguration); GlobalConfig globalConfig = getGlobalConfig(globalConfiguration);
Map<String, Class<? extends SoftwareArtifactExporter>> availableExporters = SoftwareArtifactExporter.getAvailableExporters(); Map<String, Class<? extends SoftwareArtifactProcessor>> availableExporters = SoftwareArtifactProcessor.getAvailableExporters();
Map<String,ExporterConfig> requestedExporters = globalConfig.getExporters(); Map<String,ExporterConfig> requestedExporters = globalConfig.getExporters();
checkExporters(availableExporters.keySet(), requestedExporters.keySet()); checkExporters(availableExporters.keySet(), requestedExporters.keySet());
@ -148,12 +148,12 @@ public class Analyser {
for(String className : requestedExporters.keySet()) { for(String className : requestedExporters.keySet()) {
logger.debug("Going to export with {}", className); logger.debug("Going to export with {}", className);
Class<? extends SoftwareArtifactExporter> exporterClass = availableExporters.get(className); Class<? extends SoftwareArtifactProcessor> exporterClass = availableExporters.get(className);
ExporterConfig exporterConfig = requestedExporters.get(className); ExporterConfig exporterConfig = requestedExporters.get(className);
exporterConfig = actualizeExporterConfig(exporterConfig, softwareVersionConfig); exporterConfig = actualizeExporterConfig(exporterConfig, softwareVersionConfig);
SoftwareArtifactExporter sve = exporterClass.newInstance(); SoftwareArtifactProcessor sve = exporterClass.newInstance();
sve.setOutputDirectory(outputDirectory); sve.setOutputDirectory(outputDirectory);
sve.setGlobalConfig(globalConfig); sve.setGlobalConfig(globalConfig);
sve.setSoftwareVersionConfig(softwareVersionConfig); sve.setSoftwareVersionConfig(softwareVersionConfig);

View File

@ -13,22 +13,22 @@ import org.gcube.common.software.model.SoftwareArtifactConfig;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public abstract class SoftwareArtifactExporter { public abstract class SoftwareArtifactProcessor {
protected static Map<String, Class<? extends SoftwareArtifactExporter>> availableExporters; protected static Map<String, Class<? extends SoftwareArtifactProcessor>> availableProcessors;
static { static {
availableExporters = new HashMap<>(); availableProcessors = new HashMap<>();
add(ZenodoExporter.class); add(ZenodoExporter.class);
add(BibLaTeXExporter.class); add(BibLaTeXExporter.class);
} }
private static void add(Class<? extends SoftwareArtifactExporter> clz) { private static void add(Class<? extends SoftwareArtifactProcessor> clz) {
availableExporters.put(clz.getSimpleName(), clz); availableProcessors.put(clz.getSimpleName(), clz);
} }
public static Map<String, Class<? extends SoftwareArtifactExporter>> getAvailableExporters() { public static Map<String, Class<? extends SoftwareArtifactProcessor>> getAvailableExporters() {
return availableExporters; return availableProcessors;
} }
protected File outputDirectory; protected File outputDirectory;
@ -41,7 +41,7 @@ public abstract class SoftwareArtifactExporter {
protected final String exportFileNameExtension; protected final String exportFileNameExtension;
protected SoftwareArtifactExporter(String exportFileNameExtension) { protected SoftwareArtifactProcessor(String exportFileNameExtension) {
this.exportFileNameExtension = exportFileNameExtension; this.exportFileNameExtension = exportFileNameExtension;
} }

View File

@ -9,7 +9,7 @@ import java.util.Set;
import org.gcube.com.fasterxml.jackson.databind.JsonNode; import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode; 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.ElaborationType;
import org.gcube.common.software.model.Variables; import org.gcube.common.software.model.Variables;
import org.gcube.common.software.utils.FileUtils; import org.gcube.common.software.utils.FileUtils;
@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public class BibLaTeXExporter extends SoftwareArtifactExporter { public class BibLaTeXExporter extends SoftwareArtifactProcessor {
private static final Logger logger = LoggerFactory.getLogger(BibLaTeXExporter.class); private static final Logger logger = LoggerFactory.getLogger(BibLaTeXExporter.class);

View File

@ -30,7 +30,7 @@ import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
import org.gcube.common.gxhttp.request.GXHTTPStringRequest; import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
import org.gcube.common.software.analyser.AnalyserFactory; import org.gcube.common.software.analyser.AnalyserFactory;
import org.gcube.common.software.config.Config; 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.ElaborationType;
import org.gcube.common.software.model.SoftwareArtifactConfig; import org.gcube.common.software.model.SoftwareArtifactConfig;
import org.gcube.common.software.model.SoftwareArtifactFile; import org.gcube.common.software.model.SoftwareArtifactFile;
@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public class ZenodoExporter extends SoftwareArtifactExporter { public class ZenodoExporter extends SoftwareArtifactProcessor {
private static final Logger logger = LoggerFactory.getLogger(ZenodoExporter.class); private static final Logger logger = LoggerFactory.getLogger(ZenodoExporter.class);