manage standard local algorithms executions
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@93133 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a9579a12af
commit
678a68060d
|
@ -4,6 +4,7 @@ public enum INFRASTRUCTURE {
|
||||||
|
|
||||||
RAINY_CLOUD,
|
RAINY_CLOUD,
|
||||||
D4SCIENCE,
|
D4SCIENCE,
|
||||||
LOCAL
|
LOCAL,
|
||||||
|
EXTERNAL_WPS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,18 +24,17 @@ public abstract class StandardLocalExternalAlgorithm implements Transducerer {
|
||||||
protected ResourceFactory resourceManager;
|
protected ResourceFactory resourceManager;
|
||||||
public LinkedHashMap<String, String> outputParameters = new LinkedHashMap<String, String>();
|
public LinkedHashMap<String, String> outputParameters = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
protected void addEnumerateInput(Object itemsList, String name, String description, String defaultvalue) {
|
protected void addEnumerateInput(Object itemsList, String name, String description, String defaultvalue) {
|
||||||
inputs.add(new PrimitiveType(Enum.class.getName(), itemsList, PrimitiveTypes.ENUMERATED, name, description, defaultvalue));
|
inputs.add(new PrimitiveType(Enum.class.getName(), itemsList, PrimitiveTypes.ENUMERATED, name, description, defaultvalue));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addRemoteDatabaseInput(String runtimeResourceName, String urlParameterName, String userParameterName, String passwordParameterName, String driverParameterName, String dialectParameterName) {
|
protected void addRemoteDatabaseInput(String runtimeResourceName, String urlParameterName, String userParameterName, String passwordParameterName, String driverParameterName, String dialectParameterName) {
|
||||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASERRNAME,runtimeResourceName,"RR name"));
|
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASERRNAME, runtimeResourceName, "RR name"));
|
||||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEURL,urlParameterName,""));
|
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEURL, urlParameterName, ""));
|
||||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEUSERNAME,userParameterName,""));
|
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEUSERNAME, userParameterName, ""));
|
||||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEPASSWORD,passwordParameterName,""));
|
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEPASSWORD, passwordParameterName, ""));
|
||||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDRIVER,driverParameterName,""));
|
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDRIVER, driverParameterName, ""));
|
||||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDIALECT,dialectParameterName,""));
|
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDIALECT, dialectParameterName, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addStringInput(String name, String description, String defaultvalue) {
|
protected void addStringInput(String name, String description, String defaultvalue) {
|
||||||
|
@ -43,11 +42,11 @@ public abstract class StandardLocalExternalAlgorithm implements Transducerer {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addIntegerInput(String name, String description, String defaultvalue) {
|
protected void addIntegerInput(String name, String description, String defaultvalue) {
|
||||||
inputs.add(new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, name,description,defaultvalue));
|
inputs.add(new PrimitiveType(Integer.class.getName(), null, PrimitiveTypes.NUMBER, name, description, defaultvalue));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addDoubleInput(String name, String description, String defaultvalue) {
|
protected void addDoubleInput(String name, String description, String defaultvalue) {
|
||||||
inputs.add(new PrimitiveType(Double.class.getName(), null, PrimitiveTypes.NUMBER, name,description,defaultvalue));
|
inputs.add(new PrimitiveType(Double.class.getName(), null, PrimitiveTypes.NUMBER, name, description, defaultvalue));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addOutputString(String name, String value) {
|
protected void addOutputString(String name, String value) {
|
||||||
|
@ -58,11 +57,18 @@ public abstract class StandardLocalExternalAlgorithm implements Transducerer {
|
||||||
public void compute() throws Exception {
|
public void compute() throws Exception {
|
||||||
AnalysisLogger.setLogger(config.getConfigPath() + AlgorithmConfiguration.defaultLoggerFile);
|
AnalysisLogger.setLogger(config.getConfigPath() + AlgorithmConfiguration.defaultLoggerFile);
|
||||||
status = 0;
|
status = 0;
|
||||||
process();
|
try {
|
||||||
status = 100;
|
process();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
AnalysisLogger.getLogger().debug("StandardLocalExternalAlgorithm->Error in processing");
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
status = 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void log(Object message){
|
protected void log(Object message) {
|
||||||
AnalysisLogger.getLogger().debug(message);
|
AnalysisLogger.getLogger().debug(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +95,7 @@ public abstract class StandardLocalExternalAlgorithm implements Transducerer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StatisticalType getOutput() {
|
public StatisticalType getOutput() {
|
||||||
PrimitiveType p = new PrimitiveType(Map.class.getName(), PrimitiveType.stringMap2StatisticalMap(outputParameters), PrimitiveTypes.MAP, "Species Match","");
|
PrimitiveType p = new PrimitiveType(Map.class.getName(), PrimitiveType.stringMap2StatisticalMap(outputParameters), PrimitiveTypes.MAP, "Species Match", "");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,10 @@ public class PeriodicityDetector {
|
||||||
power = MathFunctions.incrementPerc(power, (float)powers[i], counter);
|
power = MathFunctions.incrementPerc(power, (float)powers[i], counter);
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.periodicityStrength=power;
|
this.periodicityStrength=power;
|
||||||
|
if (this.periodicityStrength==-0.0)
|
||||||
|
this.periodicityStrength=0;
|
||||||
|
|
||||||
// reconstruct the F
|
// reconstruct the F
|
||||||
double meanF = MathFunctions.mean(maxfrequencies);
|
double meanF = MathFunctions.mean(maxfrequencies);
|
||||||
|
|
|
@ -177,7 +177,10 @@ public class DatabaseUtils {
|
||||||
for (int j=0;j<row.length;j++){
|
for (int j=0;j<row.length;j++){
|
||||||
String preprow = row[j].replaceAll("^'", "").replaceAll("'$", "");
|
String preprow = row[j].replaceAll("^'", "").replaceAll("'$", "");
|
||||||
preprow=preprow.replace("'", ""+(char)96);
|
preprow=preprow.replace("'", ""+(char)96);
|
||||||
sb.append("'"+preprow+"'");
|
if (preprow.equalsIgnoreCase("NULL"))
|
||||||
|
sb.append(preprow);
|
||||||
|
else
|
||||||
|
sb.append("'"+preprow+"'");
|
||||||
if (j<row.length-1)
|
if (j<row.length-1)
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue