Improved solution

This commit is contained in:
Luca Frosini 2023-01-30 18:30:35 +01:00
parent 97b7b50bf1
commit 2ee0e60530
6 changed files with 57 additions and 73 deletions

View File

@ -34,7 +34,7 @@ public abstract class SoftwareVersionExporter {
protected File outputDirectory;
protected GlobalConfig globalConfig;
protected SoftwareVersionConfig softwareVersionConfig;
protected ExporterConfig processorConfig;
protected ExporterConfig exporterConfig;
protected boolean first;
protected boolean last;
@ -66,11 +66,11 @@ public abstract class SoftwareVersionExporter {
}
public ExporterConfig getExporterConfig() {
return processorConfig;
return exporterConfig;
}
public void setExporterConfig(ExporterConfig processorConfig) {
this.processorConfig = processorConfig;
this.exporterConfig = processorConfig;
}
public void setFirst(boolean first) {

View File

@ -33,9 +33,17 @@ public class BibLaTeXSoftwareVersionExporter extends SoftwareVersionExporter {
@Override
public void export() throws Exception {
if(first) {
File exportFile = getOutputFile();
if (exportFile.exists()) {
exportFile.delete();
}
exportFile.createNewFile();
}
String title = softwareVersionConfig.getTitle();
ElaborationType export = processorConfig.getElaboration();
ElaborationType export = exporterConfig.getElaboration();
switch (export) {
case ALL:
@ -175,15 +183,6 @@ public class BibLaTeXSoftwareVersionExporter extends SoftwareVersionExporter {
protected void writeToFile(String output) throws Exception {
File exportFile = getOutputFile();
if(first) {
if (exportFile.exists()) {
exportFile.delete();
}
exportFile.createNewFile();
}
FileWriter fileWritter = new FileWriter(exportFile, true);
BufferedWriter bw = new BufferedWriter(fileWritter);
bw.write(output);

View File

@ -54,7 +54,7 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
public static final String GUCBE_ZENODO_SOFTWARE_DEPOSIT = "gCubeSoftwareDeposit";
public static final String HTML_DESCRIPTION_CONFIG_FIELD_NAME = "html_description";
public static final String HTML_CODE_LOCATION_CONFIG_FIELD_NAME = "html_code_location";
public static final String ADDITIONAL_HTML_DESCRIPTION_CONFIG_FIELD_NAME = "additional_html_description";
public static final String SKIP_GRANTS_CONFIG_FIELD_NAME = "skip_grants";
public static final String METADATA_FIELD_NAME = "metadata";
@ -287,13 +287,11 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
private String getDescription() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(processorConfig.getProperty(HTML_DESCRIPTION_CONFIG_FIELD_NAME).asText());
stringBuffer.append(softwareVersionConfig.getAdditionalProperty(HTML_DESCRIPTION_CONFIG_FIELD_NAME).asText());
String codeLocation = softwareVersionConfig.getCodeLocation();
if(codeLocation!=null) {
String htmlCodeLocation = processorConfig.getProperty(HTML_CODE_LOCATION_CONFIG_FIELD_NAME).asText();
htmlCodeLocation = Utils.replaceVariable("code_location", codeLocation, htmlCodeLocation);
stringBuffer.append(htmlCodeLocation);
if(exporterConfig.getProperty(ADDITIONAL_HTML_DESCRIPTION_CONFIG_FIELD_NAME)!=null) {
String additionalHTMLDescription = exporterConfig.getProperty(ADDITIONAL_HTML_DESCRIPTION_CONFIG_FIELD_NAME).asText();
stringBuffer.append(additionalHTMLDescription);
}
return stringBuffer.toString();
@ -302,7 +300,7 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
private ArrayNode getGrants(){
ObjectMapper objectMapper = Utils.getObjectMapper();
ArrayNode grants = objectMapper.createArrayNode();
ArrayNode arrayNode = (ArrayNode) processorConfig.getProperty(SKIP_GRANTS_CONFIG_FIELD_NAME);
ArrayNode arrayNode = (ArrayNode) exporterConfig.getProperty(SKIP_GRANTS_CONFIG_FIELD_NAME);
Set<String> idToSkip = new HashSet<>();
for(JsonNode idNode : arrayNode) {
idToSkip.add(idNode.asText());
@ -469,7 +467,7 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
protected String getConfig(String propertyName) throws Exception {
String conf = null;
JsonNode node = processorConfig.getProperty(propertyName);
JsonNode node = exporterConfig.getProperty(propertyName);
if(node == null || node.getNodeType()==JsonNodeType.NULL) {
conf = Config.getProperties().getProperty(propertyName);
}
@ -487,8 +485,6 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
@Override
public void export() throws Exception {
getZenodoConnectionConfig();
if(first) {
File exportFile = super.getOutputFile();
if(exportFile.exists()) {
@ -497,9 +493,11 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
exportFile.createNewFile();
}
getZenodoConnectionConfig();
String title = softwareVersionConfig.getTitle();
ElaborationType publish = processorConfig.getElaboration();
ElaborationType publish = exporterConfig.getElaboration();
if(publish==ElaborationType.NONE) {
logger.info("Zenodo Deposit is disabled for {}.",title);

View File

@ -15,9 +15,8 @@ public class AnalyserTest {
private static final Logger logger = LoggerFactory.getLogger(Analyser.class);
public static final String FILENAME = "gcat-test-sandbox.json";
// public static final String FILENAME = "gcat-from-scratch.json";
// public static final String FILENAME = "exported-gcat-from-scratch.json";
// public static final String FILENAME = "gcat-test-sandbox.json";
public static final String FILENAME = "gcat-from-scratch.json";
@Test
public void testUsingTestFile() throws Exception {

View File

@ -174,7 +174,7 @@
],
"gcube_release_version": "4.13.1",
"gcube_release_ticket": "https://support.d4science.org/issues/12988",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": null
},
@ -190,7 +190,7 @@
],
"gcube_release_version": null,
"gcube_release_ticket": null,
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": null
},
@ -210,7 +210,7 @@
],
"gcube_release_version": "4.14.0",
"gcube_release_ticket": "https://support.d4science.org/issues/16743",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": null
},
@ -220,7 +220,7 @@
"group": "data-publishing",
"gcube_release_version": "4.15.0",
"gcube_release_ticket": "https://support.d4science.org/issues/17294",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -230,7 +230,7 @@
"group": "data-publishing",
"gcube_release_version": "4.18.0",
"gcube_release_ticket": "https://support.d4science.org/issues/18335",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -240,7 +240,7 @@
"group": "data-publishing",
"gcube_release_version": "4.20.0",
"gcube_release_ticket": "https://support.d4science.org/issues/18507",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -250,7 +250,7 @@
"group": "data-publishing",
"gcube_release_version": "4.23.0",
"gcube_release_ticket": "https://support.d4science.org/issues/19322",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -260,7 +260,7 @@
"group": "data-publishing",
"gcube_release_version": "5.0.0",
"gcube_release_ticket": "https://support.d4science.org/issues/20648",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -270,7 +270,7 @@
"group": "data-publishing",
"gcube_release_version": "5.1.0",
"gcube_release_ticket": "https://support.d4science.org/issues/20920",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -287,7 +287,7 @@
"date": "2022-01-27",
"gcube_release_version": "5.7.0",
"gcube_release_ticket": "https://support.d4science.org/issues/21685/",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -304,7 +304,7 @@
"date": "2022-07-22",
"gcube_release_version": "5.13.0",
"gcube_release_ticket": "https://support.d4science.org/issues/23374",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -313,7 +313,7 @@
"date": "2022-09-16",
"gcube_release_version": "5.13.1",
"gcube_release_ticket": "https://support.d4science.org/issues/23650",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
},
@ -322,7 +322,7 @@
"date": "2022-12-07",
"gcube_release_version": "5.14.0",
"gcube_release_ticket": "https://support.d4science.org/issues/23885",
"concept_doi_url" = "PREVIOUS",
"concept_doi_url": "PREVIOUS",
"version_doi_url": null,
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
}

View File

@ -9,6 +9,7 @@
},
"keywords": ["gCube", "Catalogue", "D4Science"],
"description": "gCube Catalogue (gCat) Service allows the publication of items in the gCube Catalogue.",
"html_description": "<p><a href=\"https://www.gcube-system.org/\">gCube</a> Catalogue (gCat) Service allows any client to publish items in the gCube Catalogue.</p>",
"authors": [
{
"affiliation": "Istituto di Scienza e Tecnologie dell'Informazione \"A. Faedo\" - CNR, Italy",
@ -30,7 +31,7 @@
"desired_name": "{{name}}-v{{version}}.war"
}
],
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139068",
"grants": [
{
@ -133,9 +134,8 @@
"exporters": {
"ZenodoSoftwareVersionExporter": {
"elaboration": "NONE",
"html_description": "<p><a href=\"https://www.gcube-system.org/\">gCube</a> Catalogue (gCat) Service allows any client to publish items in the gCube Catalogue.</p>\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>&nbsp;</p>",
"html_code_location": "\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>",
"skip_grants": ["004260"]
"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>&nbsp;</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": {
"elaboration": "ALL"
@ -157,7 +157,7 @@
"gcube_release_ticket": null,
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1139446",
"code_location": null
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}"
},
{
"version": "1.1.0",
@ -177,7 +177,7 @@
"gcube_release_ticket": "https://support.d4science.org/issues/12988",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1140461",
"code_location": null
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}"
},
{
"version": "1.2.0",
@ -193,7 +193,7 @@
"gcube_release_ticket": null,
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1140750",
"code_location": null
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}"
},
{
"version": "1.3.0",
@ -213,7 +213,7 @@
"gcube_release_ticket": "https://support.d4science.org/issues/16743",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1143572",
"code_location": null
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}"
},
{
"version": "1.4.0",
@ -222,8 +222,7 @@
"gcube_release_version": "4.15.0",
"gcube_release_ticket": "https://support.d4science.org/issues/17294",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1143583",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1143583"
},
{
"version": "1.4.1",
@ -232,8 +231,7 @@
"gcube_release_version": "4.18.0",
"gcube_release_ticket": "https://support.d4science.org/issues/18335",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1143585",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1143585"
},
{
"version": "1.4.2",
@ -242,8 +240,7 @@
"gcube_release_version": "4.20.0",
"gcube_release_ticket": "https://support.d4science.org/issues/18507",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1143586",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1143586"
},
{
"version": "1.4.3",
@ -252,8 +249,7 @@
"gcube_release_version": "4.23.0",
"gcube_release_ticket": "https://support.d4science.org/issues/19322",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1143587",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1143587"
},
{
"version": "1.4.4",
@ -262,8 +258,7 @@
"gcube_release_version": "5.0.0",
"gcube_release_ticket": "https://support.d4science.org/issues/20648",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1143589",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1143589"
},
{
"version": "1.4.5",
@ -272,56 +267,49 @@
"gcube_release_version": "5.1.0",
"gcube_release_ticket": "https://support.d4science.org/issues/20920",
"concept_doi_url": "https://doi.org/10.5072/zenodo.1139445",
"version_doi_url": "https://doi.org/10.5072/zenodo.1143590",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1143590"
},
{
"version": "2.0.0",
"date": "2021-05-04",
"gcube_release_version": "5.2.0",
"gcube_release_ticket": "https://support.d4science.org/issues/19738",
"version_doi_url": "https://doi.org/10.5072/zenodo.1139069",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1139069"
},
{
"version": "2.1.0",
"date": "2022-01-27",
"gcube_release_version": "5.7.0",
"gcube_release_ticket": "https://support.d4science.org/issues/21685/",
"version_doi_url": "https://doi.org/10.5072/zenodo.1139070",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1139070"
},
{
"version": "2.2.0",
"date": "2022-05-12",
"gcube_release_version": "5.11.0",
"gcube_release_ticket": "https://support.d4science.org/issues/22943",
"version_doi_url": "https://doi.org/10.5072/zenodo.1139322",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1139322"
},
{
"version": "2.3.0",
"date": "2022-07-22",
"gcube_release_version": "5.13.0",
"gcube_release_ticket": "https://support.d4science.org/issues/23374",
"version_doi_url": "https://doi.org/10.5072/zenodo.1139680",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url": "https://doi.org/10.5072/zenodo.1139680"
},
{
"version": "2.4.0",
"date": "2022-09-16",
"gcube_release_version": "5.13.1",
"gcube_release_ticket": "https://support.d4science.org/issues/23650",
"version_doi_url" : "https://doi.org/10.5072/zenodo.1144798",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url" : "https://doi.org/10.5072/zenodo.1144798"
},
{
"version": "2.4.1",
"date": "2022-12-07",
"gcube_release_version": "5.14.0",
"gcube_release_ticket": "https://support.d4science.org/issues/23885",
"version_doi_url" : "https://doi.org/10.5072/zenodo.1144799",
"code_location": "https://code-repo.d4science.org/gCubeSystem/{{name}}/releases/tag/v{{version}}"
"version_doi_url" : "https://doi.org/10.5072/zenodo.1144799"
}
]
}