Refactored classes name
This commit is contained in:
parent
a4e10e256c
commit
5f3661f06f
|
@ -16,8 +16,8 @@ import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
|||
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;
|
||||
import org.gcube.common.software.model.SoftwareVersionFile;
|
||||
import org.gcube.common.software.model.SoftwareArtifactConfig;
|
||||
import org.gcube.common.software.model.SoftwareArtifactFile;
|
||||
import org.gcube.common.software.model.Variables;
|
||||
import org.gcube.common.software.utils.Utils;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -60,7 +60,7 @@ public class Analyser {
|
|||
this.versionConfigurations = originalVersions.deepCopy();
|
||||
}
|
||||
|
||||
protected SoftwareVersionConfig actualizeSoftwareVersionConfig(JsonNode version) throws Exception {
|
||||
protected SoftwareArtifactConfig actualizeSoftwareVersionConfig(JsonNode version) throws Exception {
|
||||
((ObjectNode) version).remove(GlobalConfig.EXPORTERS_PROPERTY_NAME);
|
||||
Variables variables = objectMapper.treeToValue(version, Variables.class);
|
||||
Set<String> missingVariables = variables.parse();
|
||||
|
@ -70,10 +70,10 @@ public class Analyser {
|
|||
missingVariables.toArray(new String[size]).toString());
|
||||
}
|
||||
JsonNode swVersion = objectMapper.convertValue(variables.getProperties(), JsonNode.class);
|
||||
SoftwareVersionConfig softwareVersionConfig = objectMapper.treeToValue(swVersion, SoftwareVersionConfig.class);
|
||||
SoftwareArtifactConfig softwareVersionConfig = objectMapper.treeToValue(swVersion, SoftwareArtifactConfig.class);
|
||||
|
||||
List<SoftwareVersionFile> svfs = softwareVersionConfig.getFiles();
|
||||
for(SoftwareVersionFile svf : svfs) {
|
||||
List<SoftwareArtifactFile> svfs = softwareVersionConfig.getFiles();
|
||||
for(SoftwareArtifactFile svf : svfs) {
|
||||
URL url = svf.getURL();
|
||||
String urlString = variables.replaceAllVariables(url.toString());
|
||||
svf.setURL(new URL(urlString));
|
||||
|
@ -94,7 +94,7 @@ public class Analyser {
|
|||
return globalConfig;
|
||||
}
|
||||
|
||||
protected ExporterConfig actualizeExporterConfig(ExporterConfig exporterConfig, SoftwareVersionConfig softwareVersionConfig) throws Exception {
|
||||
protected ExporterConfig actualizeExporterConfig(ExporterConfig exporterConfig, SoftwareArtifactConfig softwareVersionConfig) throws Exception {
|
||||
ObjectNode versionNode = objectMapper.valueToTree(softwareVersionConfig);
|
||||
Variables versionVariables = objectMapper.treeToValue(versionNode, Variables.class);
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class Analyser {
|
|||
Files.createDirectories(outputDirectory.toPath());
|
||||
}
|
||||
|
||||
SoftwareVersionConfig previous = null;
|
||||
SoftwareArtifactConfig previous = null;
|
||||
int i = 0;
|
||||
|
||||
List<File> outputFiles = new ArrayList<>();
|
||||
|
@ -139,7 +139,7 @@ public class Analyser {
|
|||
ObjectNode versionConfig = (ObjectNode) versionConfigurations.get(i).deepCopy();
|
||||
JsonNode mergedVersionConfig = Utils.merge(globalConfiguration, versionConfig);
|
||||
|
||||
SoftwareVersionConfig softwareVersionConfig = actualizeSoftwareVersionConfig(mergedVersionConfig);
|
||||
SoftwareArtifactConfig softwareVersionConfig = actualizeSoftwareVersionConfig(mergedVersionConfig);
|
||||
softwareVersionConfig.setOriginalJson(versionConfig);
|
||||
softwareVersionConfig.setPrevious(previous);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ 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;
|
||||
import org.gcube.common.software.model.SoftwareArtifactConfig;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
|
@ -33,7 +33,7 @@ public abstract class SoftwareArtifactExporter {
|
|||
|
||||
protected File outputDirectory;
|
||||
protected GlobalConfig globalConfig;
|
||||
protected SoftwareVersionConfig softwareVersionConfig;
|
||||
protected SoftwareArtifactConfig softwareVersionConfig;
|
||||
protected ExporterConfig exporterConfig;
|
||||
|
||||
protected boolean first;
|
||||
|
@ -57,11 +57,11 @@ public abstract class SoftwareArtifactExporter {
|
|||
this.globalConfig = globalConfig;
|
||||
}
|
||||
|
||||
public SoftwareVersionConfig getSoftwareVersionConfig() {
|
||||
public SoftwareArtifactConfig getSoftwareVersionConfig() {
|
||||
return softwareVersionConfig;
|
||||
}
|
||||
|
||||
public void setSoftwareVersionConfig(SoftwareVersionConfig softwareVersionConfig) {
|
||||
public void setSoftwareVersionConfig(SoftwareArtifactConfig softwareVersionConfig) {
|
||||
this.softwareVersionConfig = softwareVersionConfig;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ 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.model.ElaborationType;
|
||||
import org.gcube.common.software.model.SoftwareVersionConfig;
|
||||
import org.gcube.common.software.model.SoftwareVersionFile;
|
||||
import org.gcube.common.software.model.SoftwareArtifactConfig;
|
||||
import org.gcube.common.software.model.SoftwareArtifactFile;
|
||||
import org.gcube.common.software.utils.Utils;
|
||||
import org.glassfish.jersey.client.ClientProperties;
|
||||
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||
|
@ -158,7 +158,7 @@ public class ZenodoExporter extends SoftwareArtifactExporter {
|
|||
|
||||
protected void finalize() throws Exception {
|
||||
List<File> files = new ArrayList<>();
|
||||
for(SoftwareVersionFile svf : softwareVersionConfig.getFiles()) {
|
||||
for(SoftwareArtifactFile svf : softwareVersionConfig.getFiles()) {
|
||||
File file = svf.downloadFile();
|
||||
files.add(file);
|
||||
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
|
||||
|
@ -542,16 +542,16 @@ public class ZenodoExporter extends SoftwareArtifactExporter {
|
|||
ObjectNode toBeExported = objectMapper.createObjectNode();
|
||||
toBeExported.replace(AnalyserFactory.CONFIGURATION_PROPERTY_NAME, globalConfig.getOriginalJson().deepCopy());
|
||||
ArrayNode array = objectMapper.createArrayNode();
|
||||
SoftwareVersionConfig previous = softwareVersionConfig;
|
||||
SoftwareArtifactConfig previous = softwareVersionConfig;
|
||||
boolean firstNode = true;
|
||||
while(previous!=null){
|
||||
ObjectNode node = previous.getOriginalJson().deepCopy();
|
||||
node.put(SoftwareVersionConfig.CONCEPT_DOI_URL_PROPERTY_NAME, previous.getConceptDOIURL());
|
||||
node.put(SoftwareArtifactConfig.CONCEPT_DOI_URL_PROPERTY_NAME, previous.getConceptDOIURL());
|
||||
if(firstNode) {
|
||||
toBeExported.put(SoftwareVersionConfig.CONCEPT_DOI_URL_PROPERTY_NAME, previous.getConceptDOIURL());
|
||||
toBeExported.put(SoftwareArtifactConfig.CONCEPT_DOI_URL_PROPERTY_NAME, previous.getConceptDOIURL());
|
||||
firstNode = false;
|
||||
}
|
||||
node.put(SoftwareVersionConfig.VERSION_DOI_URL_PROPERTY_NAME, previous.getVersionDOIURL());
|
||||
node.put(SoftwareArtifactConfig.VERSION_DOI_URL_PROPERTY_NAME, previous.getVersionDOIURL());
|
||||
array.insert(0, node);
|
||||
previous = previous.getPrevious();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.gcube.common.software.utils.Utils;
|
|||
* @author Luca Frosini (ISTI - CNR)
|
||||
* TO BE GENERALIZED
|
||||
*/
|
||||
public class SoftwareVersionConfig {
|
||||
public class SoftwareArtifactConfig {
|
||||
|
||||
public static final String PREVIOUS_CONCEPT_DOI_VALUE = "PREVIOUS";
|
||||
|
||||
|
@ -40,10 +40,10 @@ public class SoftwareVersionConfig {
|
|||
public static final String GRANTS_PROPERTY_NAME = "grants";
|
||||
|
||||
@JsonIgnore
|
||||
protected SoftwareVersionConfig previous;
|
||||
protected SoftwareArtifactConfig previous;
|
||||
|
||||
@JsonIgnore
|
||||
protected SoftwareVersionConfig next;
|
||||
protected SoftwareArtifactConfig next;
|
||||
|
||||
@JsonIgnore
|
||||
protected Boolean newDeposition;
|
||||
|
@ -74,7 +74,7 @@ public class SoftwareVersionConfig {
|
|||
protected ArrayNode authors;
|
||||
|
||||
@JsonProperty(FILES_PROPERTY_NAME)
|
||||
protected List<SoftwareVersionFile> files;
|
||||
protected List<SoftwareArtifactFile> files;
|
||||
|
||||
@JsonProperty(CODE_LOCATION_PROPERTY_NAME)
|
||||
protected String codeLocation;
|
||||
|
@ -92,18 +92,18 @@ public class SoftwareVersionConfig {
|
|||
|
||||
protected Map<String, JsonNode> additionalProperties;
|
||||
|
||||
public SoftwareVersionConfig() {
|
||||
public SoftwareArtifactConfig() {
|
||||
this.newDeposition = false;
|
||||
this.additionalProperties = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public SoftwareVersionConfig getPrevious() {
|
||||
public SoftwareArtifactConfig getPrevious() {
|
||||
return previous;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public void setPrevious(SoftwareVersionConfig previous) {
|
||||
public void setPrevious(SoftwareArtifactConfig previous) {
|
||||
this.previous = previous;
|
||||
if(previous!=null) {
|
||||
this.previous.next = this;
|
||||
|
@ -111,7 +111,7 @@ public class SoftwareVersionConfig {
|
|||
}
|
||||
|
||||
@JsonIgnore
|
||||
public SoftwareVersionConfig getNext() {
|
||||
public SoftwareArtifactConfig getNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class SoftwareVersionConfig {
|
|||
return authors;
|
||||
}
|
||||
|
||||
public List<SoftwareVersionFile> getFiles() {
|
||||
public List<SoftwareArtifactFile> getFiles() {
|
||||
return files;
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class SoftwareVersionFile {
|
||||
public class SoftwareArtifactFile {
|
||||
|
||||
@JsonProperty(value="url")
|
||||
protected URL url;
|
Loading…
Reference in New Issue