added content types to generators, models and
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@50915 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c9a2ad0ee4
commit
2f11df1ca0
|
@ -22,4 +22,11 @@ public interface Generator extends ComputationalAgent{
|
|||
public String getLoad();
|
||||
|
||||
public void generate() throws Exception;
|
||||
|
||||
// gets the type of the content inside the generator: String, File etc.
|
||||
public String getContentType();
|
||||
|
||||
// gets the content of the model: e.g. Table indications etc.
|
||||
public Object getContent();
|
||||
|
||||
}
|
||||
|
|
|
@ -19,4 +19,8 @@ public interface SpatialProbabilityDistribution {
|
|||
//set the input parameters for this generator
|
||||
public HashMap<String, VarCouple> getInputParameters();
|
||||
|
||||
public String getContentType();
|
||||
|
||||
public Object getContent();
|
||||
|
||||
}
|
||||
|
|
|
@ -44,4 +44,6 @@ public interface SpatialProbabilityDistributionGeneric extends SpatialProbabilit
|
|||
//get a unique identifier for the geographical information: e.g. csquarecode representing the second element to be put in the species probability insert
|
||||
public String getGeographicalID(Object geoInfo);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -41,9 +41,9 @@ public class ModelAquamapsNN implements Model {
|
|||
parameters.put("AbsenceDataTable", new VarCouple(VARTYPE.STRING, "absence_data"));
|
||||
parameters.put("PresenceDataTable", new VarCouple(VARTYPE.STRING, "presence_data"));
|
||||
parameters.put("SpeciesName", new VarCouple(VARTYPE.STRING, ""));
|
||||
parameters.put("UserName", new VarCouple(VARTYPE.STRING, ""));
|
||||
parameters.put("LayersNeurons", new VarCouple(VARTYPE.STRING, "100,2"));
|
||||
|
||||
parameters.put("UserName", new VarCouple(VARTYPE.SERVICE, ""));
|
||||
parameters.put("DatabaseUserName", new VarCouple(VARTYPE.DATABASEUSERNAME, ""));
|
||||
parameters.put("DatabasePassword", new VarCouple(VARTYPE.DATABASEPASSWORD, ""));
|
||||
parameters.put("DatabaseURL", new VarCouple(VARTYPE.DATABASEURL, ""));
|
||||
|
@ -126,7 +126,7 @@ public class ModelAquamapsNN implements Model {
|
|||
|
||||
@Override
|
||||
public String getOutputType() {
|
||||
return String.class.getName();
|
||||
return File.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,12 +184,12 @@ public class ModelAquamapsNN implements Model {
|
|||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return String.class.getName();
|
||||
return File.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() {
|
||||
return fileName;
|
||||
return new File(fileName);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ public class ModelHSPEN implements Model {
|
|||
private int lastProcessedRecordsNumber;
|
||||
private long lastTime;
|
||||
AlgorithmConfiguration outconfig;
|
||||
private String outputTable;
|
||||
|
||||
@Override
|
||||
public float getVersion() {
|
||||
|
@ -87,7 +88,8 @@ public class ModelHSPEN implements Model {
|
|||
AnalysisLogger.getLogger().debug(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
outputTable = outconfig.getParam("OuputEnvelopeTable");
|
||||
// initialize queries
|
||||
dynamicAlterQuery = alterQuery.replace("%HSPEN%", outconfig.getParam("OuputEnvelopeTable"));
|
||||
dynamicDropTable = dropHspenTable.replace("%HSPEN%", outconfig.getParam("OuputEnvelopeTable"));
|
||||
|
@ -335,12 +337,12 @@ public class ModelHSPEN implements Model {
|
|||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return AlgorithmConfiguration.class.getName();
|
||||
return String.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() {
|
||||
return outconfig;
|
||||
return outputTable;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -411,7 +413,7 @@ public class ModelHSPEN implements Model {
|
|||
|
||||
@Override
|
||||
public String getOutputType() {
|
||||
return AlgorithmConfiguration.class.getName();
|
||||
return String.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -336,6 +336,16 @@ public class LocalSimpleSplitGenerator implements Generator {
|
|||
return distributionModel.getInputParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return distributionModel.getContentType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() {
|
||||
return distributionModel.getContent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -482,5 +482,15 @@ public class LocalSplitGenerator implements Generator {
|
|||
public HashMap<String, VarCouple> getInputParameters() {
|
||||
return distributionModel.getInputParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return String.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() {
|
||||
return config.getParam("DistributionTable");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -194,5 +194,15 @@ public class RainyCloudGenerator implements Generator {
|
|||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return String.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() {
|
||||
return config.getParam("DistributionTable");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -219,6 +219,16 @@ public class AquamapsSuitable implements SpatialProbabilityDistributionTable{
|
|||
return parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return String.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() {
|
||||
return destinationTable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.dataanalysis.ecoengine.spatialdistributions;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
@ -19,6 +20,7 @@ public class DummyAlgorithm implements SpatialProbabilityDistributionGeneric{
|
|||
|
||||
List<String> randomElements;
|
||||
String persistence;
|
||||
private String filename;
|
||||
static String persistedFilePrefix = "dummyfile";
|
||||
|
||||
public static void main (String[] args){
|
||||
|
@ -137,7 +139,7 @@ public class DummyAlgorithm implements SpatialProbabilityDistributionGeneric{
|
|||
}
|
||||
AnalysisLogger.getLogger().debug("Dummy overall dimension of the distribution: "+distribution.size()+" X "+ysize);
|
||||
//Construct the LineNumberReader object
|
||||
String filename = persistence+persistedFilePrefix+UUID.randomUUID();
|
||||
filename = persistence+persistedFilePrefix+UUID.randomUUID();
|
||||
|
||||
AnalysisLogger.getLogger().debug("Dummy Storing in "+filename);
|
||||
outputStream = new ObjectOutputStream(new FileOutputStream(persistence+persistedFilePrefix+"_"+UUID.randomUUID()));
|
||||
|
@ -194,4 +196,14 @@ public class DummyAlgorithm implements SpatialProbabilityDistributionGeneric{
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return File.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() {
|
||||
return new File(filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.dataanalysis.ecoengine.spatialdistributions;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
@ -24,6 +25,7 @@ public class TestAlgorithm implements SpatialProbabilityDistributionGeneric{
|
|||
}
|
||||
|
||||
String pers;
|
||||
private String filename;
|
||||
@Override
|
||||
public void init(AlgorithmConfiguration config) {
|
||||
pers = config.getPersistencePath();
|
||||
|
@ -90,7 +92,7 @@ public class TestAlgorithm implements SpatialProbabilityDistributionGeneric{
|
|||
}
|
||||
AnalysisLogger.getLogger().debug("overall dimension of the distribution: "+distribution.size()+" X "+ysize);
|
||||
//Construct the LineNumberReader object
|
||||
String filename = pers+"testProb"+UUID.randomUUID();
|
||||
filename = pers+"testProb"+UUID.randomUUID();
|
||||
|
||||
AnalysisLogger.getLogger().debug(" Storing in "+filename);
|
||||
outputStream = new ObjectOutputStream(new FileOutputStream(filename));
|
||||
|
@ -141,5 +143,14 @@ public class TestAlgorithm implements SpatialProbabilityDistributionGeneric{
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return File.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContent() {
|
||||
return new File(filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,9 @@ public static void main(String[] args) throws Exception {
|
|||
System.out.println("\n***TEST 11- Get Evaluator Parameters ***");
|
||||
List<Evaluator> eval = EvaluatorsFactory.getEvaluators(testConfigEvaluator());
|
||||
System.out.println("Database Default Values: "+eval);
|
||||
|
||||
|
||||
int cores = Runtime.getRuntime().availableProcessors();
|
||||
System.out.println("Number of cores: "+cores);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue