git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/DataMiner@154924 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9c11149a19
commit
585b132d0f
|
@ -1,137 +0,0 @@
|
|||
package org.gcube.dataanalysis.wps.statisticalmanager.synchserver.codegeneration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.FileTools;
|
||||
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.StatisticalType;
|
||||
import org.gcube.dataanalysis.ecoengine.processing.factories.ClusterersFactory;
|
||||
import org.gcube.dataanalysis.ecoengine.processing.factories.EvaluatorsFactory;
|
||||
import org.gcube.dataanalysis.ecoengine.processing.factories.GeneratorsFactory;
|
||||
import org.gcube.dataanalysis.ecoengine.processing.factories.ModelersFactory;
|
||||
import org.gcube.dataanalysis.ecoengine.processing.factories.ProcessorsFactory;
|
||||
import org.gcube.dataanalysis.ecoengine.processing.factories.TransducerersFactory;
|
||||
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.StatisticalTypeToWPSType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ClassGenerator {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ClassGenerator.class);
|
||||
|
||||
public static String configPath = "./cfg/";
|
||||
public static String generationPath = "./src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mappedclasses/";
|
||||
public StatisticalTypeToWPSType converter;
|
||||
|
||||
public ClassGenerator() throws Exception {
|
||||
converter = new StatisticalTypeToWPSType();
|
||||
}
|
||||
|
||||
public void generateEcologicalEngineClasses() throws Exception {
|
||||
AlgorithmConfiguration config = new AlgorithmConfiguration();
|
||||
config.setConfigPath(configPath);
|
||||
// set scope etc..
|
||||
HashMap<String, List<String>> algorithms = ProcessorsFactory.getAllFeatures(config);
|
||||
for (String algorithmSet : algorithms.keySet()) {
|
||||
List<String> parametersList = algorithms.get(algorithmSet);
|
||||
LOGGER.trace(algorithmSet + ":" + parametersList.toString());
|
||||
|
||||
for (String algorithm : parametersList) {
|
||||
// got an algorithm
|
||||
LOGGER.trace("Algorithm: " + algorithm);
|
||||
String description = ""; // get this information
|
||||
String name = ""; // get this information
|
||||
StringBuffer classWriter = new StringBuffer();
|
||||
List<StatisticalType> inputs = null;
|
||||
StatisticalType outputs = null;
|
||||
name = algorithm;
|
||||
// build class preamble
|
||||
config.setAgent(algorithm);
|
||||
config.setModel(algorithm);
|
||||
config.setAlgorithmClassLoader(Thread.currentThread().getContextClassLoader());
|
||||
String packageString = "";
|
||||
String interfaceString = "";
|
||||
try{
|
||||
if (algorithmSet.equals("DISTRIBUTIONS")) {
|
||||
packageString = "generators";
|
||||
interfaceString = "IGenerator";
|
||||
inputs = GeneratorsFactory.getAlgorithmParameters(configPath, algorithm, config);
|
||||
description = GeneratorsFactory.getDescription(configPath, algorithm,config);
|
||||
outputs = GeneratorsFactory.getAlgorithmOutput(configPath, algorithm,config);
|
||||
} else if (algorithmSet.equals("TRANSDUCERS")) {
|
||||
packageString = "transducerers";
|
||||
interfaceString = "ITransducer";
|
||||
inputs = TransducerersFactory.getTransducerParameters(config, algorithm);
|
||||
description = TransducerersFactory.getDescription(config, algorithm);
|
||||
outputs = TransducerersFactory.getTransducerOutput(config, algorithm);
|
||||
} else if (algorithmSet.equals("MODELS")) {
|
||||
packageString = "modellers";
|
||||
interfaceString = "IModeller";
|
||||
inputs = ModelersFactory.getModelParameters(configPath, algorithm,config);
|
||||
description = ModelersFactory.getDescription(configPath, algorithm,config);
|
||||
outputs = ModelersFactory.getModelOutput(configPath, algorithm,config);
|
||||
} else if (algorithmSet.equals("CLUSTERERS")) {
|
||||
packageString = "clusterers";
|
||||
interfaceString = "IClusterer";
|
||||
inputs = ClusterersFactory.getClustererParameters(configPath, algorithm,config);
|
||||
description = ClusterersFactory.getDescription(configPath, algorithm,config);
|
||||
outputs = ClusterersFactory.getClustererOutput(configPath, algorithm,config);
|
||||
} else if (algorithmSet.equals("TEMPORAL_ANALYSIS")) {
|
||||
|
||||
} else if (algorithmSet.equals("EVALUATORS")) {
|
||||
packageString = "evaluators";
|
||||
interfaceString = "IEvaluator";
|
||||
inputs = EvaluatorsFactory.getEvaluatorParameters(configPath, algorithm,config);
|
||||
description = EvaluatorsFactory.getDescription(configPath, algorithm,config);
|
||||
outputs = EvaluatorsFactory.getEvaluatorOutput(configPath, algorithm,config);
|
||||
}
|
||||
}catch(Exception e){
|
||||
LOGGER.error("Error in retrieving output: ",e);
|
||||
}
|
||||
classWriter.append(((String) StatisticalTypeToWPSType.templates.get("package")).replace("#PACKAGE#", packageString) + "\n" + ((String) StatisticalTypeToWPSType.templates.get("import")) + "\n");
|
||||
LOGGER.trace("Class preamble: \n" + classWriter.toString());
|
||||
|
||||
// build class description
|
||||
String classdescription = (String) StatisticalTypeToWPSType.templates.get("description");
|
||||
//modification of 20/07/15
|
||||
classdescription = classdescription.replace("#TITLE#", name).replace("#ABSTRACT#", description).replace("#CLASSNAME#", name).replace("#PACKAGE#", packageString);
|
||||
LOGGER.trace("Class description : \n" + classdescription);
|
||||
String classdefinition = (String) StatisticalTypeToWPSType.templates.get("class_definition");
|
||||
classdefinition = classdefinition.replace("#CLASSNAME#", name).replace("#INTERFACE#", interfaceString);
|
||||
LOGGER.trace("Class definition: \n" + classdefinition);
|
||||
classWriter.append(classdescription + "\n");
|
||||
classWriter.append(classdefinition + "\n");
|
||||
// attach scope input deprecated!
|
||||
// classWriter.append((String) StatisticalTypeToWPSType.templates.get("scopeInput") + "\n");
|
||||
// classWriter.append((String) StatisticalTypeToWPSType.templates.get("usernameInput") + "\n");
|
||||
for (StatisticalType input : inputs) {
|
||||
LOGGER.trace("input is {}",input);
|
||||
String wpsInput = converter.convert2WPSType(input, true, config);
|
||||
if (wpsInput != null) {
|
||||
classWriter.append(wpsInput + "\n");
|
||||
LOGGER.trace("Input:\n {}", wpsInput);
|
||||
}
|
||||
}
|
||||
if (outputs != null) {
|
||||
LOGGER.trace("Alg. Output:\n {}", outputs);
|
||||
String wpsOutput = converter.convert2WPSType(outputs, false, config);
|
||||
classWriter.append(wpsOutput + "\n");
|
||||
LOGGER.trace("Output:\n {}", wpsOutput);
|
||||
}
|
||||
else
|
||||
LOGGER.trace("Output is empty!");
|
||||
// add potential outputs
|
||||
classWriter.append((String) StatisticalTypeToWPSType.templates.getProperty("optionalOutput") + "\n");
|
||||
classWriter.append((String) StatisticalTypeToWPSType.templates.get("class_closure"));
|
||||
|
||||
LOGGER.trace("Class:\n {}",classWriter.toString());
|
||||
LOGGER.trace("Saving...");
|
||||
FileTools.saveString(generationPath + packageString+"/"+algorithm + ".java", classWriter.toString(), true, "UTF-8");
|
||||
// break;
|
||||
}
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -50,7 +50,10 @@ public class StatisticalTypeToWPSType {
|
|||
static String DEFAULT = "#DEFAULT#";
|
||||
static String ID = "#ID#";
|
||||
static String IDMETHOD = "#IDMETHOD#";
|
||||
|
||||
static String METHOD_ORDER = "#ORDER_VALUE#";
|
||||
|
||||
private int orderValue = 0;
|
||||
|
||||
public LinkedHashMap<String, IOWPSInformation> inputSet = new LinkedHashMap<String, IOWPSInformation>();
|
||||
public LinkedHashMap<String, IOWPSInformation> outputSet = new LinkedHashMap<String, IOWPSInformation>();
|
||||
public List<File> generatedFiles = new ArrayList<File>();
|
||||
|
@ -226,7 +229,7 @@ public class StatisticalTypeToWPSType {
|
|||
outputType = "pngFile";
|
||||
outputType += isinput ? "Input" : "Output";
|
||||
|
||||
wpstype = wpstype + "\n" + ((String) templates.get(outputType)).replace(ABSTRACT, subel).replace(TITLE, subel).replace(ID, subel).replace(IDMETHOD, cleanID(id)).replace(DEFAULT, defaultVal);
|
||||
wpstype = wpstype + "\n" + ((String) templates.get(outputType)).replace(ABSTRACT, subel).replace(TITLE, subel).replace(ID, subel).replace(METHOD_ORDER, Integer.toString(orderValue++)).replace(IDMETHOD, cleanID(id)).replace(DEFAULT, defaultVal);
|
||||
|
||||
String imagefilename = new File(webpersistence, subel + "_" + UUID.randomUUID() + ".png").getAbsolutePath();
|
||||
BufferedImage bi = ImageTools.toBufferedImage(subelements.get(subel));
|
||||
|
@ -332,7 +335,7 @@ public class StatisticalTypeToWPSType {
|
|||
// wpstype = ((String) templates.get(outputType)).replace(ABSTRACT,
|
||||
// abstractStr).replace(TITLE, name).replace(ID,
|
||||
// id).replace(DEFAULT, defaultVal).replace(ALLOWED, allowed);
|
||||
wpstype = ((String) templates.get(outputType)).replace(ABSTRACT, "Name of the parameter: " + name + ". " + abstractStr).replace(TITLE, abstractStr).replace(ID, id).replace(IDMETHOD, cleanID(id)).replace(DEFAULT, defaultVal).replace(ALLOWED, allowed);
|
||||
wpstype = ((String) templates.get(outputType)).replace(ABSTRACT, "Name of the parameter: " + name + ". " + abstractStr).replace(TITLE, abstractStr).replace(ID, id).replace(METHOD_ORDER, Integer.toString(orderValue++)).replace(IDMETHOD, cleanID(id)).replace(DEFAULT, defaultVal).replace(ALLOWED, allowed);
|
||||
|
||||
IOWPSInformation info = new IOWPSInformation();
|
||||
info.setName(name);
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
package=package org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.#PACKAGE#;
|
||||
import=import java.io.File;\nimport java.net.URL;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.LinkedHashMap;\nimport java.io.StringWriter;\nimport org.apache.commons.io.IOUtils;\nimport org.apache.xmlbeans.XmlObject;\nimport org.gcube.dataanalysis.wps.statisticalmanager.synchserver.bindings.*;\nimport org.n52.wps.algorithm.annotation.*;\nimport org.n52.wps.io.data.*;\nimport org.n52.wps.io.data.binding.complex.*;\nimport org.n52.wps.io.data.binding.literal.*;\nimport org.n52.wps.server.*;import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.AbstractEcologicalEngineMapper;import org.n52.wps.server.*;import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.*;
|
||||
import=import java.io.File;\nimport java.net.URL;\nimport org.n52.wps.algorithm.annotation.MethodOrder;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.LinkedHashMap;\nimport java.io.StringWriter;\nimport org.apache.commons.io.IOUtils;\nimport org.apache.xmlbeans.XmlObject;\nimport org.gcube.dataanalysis.wps.statisticalmanager.synchserver.bindings.*;\nimport org.n52.wps.algorithm.annotation.*;\nimport org.n52.wps.io.data.*;\nimport org.n52.wps.io.data.binding.complex.*;\nimport org.n52.wps.io.data.binding.literal.*;\nimport org.n52.wps.server.*;import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.AbstractEcologicalEngineMapper;import org.n52.wps.server.*;import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.*;
|
||||
description=@Algorithm(statusSupported=true, title="#TITLE#", abstrakt="#ABSTRACT#", identifier="org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.#PACKAGE#.#CLASSNAME#", version = "1.1.0")
|
||||
class_definition=public class #CLASSNAME# extends AbstractEcologicalEngineMapper implements #INTERFACE#{
|
||||
class_closure=@Execute public void run() throws Exception { super.run(); } }
|
||||
scopeInput=@LiteralDataInput(abstrakt="The D4Science VRE scope in which the algorithm will be executed", defaultValue="/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab", title="scope", maxOccurs=1, minOccurs=1, identifier = "scope", binding = LiteralStringBinding.class) public void setScope(String data) {inputs.put(\"scope",data);}
|
||||
usernameInput=@LiteralDataInput(abstrakt="An identifier of the user who executes the computation", defaultValue="wpssynch.statistical", title="User name", maxOccurs=1, minOccurs=1, identifier = "user.name", binding = LiteralStringBinding.class) public void setUserName(String data) {inputs.put(\"user.name\",data);}
|
||||
stringInput=@LiteralDataInput(abstrakt="#ABSTRACT#", defaultValue="#DEFAULT#", title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1, binding = LiteralStringBinding.class) public void set#IDMETHOD#(String data) {inputs.put(\"#ID#\",data);}
|
||||
enumeratedInput=@LiteralDataInput(abstrakt="#ABSTRACT#", allowedValues= {#ALLOWED#}, defaultValue="#DEFAULT#", title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1, binding = LiteralStringBinding.class) public void set#IDMETHOD#(String data) {inputs.put(\"#ID#\",data);}
|
||||
doubleInput=@LiteralDataInput(abstrakt="#ABSTRACT#", defaultValue="#DEFAULT#", title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1, binding = LiteralDoubleBinding.class) public void set#IDMETHOD#(Double data) {inputs.put(\"#ID#\",""+data);}
|
||||
integerInput=@LiteralDataInput(abstrakt="#ABSTRACT#", defaultValue="#DEFAULT#", title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1, binding = LiteralIntBinding.class) public void set#IDMETHOD#(Integer data) {inputs.put(\"#ID#\",""+data);}
|
||||
booleanInput=@LiteralDataInput(abstrakt="#ABSTRACT#", defaultValue="#DEFAULT#", allowedValues= {"true","false"}, title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1,binding = LiteralBooleanBinding.class) public void set#IDMETHOD#(Boolean data) {inputs.put(\"#ID#\",""+data);}
|
||||
csvFileInput=@ComplexDataInput(abstrakt="#ABSTRACT#", title="#TITLE#", maxOccurs=1, minOccurs=1, identifier = "#ID#", binding = GenericFileDataBinding.class) public void set#IDMETHOD#(GenericFileData file) {inputs.put(\"#ID#\",file);}
|
||||
gislinkInput=@ComplexDataInput(abstrakt="#ABSTRACT#", title="#TITLE#", maxOccurs=1, minOccurs=1, identifier = "#ID#", binding = GisLinkDataInputBinding.class) public void set#IDMETHOD#(GenericFileData file) {inputs.put(\"#ID#\",file);}
|
||||
d4scienceFileInput=@ComplexDataInput(abstrakt="#ABSTRACT#", title="#TITLE#", maxOccurs=1, minOccurs=1, identifier = "#ID#", binding = D4ScienceDataInputBinding.class) public void set#IDMETHOD#(GenericFileData file) {inputs.put(\"#ID#\",file);}
|
||||
d4scienceFileOutput=@ComplexDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = D4ScienceFileDataBinding.class) public GenericFileData get#IDMETHOD#() {URL url=null;try {url = new URL((String) outputs.get("#ID#")); return new GenericFileData(url.openStream(),"application/d4science");} catch (Exception e) {e.printStackTrace();return null;}}
|
||||
pngFileOutput=@ComplexDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = PngFileDataBinding.class) public GenericFileData get#IDMETHOD#() {URL url=null;try {url = new URL((String) outputs.get("#ID#")); return new GenericFileData(url.openStream(),"image/png");} catch (Exception e) {e.printStackTrace();return null;}}
|
||||
csvFileOutput=@ComplexDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = CsvFileDataBinding.class) public GenericFileData get#IDMETHOD#() {URL url=null;try {url = new URL((String) outputs.get("#ID#")); return new GenericFileData(url.openStream(),"text/csv");} catch (Exception e) {e.printStackTrace();return null;}}
|
||||
gisLinkOutput=@ComplexDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = GisLinkDataBinding.class) public GenericFileData get#IDMETHOD#() {URL url=null;try {url = new URL((String) outputs.get("#ID#")); return new GenericFileData(url.openStream(),"application/geotiff");} catch (Exception e) {e.printStackTrace();return null;}}
|
||||
stringOutput=@LiteralDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = LiteralStringBinding.class) public String get#IDMETHOD#() {return (String) outputs.get("#ID#");}
|
||||
optionalOutput=@ComplexDataOutput(abstrakt="Output that is not predetermined", title="NonDeterministicOutput", identifier = "non_deterministic_output", binding = GenericXMLDataBinding.class)\n public XmlObject getNon_deterministic_output() {return (XmlObject) outputs.get("non_deterministic_output");}
|
||||
stringInput=@MethodOrder(value=#ORDER_VALUE#)\n@LiteralDataInput(abstrakt="#ABSTRACT#", defaultValue="#DEFAULT#", title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1, binding = LiteralStringBinding.class) public void set#IDMETHOD#(String data) {inputs.put(\"#ID#\",data);}
|
||||
enumeratedInput=@MethodOrder(value=#ORDER_VALUE#)\n@LiteralDataInput(abstrakt="#ABSTRACT#", allowedValues= {#ALLOWED#}, defaultValue="#DEFAULT#", title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1, binding = LiteralStringBinding.class) public void set#IDMETHOD#(String data) {inputs.put(\"#ID#\",data);}
|
||||
doubleInput=@MethodOrder(value=#ORDER_VALUE#)\n@LiteralDataInput(abstrakt="#ABSTRACT#", defaultValue="#DEFAULT#", title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1, binding = LiteralDoubleBinding.class) public void set#IDMETHOD#(Double data) {inputs.put(\"#ID#\",""+data);}
|
||||
integerInput=@MethodOrder(value=#ORDER_VALUE#)\n@LiteralDataInput(abstrakt="#ABSTRACT#", defaultValue="#DEFAULT#", title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1, binding = LiteralIntBinding.class) public void set#IDMETHOD#(Integer data) {inputs.put(\"#ID#\",""+data);}
|
||||
booleanInput=@MethodOrder(value=#ORDER_VALUE#)\n@LiteralDataInput(abstrakt="#ABSTRACT#", defaultValue="#DEFAULT#", allowedValues= {"true","false"}, title="#TITLE#", identifier = "#ID#", maxOccurs=1, minOccurs=1,binding = LiteralBooleanBinding.class) public void set#IDMETHOD#(Boolean data) {inputs.put(\"#ID#\",""+data);}
|
||||
csvFileInput=@MethodOrder(value=#ORDER_VALUE#)\n@ComplexDataInput(abstrakt="#ABSTRACT#", title="#TITLE#", maxOccurs=1, minOccurs=1, identifier = "#ID#", binding = GenericFileDataBinding.class) public void set#IDMETHOD#(GenericFileData file) {inputs.put(\"#ID#\",file);}
|
||||
gislinkInput=@MethodOrder(value=#ORDER_VALUE#)\n@ComplexDataInput(abstrakt="#ABSTRACT#", title="#TITLE#", maxOccurs=1, minOccurs=1, identifier = "#ID#", binding = GisLinkDataInputBinding.class) public void set#IDMETHOD#(GenericFileData file) {inputs.put(\"#ID#\",file);}
|
||||
d4scienceFileInput=@MethodOrder(value=#ORDER_VALUE#)\n@ComplexDataInput(abstrakt="#ABSTRACT#", title="#TITLE#", maxOccurs=1, minOccurs=1, identifier = "#ID#", binding = D4ScienceDataInputBinding.class) public void set#IDMETHOD#(GenericFileData file) {inputs.put(\"#ID#\",file);}
|
||||
d4scienceFileOutput=@MethodOrder(value=#ORDER_VALUE#)\n@ComplexDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = D4ScienceFileDataBinding.class) public GenericFileData get#IDMETHOD#() {URL url=null;try {url = new URL((String) outputs.get("#ID#")); return new GenericFileData(url.openStream(),"application/d4science");} catch (Exception e) {e.printStackTrace();return null;}}
|
||||
pngFileOutput=@MethodOrder(value=#ORDER_VALUE#)\n@ComplexDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = PngFileDataBinding.class) public GenericFileData get#IDMETHOD#() {URL url=null;try {url = new URL((String) outputs.get("#ID#")); return new GenericFileData(url.openStream(),"image/png");} catch (Exception e) {e.printStackTrace();return null;}}
|
||||
csvFileOutput=@MethodOrder(value=#ORDER_VALUE#)\n@ComplexDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = CsvFileDataBinding.class) public GenericFileData get#IDMETHOD#() {URL url=null;try {url = new URL((String) outputs.get("#ID#")); return new GenericFileData(url.openStream(),"text/csv");} catch (Exception e) {e.printStackTrace();return null;}}
|
||||
gisLinkOutput=@MethodOrder(value=#ORDER_VALUE#)\n@ComplexDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = GisLinkDataBinding.class) public GenericFileData get#IDMETHOD#() {URL url=null;try {url = new URL((String) outputs.get("#ID#")); return new GenericFileData(url.openStream(),"application/geotiff");} catch (Exception e) {e.printStackTrace();return null;}}
|
||||
stringOutput=@MethodOrder(value=#ORDER_VALUE#)\n@LiteralDataOutput(abstrakt="#ABSTRACT#", title="#TITLE#", identifier = "#ID#", binding = LiteralStringBinding.class) public String get#IDMETHOD#() {return (String) outputs.get("#ID#");}
|
||||
optionalOutput=@MethodOrder()\n@ComplexDataOutput(abstrakt="Output that is not predetermined", title="NonDeterministicOutput", identifier = "non_deterministic_output", binding = GenericXMLDataBinding.class)\n public XmlObject getNon_deterministic_output() {return (XmlObject) outputs.get("non_deterministic_output");}
|
|
@ -5,7 +5,9 @@ import java.io.IOException;
|
|||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
|
@ -15,7 +17,7 @@ import org.junit.Test;
|
|||
|
||||
public class AlgorithmTest {
|
||||
|
||||
|
||||
List<String> executeOnly = Arrays.asList();
|
||||
|
||||
@Test
|
||||
public void executeAlgorithmsFromFile() throws Exception{
|
||||
|
@ -41,6 +43,7 @@ public class AlgorithmTest {
|
|||
if (nextLine.startsWith("#"))
|
||||
algorithmName = nextLine;
|
||||
else{
|
||||
if (!(executeOnly.isEmpty() || executeOnly.contains(algorithmName))) continue;
|
||||
String callUrl = nextLine.replace("{PROTOCOL}", protocol).replace("{HOST}", hostname).replace("{TOKEN}", token).replace("{LAYERID}", layerID);
|
||||
try{
|
||||
long start = System.currentTimeMillis();
|
||||
|
|
|
@ -167,16 +167,16 @@
|
|||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.SUBMITQUERY&DataInputs=ResourceName=StatisticalManagerDataBase;DatabaseName=dataSpace;Read-Only Query=true;Apply Smart Correction=true;Language=NONE;Query=select * from smentry limit 2;
|
||||
#Raster data publisher
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?Request=DescribeProcess&Service=WPS&Version=1.0.0&gcube-token={TOKEN}&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.RASTER_DATA_PUBLISHER
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.RASTER_DATA_PUBLISHER&DataInputs=PublicationLevel=PUBLIC;DatasetAbstract=Abstract;DatasetTitle=Generic Raster Layer Test3;RasterFile={PROTOCOL}://data-d.d4science.org/QnFMOUdZNGhpcWVxTlNZNDVsZ01FTGN6S3lTR20wbE9HbWJQNStIS0N6Yz0;InnerLayerName=analyzed_field;FileNameOnInfra=raster-1465493226242.nc;Topics=analyzed_field;SpatialResolution=-1;
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.RASTER_DATA_PUBLISHER&DataInputs=PublicationLevel=PUBLIC;DatasetAbstract=Abstract;DatasetTitle=Generic Raster Layer Test3;RasterFile={PROTOCOL}://data.d4science.org/QTVNbXp5cmI0MG52TTE0K2paNzhXZWlCTHhweU8rUCtHbWJQNStIS0N6Yz0;InnerLayerName=analyzed_field;FileNameOnInfra=raster-1465493226242.nc;Topics=analyzed_field;SpatialResolution=-1;
|
||||
#Web app publisher
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?Request=DescribeProcess&Service=WPS&Version=1.0.0&gcube-token={TOKEN}&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.WEB_APP_PUBLISHER
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.WEB_APP_PUBLISHER&DataInputs=ZipFile={PROTOCOL}://goo.gl/dYQ089;
|
||||
#ECOPATH_WITH_ECOSIM
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?Request=DescribeProcess&Service=WPS&Version=1.0.0&gcube-token={TOKEN}&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.ECOPATH_WITH_ECOSIM
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.ECOPATH_WITH_ECOSIM&DataInputs=Model File={PROTOCOL}://data-d.d4science.org/emRmUEFtRGVZMnozcEdBekVHU3E4TlVyNmFHOU8yNDFHbWJQNStIS0N6Yz0;Config File={PROTOCOL}://data-d.d4science.org/emRmUEFtRGVZMnozcEdBekVHU3E4Skt5dkh2OXJObHFHbWJQNStIS0N6Yz0;
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.ECOPATH_WITH_ECOSIM&DataInputs=Model File={PROTOCOL}://data.d4science.org/eHFkNmhoSUwxMVpmcElhcUlmQUpWaWRGSjQzNkFXNElHbWJQNStIS0N6Yz0;Config File={PROTOCOL}://data.d4science.org/ZGFWaGc4NjUrQmRmcElhcUlmQUpWbTNVQjhqdUV3OWdHbWJQNStIS0N6Yz0;
|
||||
#OCCURRENCES_MERGER
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?Request=DescribeProcess&Service=WPS&Version=1.0.0&gcube-token={TOKEN}&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.generators.OCCURRENCES_MERGER
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.generators.OCCURRENCES_MERGER&DataInputs=final_Table_Name=MergedOcc;leftTableName={PROTOCOL}://data-d.d4science.org/KzI1TmN5TCtJT2hnRzM4WHQ3RWVlZlZLdCttTThpUnRHbWJQNStIS0N6Yz0;rightTableName={PROTOCOL}://data-d.d4science.org/KzI1TmN5TCtJT2hnRzM4WHQ3RWVlZlZLdCttTThpUnRHbWJQNStIS0N6Yz0;longitudeColumn=decimalLongitude;latitudeColumn=decimalLatitude;recordedByColumn=recordedBy;scientificNameColumn=scientificName;eventDateColumn=eventDate;lastModificationColumn=modified;spatialTolerance=0.5;confidence=80;
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.generators.OCCURRENCES_MERGER&DataInputs=final_Table_Name=MergedOcc;leftTableName={PROTOCOL}://data.d4science.org/QkNIYVp1dm81bnhmcElhcUlmQUpWbzlqZWlDbXpmaytHbWJQNStIS0N6Yz0;rightTableName={PROTOCOL}://data.d4science.org/QkNIYVp1dm81bnhmcElhcUlmQUpWbzlqZWlDbXpmaytHbWJQNStIS0N6Yz0;longitudeColumn=decimalLongitude;latitudeColumn=decimalLatitude;recordedByColumn=recordedBy;scientificNameColumn=scientificName;eventDateColumn=eventDate;lastModificationColumn=modified;spatialTolerance=0.5;confidence=80;
|
||||
#AQUAMAPS_SUITABLE
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?Request=DescribeProcess&Service=WPS&Version=1.0.0&gcube-token={TOKEN}&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.generators.AQUAMAPS_SUITABLE
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.generators.AQUAMAPS_SUITABLE&DataInputs=EnvelopeTable={PROTOCOL}://data.d4science.org/OFNMKzZLdGZrT3RmcElhcUlmQUpWbVpvS2h0UTEvWFRHbWJQNStIS0N6Yz0;CsquarecodesTable={PROTOCOL}://data.d4science.org/WUozaVh4aEN5ZTFmcElhcUlmQUpWaUd5ZlkwQ1RKT25HbWJQNStIS0N6Yz0;DistributionTableLabel=hspec;OccurrencePointsTable={PROTOCOL}://data.d4science.org/ZGVCYjJaWTFmaGhmcElhcUlmQUpWb2NoYVFvclBZaG5HbWJQNStIS0N6Yz0;
|
||||
|
@ -197,4 +197,6 @@
|
|||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.SHAPEFILE_PUBLISHER&DataInputs=PublicationLevel=PUBLIC;MapTitle=TestShape;ShapeFileName=shapefile2.shp;MapAbstract=Test;ShapeFileZip={PROTOCOL}://data.d4science.org/Z252VlVHRWNabFJmcElhcUlmQUpWcU1RM1ByVEQxK1lHbWJQNStIS0N6Yz0;Topics=Test|GP;
|
||||
#POINTS_TO_MAP
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?Request=DescribeProcess&Service=WPS&Version=1.0.0&gcube-token={TOKEN}&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.POINTS_TO_MAP
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.POINTS_TO_MAP&DataInputs=PublicationLevel=PUBLIC;MapName=TestPointsMap;InputTable={PROTOCOL}://data.d4science.org/SWxzeUlNZEpDVkpmcElhcUlmQUpWamVsWll3VitvVTdHbWJQNStIS0N6Yz0;xDimension=centerlong;yDimension=centerlat;Info=lme
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.POINTS_TO_MAP&DataInputs=PublicationLevel=PUBLIC;MapName=TestPointsMap;InputTable={PROTOCOL}://data.d4science.org/SWxzeUlNZEpDVkpmcElhcUlmQUpWamVsWll3VitvVTdHbWJQNStIS0N6Yz0;xDimension=centerlong;yDimension=centerlat;Info=lme
|
||||
#CMSY2
|
||||
{PROTOCOL}://{HOST}/wps/WebProcessingService?request=Execute&service=WPS&Version=1.0.0&gcube-token={TOKEN}&lang=en-US&Identifier=org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.CMSY_2&DataInputs=catch_file=http://data.d4science.org/MlVxMFYwdFVxTjlHV05FbExrRDJjODVwajFzVzNJcnVHbWJQNStIS0N6Yz0;Region=Mediterranean;Subregion=Adriatic+Sea;Stock=Athe_boy_AD;Group=Plankton+feeders;Name=Sand+smelt+in+Adriatic+Sea;EnglishName=Big+scale+sand+smelt;ScientificName=Atherina+boyeri;Source=-;MinOfYear=1970;MaxOfYear=2014;StartYear=1970;EndYear=2014;Flim=NA;Fpa=NA;Blim=NA;Bpa=NA;Bmsy=NA;FMSY=NA;MSY=NA;MSYBtrigger=NA;B40=NA;M=NA;Fofl=NA;last_F=NA;Resilience=Medium;r.low=NA;r.hi=NA;stb.low=0.2;stb.hi=0.6;int.yr=NA;intb.low=NA;intb.hi=NA;endb.low=0.01;endb.hi=0.4;q.start=NA;q.end=NA;btype=None;force.cmsy=false;Comment=landings
|
Loading…
Reference in New Issue