2015-09-29 18:13:14 +02:00
|
|
|
package org.gcube.dataanalysis.seadatanet;
|
|
|
|
|
|
|
|
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.ColumnType;
|
|
|
|
import org.gcube.dataanalysis.ecoengine.datatypes.DatabaseType;
|
|
|
|
import org.gcube.dataanalysis.ecoengine.datatypes.InputTable;
|
|
|
|
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 SeaDataNetConnector extends StandardLocalExternalAlgorithm {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void init() throws Exception {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getDescription() {
|
|
|
|
// TODO Auto-generated method stub
|
2015-09-29 18:47:29 +02:00
|
|
|
return "Connector for the SeaDataNet infrastructure";
|
2015-09-29 18:13:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
File outputfile;
|
|
|
|
@Override
|
|
|
|
protected void process() throws Exception {
|
|
|
|
String outpath = config.getPersistencePath();
|
|
|
|
File neofile = new File(outpath,"neofile.txt");
|
|
|
|
BufferedWriter fileWriter = new BufferedWriter(new FileWriter(neofile));
|
|
|
|
fileWriter.write("test test");
|
|
|
|
fileWriter.close();
|
|
|
|
|
|
|
|
outputfile=neofile;
|
|
|
|
|
|
|
|
AnalysisLogger.getLogger().debug("Input Table: "+config.getParam("InputTable"));
|
|
|
|
AnalysisLogger.getLogger().debug("Input Long: "+config.getParam("Longitude"));
|
|
|
|
AnalysisLogger.getLogger().debug("Input Lat: "+config.getParam("Latitude"));
|
|
|
|
AnalysisLogger.getLogger().debug("Input Qt: "+config.getParam("Quantity"));
|
|
|
|
AnalysisLogger.getLogger().debug("Input X: "+config.getParam("axisX"));
|
|
|
|
AnalysisLogger.getLogger().debug("Input Y: "+config.getParam("axisY"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void setInputParameters() {
|
|
|
|
|
|
|
|
List<TableTemplates> templates = new ArrayList<TableTemplates>();
|
|
|
|
templates.add(TableTemplates.GENERIC);
|
|
|
|
InputTable tinput = new InputTable(templates, "InputTable", "Input tabular resource");
|
|
|
|
|
|
|
|
inputs.add(tinput);
|
|
|
|
|
|
|
|
ColumnType p1 = new ColumnType("InputTable", "Longitude", "The column containing longitude decimal values", "longitude", false);
|
|
|
|
ColumnType p2 = new ColumnType("InputTable", "Latitude", "The column containing latitude decimal values", "latitude", false);
|
|
|
|
ColumnType p3 = new ColumnType("InputTable", "Quantity", "The column containing quantity values", "quantity", false);
|
|
|
|
|
|
|
|
inputs.add(p1);
|
|
|
|
inputs.add(p2);
|
|
|
|
inputs.add(p3);
|
|
|
|
|
|
|
|
addStringInput("axisX", "The map's axisX dimension","DimX_");
|
|
|
|
addStringInput("axisY", "The map's axisY dimension","DimmY_");
|
|
|
|
|
|
|
|
|
|
|
|
//DatabaseType.addDefaultDBPars(inputs);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void shutdown() {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public StatisticalType getOutput(){
|
|
|
|
PrimitiveType file = new PrimitiveType(File.class.getName(),
|
|
|
|
outputfile,
|
|
|
|
PrimitiveTypes.FILE,
|
|
|
|
"OutputFile",
|
2015-09-29 19:08:22 +02:00
|
|
|
"file name");
|
2015-09-29 18:13:14 +02:00
|
|
|
|
|
|
|
return file;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|