git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineExternalAlgorithms@71702 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0ac27bf73e
commit
5caa07bf03
|
@ -28,13 +28,13 @@ public abstract class StandardLocalExternalAlgorithm implements Transducerer {
|
|||
inputs.add(new PrimitiveType(Enum.class.getName(), itemsList, PrimitiveTypes.ENUMERATED, name, description, defaultvalue));
|
||||
}
|
||||
|
||||
protected void addRemoteDatabaseInput(String name, String urlParameterName, String userParameterName, String passwordParameterName) {
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASERRNAME,name,"RR name"));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEURL,urlParameterName,"RR name"));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEUSERNAME,name,"RR name"));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEPASSWORD,name,"RR name"));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDRIVER,name,"RR name"));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDIALECT,name,"RR name"));
|
||||
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.REMOTEDATABASEURL,urlParameterName,""));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEUSERNAME,userParameterName,""));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEPASSWORD,passwordParameterName,""));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDRIVER,driverParameterName,""));
|
||||
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDIALECT,dialectParameterName,""));
|
||||
}
|
||||
|
||||
protected void addStringInput(String name, String description, String defaultvalue) {
|
||||
|
|
|
@ -14,6 +14,10 @@ public class TaxaMatchTransducer extends StandardLocalExternalAlgorithm {
|
|||
static String SpeciesOperator = "ComparisonOperatorforSpecies";
|
||||
static String Genus = "Genus";
|
||||
static String Species = "Species";
|
||||
static String databaseParameterName = "FishBase";
|
||||
static String userParameterName = "user";
|
||||
static String passwordParameterName = "password";
|
||||
static String urlParameterName = "FishBase";
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
|
@ -38,11 +42,20 @@ public class TaxaMatchTransducer extends StandardLocalExternalAlgorithm {
|
|||
String databasePwd = "0b1s@d4sc13nc3";
|
||||
String databaseName = "fishbase";
|
||||
*/
|
||||
String databaseIP = "biodiversity.db.i-marine.research-infrastructures.eu";
|
||||
String databaseUser = "postgres";
|
||||
String databasePwd = "0b1s@d4sc13nc3";
|
||||
String databaseName = "fishbase";
|
||||
String databaseJdbc = getInputParameter(urlParameterName);
|
||||
int separator = databaseJdbc.lastIndexOf("/");
|
||||
if (separator<0){
|
||||
log("Bad database URL: "+databaseJdbc);
|
||||
addOutputString("Number of Matches", "0");
|
||||
return;
|
||||
}
|
||||
|
||||
String databaseIP = databaseJdbc.substring(0,separator);
|
||||
String databaseName = databaseJdbc.substring(separator+1);
|
||||
String databaseUser = getInputParameter(userParameterName);
|
||||
String databasePwd = getInputParameter(passwordParameterName);
|
||||
log("Database Parameters to use: "+databaseIP+" "+databaseName+" "+databaseUser+" "+databasePwd);
|
||||
|
||||
log("Computing matching for " + genus + " " + species);
|
||||
log("With operators: " + genusOperator + " " + speciesOperator);
|
||||
if ((genus == null) || (species == null)) {
|
||||
|
@ -81,7 +94,7 @@ public class TaxaMatchTransducer extends StandardLocalExternalAlgorithm {
|
|||
addStringInput(Species, "Species", "morhua");
|
||||
addEnumerateInput(operators.values(), GenusOperator, "Comparison Operator for Genus", "" + operators.EQUAL);
|
||||
addEnumerateInput(operators.values(), SpeciesOperator, "Comparison Operator for Species", "" + operators.EQUAL);
|
||||
// addRemoteDatabaseInput("FishBase");
|
||||
addRemoteDatabaseInput(databaseParameterName,urlParameterName,userParameterName,passwordParameterName,"driver","dialect");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue