git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineExternalAlgorithms@74171 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a972851b6b
commit
a975c4c0b4
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.dataanalysis;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
package org.gube.examples;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||
import org.gcube.dataanalysis.StandardLocalExternalAlgorithm;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.StatisticalType;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.PrimitiveTypes;
|
||||
|
||||
public class MyAlgorithm extends StandardLocalExternalAlgorithm{
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
AnalysisLogger.getLogger().debug("Initialization");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "An algorithm for testing deployment";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void process() throws Exception {
|
||||
String myname = getInputParameter("Name");
|
||||
FileWriter fw = new FileWriter(new File(myname));
|
||||
fw.write("hi there");
|
||||
fw.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setInputParameters() {
|
||||
addStringInput("Name","Your Name","Gianpaolo");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
AnalysisLogger.getLogger().debug("Shutdown");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatisticalType getOutput() {
|
||||
PrimitiveType file = new PrimitiveType(
|
||||
File.class.getName(),
|
||||
new File(getInputParameter("Name")),
|
||||
PrimitiveTypes.FILE,
|
||||
"MyNameFile",
|
||||
"my output file");
|
||||
|
||||
PrimitiveType name = new PrimitiveType(
|
||||
String.class.getName(),
|
||||
getInputParameter("Name") ,
|
||||
PrimitiveTypes.STRING,
|
||||
"MyName",
|
||||
"My name");
|
||||
|
||||
LinkedHashMap<String, StatisticalType> map = new LinkedHashMap<String, StatisticalType>();
|
||||
|
||||
map.put("MyFile", file);
|
||||
map.put("MyName", name);
|
||||
|
||||
PrimitiveType output = new PrimitiveType(
|
||||
LinkedHashMap.class.getName(),
|
||||
map,
|
||||
PrimitiveTypes.MAP,
|
||||
"ResultsMap",
|
||||
"Results Map");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue