This commit is contained in:
Paolo Fabriani 2016-11-25 10:52:54 +00:00
parent b562e47e53
commit bb84400e0d
4 changed files with 61 additions and 24 deletions

View File

@ -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());

View File

@ -13,6 +13,10 @@ public class Algorithm {
private String clazz;
private String algorithmType;
private String skipJava;
private String packageURL;
private Collection<Action> actions;
@ -65,6 +69,10 @@ public class Algorithm {
return dependencies;
}
public void setDependencies(Collection<Dependency> 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;
}
}

View File

@ -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;

View File

@ -50,7 +50,9 @@ public class AlgorithmPackageParser {
return null;
} else {
Map<String, List<String>> 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<String, List<String>> 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<String> dependencies = extractMultipleValues(metadata,
METADATA_PACKAGES);
List<String> dependencies = extractMultipleValues(metadata, METADATA_PACKAGES);
if (dependencies != null) {
for (String pkg : dependencies) {
Dependency dep = new Dependency();