From bb84400e0dc540c04dbe7219fe65beb76de47a76 Mon Sep 17 00:00:00 2001 From: Paolo Fabriani Date: Fri, 25 Nov 2016 10:52:54 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@134766 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../template/AlgorithmPackage.java | 4 +- .../datamodel/Algorithm.java | 24 ++++++++++ .../process/AddAlgorithmCommand.java | 47 ++++++++++++------- .../process/AlgorithmPackageParser.java | 10 ++-- 4 files changed, 61 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/ansiblebridge/template/AlgorithmPackage.java b/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/ansiblebridge/template/AlgorithmPackage.java index 2921fa1..b6c9153 100644 --- a/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/ansiblebridge/template/AlgorithmPackage.java +++ b/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/ansiblebridge/template/AlgorithmPackage.java @@ -24,8 +24,8 @@ public class AlgorithmPackage { out.put("name", a.getName()); out.put("category", a.getCategory()); out.put("class", a.getClazz()); - out.put("p5", "TEMP_TRANSDUCERS"); - out.put("p6", "TEMP_??"); + out.put("atype", a.getAlgorithmType()); + out.put("skipjava", a.getSkipJava()); out.put("vre", "FAKE_VRE"); out.put("packageurl", a.getPackageURL()); out.put("description", a.getDescription()); diff --git a/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/datamodel/Algorithm.java b/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/datamodel/Algorithm.java index d982515..90953e2 100644 --- a/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/datamodel/Algorithm.java +++ b/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/datamodel/Algorithm.java @@ -13,6 +13,10 @@ public class Algorithm { private String clazz; + private String algorithmType; + + private String skipJava; + private String packageURL; private Collection actions; @@ -65,6 +69,10 @@ public class Algorithm { return dependencies; } + public void setDependencies(Collection deps) { + this.dependencies = deps; + } + public String toString() { String out = "Algorithm: " + this.getName()+"\n"; out+=" Class Name: " + this.getClazz()+"\n"; @@ -89,4 +97,20 @@ public class Algorithm { this.packageURL = packageURL; } + public String getAlgorithmType() { + return algorithmType; + } + + public void setAlgorithmType(String algorithmType) { + this.algorithmType = algorithmType; + } + + public String getSkipJava() { + return skipJava; + } + + public void setSkipJava(String skipJava) { + this.skipJava = skipJava; + } + } diff --git a/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/process/AddAlgorithmCommand.java b/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/process/AddAlgorithmCommand.java index 80870d6..7edd1de 100644 --- a/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/process/AddAlgorithmCommand.java +++ b/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/process/AddAlgorithmCommand.java @@ -8,9 +8,9 @@ public class AddAlgorithmCommand { private String name; private String category; private String clazz; - private String vre; - private String p6; - private String p7; + private String scope; + private String algorithmType; + private String skipJava; private String url; private String description; @@ -25,18 +25,31 @@ public class AddAlgorithmCommand { if (st.hasMoreElements()) clazz = st.nextToken(); if (st.hasMoreElements()) - vre = st.nextToken(); + scope = st.nextToken(); if (st.hasMoreElements()) - p6 = st.nextToken(); + algorithmType = st.nextToken(); if (st.hasMoreElements()) - p7 = st.nextToken(); + skipJava = st.nextToken(); if (st.hasMoreElements()) url = st.nextToken(); - description = ""; + + String d = ""; while (st.hasMoreElements()) - description = description + st.nextToken() + " "; + d = d + st.nextToken() + " "; + this.setDescription(d); + } + public void setDescription(String d) { + if(d!=null) { + d = d.trim(); + if(d.startsWith("\"") && d.endsWith("\"")) { + d = d.substring(1, d.length()-1).trim(); + } + } + this.description = d; + } + public String getCommand() { return command; } @@ -54,15 +67,15 @@ public class AddAlgorithmCommand { } public String getVRE() { - return vre; + return scope; } - public String getP6() { - return p6; + public String getAlgorithmType() { + return algorithmType; } - public String getP7() { - return p7; + public String getSkipjava() { + return skipJava; } public String getUrl() { @@ -76,12 +89,12 @@ public class AddAlgorithmCommand { public String toString() { String out = ""; out += String.format("%-12s: %s\n", "command", command); - out += String.format("%-12s: %s\n", "name", name); + out += String.format("%-12s: %s\n", "algo name", name); out += String.format("%-12s: %s\n", "category", category); out += String.format("%-12s: %s\n", "class", clazz); - out += String.format("%-12s: %s\n", "vre", vre); - out += String.format("%-12s: %s\n", "p6", p6); - out += String.format("%-12s: %s\n", "p7", p7); + out += String.format("%-12s: %s\n", "scope", scope); + out += String.format("%-12s: %s\n", "algo type", algorithmType); + out += String.format("%-12s: %s\n", "skip java", skipJava); out += String.format("%-12s: %s\n", "url", url); out += String.format("%-12s: %s\n", "description", this.description); return out; diff --git a/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/process/AlgorithmPackageParser.java b/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/process/AlgorithmPackageParser.java index a5ba19b..cb6cd50 100644 --- a/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/process/AlgorithmPackageParser.java +++ b/src/main/java/org/gcube/dataanalysys/dataminerpoolmanager/process/AlgorithmPackageParser.java @@ -50,7 +50,9 @@ public class AlgorithmPackageParser { return null; } else { Map> parsedMetadata = this.parseMetadata(packageMetadata); - return this.createAlgorithm(parsedMetadata); + Algorithm a = this.createAlgorithm(parsedMetadata); + a.setPackageURL(url); + return a; } } @@ -150,11 +152,9 @@ public class AlgorithmPackageParser { private Algorithm createAlgorithm(Map> metadata) { Algorithm out = new Algorithm(); out.setName(extractSingleValue(metadata, METADATA_ALGORITHM_NAME)); - out.setDescription(extractSingleValue(metadata, - METADATA_ALGORITHM_DESCRIPTION)); + out.setDescription(extractSingleValue(metadata, METADATA_ALGORITHM_DESCRIPTION)); out.setClazz(extractSingleValue(metadata, METADATA_CLASS_NAME)); - List dependencies = extractMultipleValues(metadata, - METADATA_PACKAGES); + List dependencies = extractMultipleValues(metadata, METADATA_PACKAGES); if (dependencies != null) { for (String pkg : dependencies) { Dependency dep = new Dependency();