git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/SeaDataNetConnector@152576 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
abd62e73eb
commit
47e5114362
|
@ -1,75 +0,0 @@
|
|||
package seadatanetconnector;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.ColumnTypesList;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.InputTable;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.OutputTable;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.StatisticalType;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.PrimitiveTypes;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
|
||||
import org.gcube.dataanalysis.ecoengine.interfaces.StandardLocalExternalAlgorithm;
|
||||
|
||||
public class prova extends StandardLocalExternalAlgorithm {
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
// TODO Auto-generated method stub
|
||||
return "Creazione file";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
//File outputfile;
|
||||
@Override
|
||||
protected void process() throws Exception {
|
||||
status=0;
|
||||
/*
|
||||
String name= getInputParameter("fileName");
|
||||
AnalysisLogger.getLogger().debug("Received File: "+name);
|
||||
File outfile = new File(name);
|
||||
//usare per scrivere più veloce
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(outfile));
|
||||
|
||||
writer.write("Il nome del file è :"+name+"\n");
|
||||
|
||||
writer.close();
|
||||
outputfile = outfile;
|
||||
*/
|
||||
status=100;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setInputParameters() {
|
||||
addStringInput("fileName", "inserire nome file", "file");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public StatisticalType getOutput(){
|
||||
/*PrimitiveType file = new PrimitiveType(File.class.getName(),
|
||||
outputfile,
|
||||
PrimitiveTypes.FILE,
|
||||
"OutputFile",
|
||||
"nome del file");
|
||||
|
||||
return file;
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package seadatanetconnector;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.FileTools;
|
||||
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType;
|
||||
import org.gcube.dataanalysis.ecoengine.datatypes.StatisticalType;
|
||||
import org.gcube.dataanalysis.ecoengine.interfaces.ComputationalAgent;
|
||||
import org.gcube.dataanalysis.ecoengine.interfaces.StandardLocalExternalAlgorithm;
|
||||
import org.gcube.dataanalysis.ecoengine.processing.factories.TransducerersFactory;
|
||||
import org.gcube.dataanalysis.ecoengine.test.regression.Regressor;
|
||||
|
||||
|
||||
public class testprova {
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("TEST 1");
|
||||
List<ComputationalAgent> trans = null;
|
||||
|
||||
trans = TransducerersFactory.getTransducerers(testConfigLocal());
|
||||
ComputationalAgent prova = trans.get(0);
|
||||
prova.init();
|
||||
prova.compute();
|
||||
StatisticalType output = prova.getOutput();
|
||||
System.out.println(output.getDescription());
|
||||
System.out.println(output.getClass());
|
||||
if (output instanceof PrimitiveType){
|
||||
PrimitiveType ptype = (PrimitiveType) output;
|
||||
File file = (File)ptype.getContent();
|
||||
|
||||
System.out.println(file.getAbsolutePath());
|
||||
System.out.println(FileTools.loadString(file.getAbsolutePath(), "UTF-8"));
|
||||
}
|
||||
trans = null;
|
||||
}
|
||||
|
||||
private static AlgorithmConfiguration testConfigLocal() {
|
||||
|
||||
AlgorithmConfiguration config = Regressor.getConfig();
|
||||
config.setAgent("PROVA");
|
||||
|
||||
config.setParam("fileName", "test.txt");
|
||||
config.setParam("fileName", "test2.txt");
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue