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

View File

@ -24,8 +24,8 @@ public class AlgorithmPackage ***REMOVED***
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 ***REMOVED***
private String clazz;
private String algorithmType;
private String skipJava;
private String packageURL;
private Collection<Action> actions;
@ -65,6 +69,10 @@ public class Algorithm ***REMOVED***
return dependencies;
***REMOVED***
public void setDependencies(Collection<Dependency> deps) ***REMOVED***
this.dependencies = deps;
***REMOVED***
public String toString() ***REMOVED***
String out = "Algorithm: " + this.getName()+"\n";
out+=" Class Name: " + this.getClazz()+"\n";
@ -89,4 +97,20 @@ public class Algorithm ***REMOVED***
this.packageURL = packageURL;
***REMOVED***
public String getAlgorithmType() ***REMOVED***
return algorithmType;
***REMOVED***
public void setAlgorithmType(String algorithmType) ***REMOVED***
this.algorithmType = algorithmType;
***REMOVED***
public String getSkipJava() ***REMOVED***
return skipJava;
***REMOVED***
public void setSkipJava(String skipJava) ***REMOVED***
this.skipJava = skipJava;
***REMOVED***
***REMOVED***

View File

@ -8,9 +8,9 @@ public class AddAlgorithmCommand ***REMOVED***
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 ***REMOVED***
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);
***REMOVED***
public void setDescription(String d) ***REMOVED***
if(d!=null) ***REMOVED***
d = d.trim();
if(d.startsWith("\"") && d.endsWith("\"")) ***REMOVED***
d = d.substring(1, d.length()-1).trim();
***REMOVED***
***REMOVED***
this.description = d;
***REMOVED***
public String getCommand() ***REMOVED***
return command;
***REMOVED***
@ -54,15 +67,15 @@ public class AddAlgorithmCommand ***REMOVED***
***REMOVED***
public String getVRE() ***REMOVED***
return vre;
return scope;
***REMOVED***
public String getP6() ***REMOVED***
return p6;
public String getAlgorithmType() ***REMOVED***
return algorithmType;
***REMOVED***
public String getP7() ***REMOVED***
return p7;
public String getSkipjava() ***REMOVED***
return skipJava;
***REMOVED***
public String getUrl() ***REMOVED***
@ -76,12 +89,12 @@ public class AddAlgorithmCommand ***REMOVED***
public String toString() ***REMOVED***
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 ***REMOVED***
return null;
***REMOVED*** else ***REMOVED***
Map<String, List<String>> parsedMetadata = this.parseMetadata(packageMetadata);
return this.createAlgorithm(parsedMetadata);
Algorithm a = this.createAlgorithm(parsedMetadata);
a.setPackageURL(url);
return a;
***REMOVED***
***REMOVED***
@ -150,11 +152,9 @@ public class AlgorithmPackageParser ***REMOVED***
private Algorithm createAlgorithm(Map<String, List<String>> metadata) ***REMOVED***
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) ***REMOVED***
for (String pkg : dependencies) ***REMOVED***
Dependency dep = new Dependency();