Generalizing library terminology
This commit is contained in:
parent
e3634904e7
commit
e2fb00c34f
26
pom.xml
26
pom.xml
|
@ -84,4 +84,30 @@
|
|||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Sphinx plugin' -->
|
||||
<plugin>
|
||||
<groupId>kr.motd.maven</groupId>
|
||||
<artifactId>sphinx-maven-plugin</artifactId>
|
||||
<version>2.10.0</version>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/docs</outputDirectory>
|
||||
<builder>html</builder>
|
||||
<configDirectory>${basedir}/docs</configDirectory>
|
||||
<sourceDirectory>${basedir}/docs</sourceDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -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.SoftwareVersionExporter;
|
||||
import org.gcube.common.software.export.SoftwareArtifactExporter;
|
||||
import org.gcube.common.software.model.ExporterConfig;
|
||||
import org.gcube.common.software.model.GlobalConfig;
|
||||
import org.gcube.common.software.model.SoftwareVersionConfig;
|
||||
|
@ -118,7 +118,7 @@ public class Analyser {
|
|||
|
||||
GlobalConfig globalConfig = getGlobalConfig(globalConfiguration);
|
||||
|
||||
Map<String, Class<? extends SoftwareVersionExporter>> availableExporters = SoftwareVersionExporter.getAvailableExporters();
|
||||
Map<String, Class<? extends SoftwareArtifactExporter>> availableExporters = SoftwareArtifactExporter.getAvailableExporters();
|
||||
Map<String,ExporterConfig> 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<? extends SoftwareVersionExporter> exporterClass = availableExporters.get(className);
|
||||
Class<? extends SoftwareArtifactExporter> exporterClass = availableExporters.get(className);
|
||||
|
||||
ExporterConfig exporterConfig = requestedExporters.get(className);
|
||||
exporterConfig = actualizeExporterConfig(exporterConfig, softwareVersionConfig);
|
||||
|
||||
SoftwareVersionExporter sve = exporterClass.newInstance();
|
||||
SoftwareArtifactExporter sve = exporterClass.newInstance();
|
||||
sve.setOutputDirectory(outputDirectory);
|
||||
sve.setGlobalConfig(globalConfig);
|
||||
sve.setSoftwareVersionConfig(softwareVersionConfig);
|
||||
|
|
|
@ -15,8 +15,8 @@ public class AnalyserFactory {
|
|||
|
||||
public static final String EXPORT_FILENAME_EXTENSION = ".json";
|
||||
|
||||
public static final String GLOBAL_PROPERTY_NAME = "global";
|
||||
public static final String VERSIONS_PROPERTY_NAME = "versions";
|
||||
public static final String CONFIGURATION_PROPERTY_NAME = "configuration";
|
||||
public static final String ARTIFACTS_PROPERTY_NAME = "artifacts";
|
||||
|
||||
public static Analyser getAnalyser(File jsonFile) throws Exception {
|
||||
ObjectMapper objectMapper = Utils.getObjectMapper();
|
||||
|
@ -32,9 +32,9 @@ public class AnalyserFactory {
|
|||
|
||||
public static Analyser getAnalyser(JsonNode jsonNode) throws Exception {
|
||||
Analyser analyser = new Analyser();
|
||||
ObjectNode originalGlobal = (ObjectNode) jsonNode.get(GLOBAL_PROPERTY_NAME);
|
||||
ObjectNode originalGlobal = (ObjectNode) jsonNode.get(CONFIGURATION_PROPERTY_NAME);
|
||||
analyser.setGlobalConfiguration(originalGlobal);
|
||||
ArrayNode originalVersions = (ArrayNode) jsonNode.get(VERSIONS_PROPERTY_NAME);
|
||||
ArrayNode originalVersions = (ArrayNode) jsonNode.get(ARTIFACTS_PROPERTY_NAME);
|
||||
analyser.setVersionConfigurations(originalVersions);
|
||||
return analyser;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.io.File;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.software.export.biblatex.BibLaTeXSoftwareVersionExporter;
|
||||
import org.gcube.common.software.export.zenodo.ZenodoSoftwareVersionExporter;
|
||||
import org.gcube.common.software.export.biblatex.BibLaTeXExporter;
|
||||
import org.gcube.common.software.export.zenodo.ZenodoExporter;
|
||||
import org.gcube.common.software.model.ExporterConfig;
|
||||
import org.gcube.common.software.model.GlobalConfig;
|
||||
import org.gcube.common.software.model.SoftwareVersionConfig;
|
||||
|
@ -13,21 +13,21 @@ import org.gcube.common.software.model.SoftwareVersionConfig;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class SoftwareVersionExporter {
|
||||
public abstract class SoftwareArtifactExporter {
|
||||
|
||||
protected static Map<String, Class<? extends SoftwareVersionExporter>> availableExporters;
|
||||
protected static Map<String, Class<? extends SoftwareArtifactExporter>> availableExporters;
|
||||
|
||||
static {
|
||||
availableExporters = new HashMap<>();
|
||||
add(ZenodoSoftwareVersionExporter.class);
|
||||
add(BibLaTeXSoftwareVersionExporter.class);
|
||||
add(ZenodoExporter.class);
|
||||
add(BibLaTeXExporter.class);
|
||||
}
|
||||
|
||||
private static void add(Class<? extends SoftwareVersionExporter> clz) {
|
||||
private static void add(Class<? extends SoftwareArtifactExporter> clz) {
|
||||
availableExporters.put(clz.getSimpleName(), clz);
|
||||
}
|
||||
|
||||
public static Map<String, Class<? extends SoftwareVersionExporter>> getAvailableExporters() {
|
||||
public static Map<String, Class<? extends SoftwareArtifactExporter>> getAvailableExporters() {
|
||||
return availableExporters;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public abstract class SoftwareVersionExporter {
|
|||
|
||||
protected final String exportFileNameExtension;
|
||||
|
||||
protected SoftwareVersionExporter(String exportFileNameExtension) {
|
||||
protected SoftwareArtifactExporter(String exportFileNameExtension) {
|
||||
this.exportFileNameExtension = exportFileNameExtension;
|
||||
}
|
||||
|
|
@ -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.SoftwareVersionExporter;
|
||||
import org.gcube.common.software.export.SoftwareArtifactExporter;
|
||||
import org.gcube.common.software.model.ElaborationType;
|
||||
import org.gcube.common.software.model.Variables;
|
||||
import org.gcube.common.software.utils.FileUtils;
|
||||
|
@ -20,15 +20,15 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class BibLaTeXSoftwareVersionExporter extends SoftwareVersionExporter {
|
||||
public class BibLaTeXExporter extends SoftwareArtifactExporter {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BibLaTeXSoftwareVersionExporter.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(BibLaTeXExporter.class);
|
||||
|
||||
public static final String EXPORT_FILENAME_EXTENSION = ".bib";
|
||||
public static final String TEMPLATE_FILENAME = "biblatex.template";
|
||||
|
||||
public BibLaTeXSoftwareVersionExporter() {
|
||||
super(BibLaTeXSoftwareVersionExporter.EXPORT_FILENAME_EXTENSION);
|
||||
public BibLaTeXExporter() {
|
||||
super(BibLaTeXExporter.EXPORT_FILENAME_EXTENSION);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -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.SoftwareVersionExporter;
|
||||
import org.gcube.common.software.export.SoftwareArtifactExporter;
|
||||
import org.gcube.common.software.model.ElaborationType;
|
||||
import org.gcube.common.software.model.SoftwareVersionConfig;
|
||||
import org.gcube.common.software.model.SoftwareVersionFile;
|
||||
|
@ -45,9 +45,9 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
|
||||
public class ZenodoExporter extends SoftwareArtifactExporter {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZenodoSoftwareVersionExporter.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZenodoExporter.class);
|
||||
|
||||
public static final String EXPORT_FILENAME_EXTENSION = ".json";
|
||||
|
||||
|
@ -92,8 +92,8 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
|
|||
return map;
|
||||
}
|
||||
|
||||
public ZenodoSoftwareVersionExporter() {
|
||||
super(ZenodoSoftwareVersionExporter.EXPORT_FILENAME_EXTENSION);
|
||||
public ZenodoExporter() {
|
||||
super(ZenodoExporter.EXPORT_FILENAME_EXTENSION);
|
||||
}
|
||||
|
||||
protected void addFilesToDeposition(List<File> files ) throws Exception {
|
||||
|
@ -476,7 +476,7 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
|
|||
conf = Config.getProperties().getProperty(propertyName);
|
||||
}
|
||||
if(conf==null) {
|
||||
throw new Exception("No configuration '" + propertyName + "' property found.");
|
||||
throw new Exception("No configuration for '" + propertyName + "' property found.");
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
|
|||
protected ObjectNode getObjectNode() throws Exception {
|
||||
ObjectMapper objectMapper = Utils.getObjectMapper();
|
||||
ObjectNode toBeExported = objectMapper.createObjectNode();
|
||||
toBeExported.replace(AnalyserFactory.GLOBAL_PROPERTY_NAME, globalConfig.getOriginalJson().deepCopy());
|
||||
toBeExported.replace(AnalyserFactory.CONFIGURATION_PROPERTY_NAME, globalConfig.getOriginalJson().deepCopy());
|
||||
ArrayNode array = objectMapper.createArrayNode();
|
||||
SoftwareVersionConfig previous = softwareVersionConfig;
|
||||
boolean firstNode = true;
|
||||
|
@ -555,7 +555,7 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
|
|||
array.insert(0, node);
|
||||
previous = previous.getPrevious();
|
||||
}
|
||||
toBeExported.replace(AnalyserFactory.VERSIONS_PROPERTY_NAME, array);
|
||||
toBeExported.replace(AnalyserFactory.ARTIFACTS_PROPERTY_NAME, array);
|
||||
return toBeExported;
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ import org.gcube.common.software.utils.Utils;
|
|||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
* TO BE GENERALIZED
|
||||
*/
|
||||
public class SoftwareVersionConfig {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.common.software.utils;
|
|||
import java.io.File;
|
||||
import java.net.URL;
|
||||
|
||||
import org.gcube.common.software.export.biblatex.BibLaTeXSoftwareVersionExporter;
|
||||
import org.gcube.common.software.export.biblatex.BibLaTeXExporter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -15,7 +15,7 @@ public class FileUtils {
|
|||
private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
|
||||
|
||||
public static File getFileFromFilename(String fileName) throws Exception {
|
||||
URL jsonFileURL = BibLaTeXSoftwareVersionExporter.class.getClassLoader().getResource(fileName);
|
||||
URL jsonFileURL = BibLaTeXExporter.class.getClassLoader().getResource(fileName);
|
||||
File file = new File(jsonFileURL.toURI());
|
||||
logger.trace("File is {}", file.getAbsolutePath());
|
||||
return file;
|
||||
|
|
|
@ -41,8 +41,14 @@ public class Utils {
|
|||
return s.replaceAll("\\{\\{" + variableName + "\\}\\}", replace);
|
||||
}
|
||||
|
||||
/*
|
||||
* Merge all the properties contained in version in concept
|
||||
/**
|
||||
* Clone node1 and merge all the properties contained in node2 into the cloned JsonNode.
|
||||
* In other words, the properties contained in node2
|
||||
* will replace/add the properties contained in the clone of node1.
|
||||
* Both node1 and node2 are not modified.
|
||||
* @param node1 contains the properties to be merged with the properties contained in node2.
|
||||
* @param node2 contains the properties will replace/add the properties in the clone of node1.
|
||||
* @return a new JsonNode containing the merged properties.
|
||||
*/
|
||||
public static JsonNode merge(JsonNode node1, JsonNode node2) {
|
||||
ObjectNode cloned = node1.deepCopy();
|
||||
|
|
|
@ -23,7 +23,7 @@ public class AnalyserTest {
|
|||
File file = FileUtils.getFileFromFilename(FILENAME);
|
||||
Analyser analyser = AnalyserFactory.getAnalyser(file);
|
||||
// analyser.setOutputDirectory(file.getParentFile());
|
||||
List<File> files =analyser.analyse();
|
||||
List<File> files = analyser.analyse();
|
||||
logger.info("Generated the following files {}", files);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"global": {
|
||||
"configuration": {
|
||||
"name": "gcat",
|
||||
"group": "data-catalogue",
|
||||
"title": "gCube Catalogue (gCat) Service {{version}}",
|
||||
|
@ -136,17 +136,17 @@
|
|||
],
|
||||
"export_filename": "{{name}}",
|
||||
"exporters": {
|
||||
"ZenodoSoftwareVersionExporter": {
|
||||
"ZenodoExporter": {
|
||||
"elaboration": "NONE",
|
||||
"skip_grants": ["004260"],
|
||||
"additional_html_description": "\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> is an open-source software toolkit used for building and operating Hybrid Data Infrastructures enabling the dynamic deployment of Virtual Research Environments, such as the <a href=\"https://www.d4science.org/\">D4Science Infrastructure</a>, by favouring the realisation of reuse-oriented policies.</p>\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> has been used to successfully build and operate infrastructures and virtual research environments for application domains ranging from biodiversity to environmental data management and cultural heritage.</p>\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> offers components supporting typical data management workflows including data access, curation, processing, and visualisation on a large set of data typologies ranging from primary biodiversity data to geospatial and tabular data.</p>\n\n<p><a href=\"https://www.d4science.org/\">D4Science</a> is a Hybrid Data Infrastructure combining over 500 software components and integrating data from more than 50 different data providers into a coherent and managed system of hardware, software, and data resources. The D4Science infrastructure drastically reduces the cost of ownership, maintenance, and operation thanks to the exploitation of gCube.</p>\n\n<p> </p>\n\n<p>The official source code location of this software version is available at:</p>\n\n<p><a href=\"{{code_location}}\">{{code_location}}</a></p>"
|
||||
},
|
||||
"BibLaTeXSoftwareVersionExporter": {
|
||||
"BibLaTeXExporter": {
|
||||
"elaboration": "ALL"
|
||||
}
|
||||
}
|
||||
},
|
||||
"versions": [
|
||||
"artifacts": [
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"date": "2019-01-10",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"global": {
|
||||
"configuration": {
|
||||
"name": "gcat",
|
||||
"group": "data-catalogue",
|
||||
"title": "gCube Catalogue (gCat) Service {{version}}",
|
||||
|
@ -137,17 +137,17 @@
|
|||
],
|
||||
"export_filename": "{{name}}",
|
||||
"exporters": {
|
||||
"ZenodoSoftwareVersionExporter": {
|
||||
"ZenodoExporter": {
|
||||
"elaboration": "NONE",
|
||||
"skip_grants": ["004260"],
|
||||
"additional_html_description": "\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> is an open-source software toolkit used for building and operating Hybrid Data Infrastructures enabling the dynamic deployment of Virtual Research Environments, such as the <a href=\"https://www.d4science.org/\">D4Science Infrastructure</a>, by favouring the realisation of reuse-oriented policies.</p>\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> has been used to successfully build and operate infrastructures and virtual research environments for application domains ranging from biodiversity to environmental data management and cultural heritage.</p>\n\n<p><a href=\"https://www.gcube-system.org/\">gCube</a> offers components supporting typical data management workflows including data access, curation, processing, and visualisation on a large set of data typologies ranging from primary biodiversity data to geospatial and tabular data.</p>\n\n<p><a href=\"https://www.d4science.org/\">D4Science</a> is a Hybrid Data Infrastructure combining over 500 software components and integrating data from more than 50 different data providers into a coherent and managed system of hardware, software, and data resources. The D4Science infrastructure drastically reduces the cost of ownership, maintenance, and operation thanks to the exploitation of gCube.</p>\n\n<p> </p>\n\n<p>The official source code location of this software version is available at:</p>\n\n<p><a href=\"{{code_location}}\">{{code_location}}</a></p>"
|
||||
},
|
||||
"BibLaTeXSoftwareVersionExporter": {
|
||||
"BibLaTeXExporter": {
|
||||
"elaboration": "ALL"
|
||||
}
|
||||
}
|
||||
},
|
||||
"versions": [
|
||||
"artifacts": [
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"date": "2019-01-10",
|
||||
|
|
Loading…
Reference in New Issue