Gianpaolo Coro 2013-03-25 14:28:50 +00:00
parent 0ac27bf73e
commit 5caa07bf03
2 changed files with 25 additions and 12 deletions

View File

@ -28,13 +28,13 @@ public abstract class StandardLocalExternalAlgorithm implements Transducerer {
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 name, String urlParameterName, String userParameterName, String passwordParameterName) { protected void addRemoteDatabaseInput(String runtimeResourceName, String urlParameterName, String userParameterName, String passwordParameterName, String driverParameterName, String dialectParameterName) {
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASERRNAME,name,"RR name")); inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASERRNAME,runtimeResourceName,"RR name"));
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEURL,urlParameterName,"RR name")); inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEURL,urlParameterName,""));
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEUSERNAME,name,"RR name")); inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEUSERNAME,userParameterName,""));
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEPASSWORD,name,"RR name")); inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEPASSWORD,passwordParameterName,""));
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDRIVER,name,"RR name")); inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDRIVER,driverParameterName,""));
inputs.add(new DatabaseType(DatabaseParameters.REMOTEDATABASEDIALECT,name,"RR name")); 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) {

View File

@ -14,6 +14,10 @@ public class TaxaMatchTransducer extends StandardLocalExternalAlgorithm {
static String SpeciesOperator = "ComparisonOperatorforSpecies"; static String SpeciesOperator = "ComparisonOperatorforSpecies";
static String Genus = "Genus"; static String Genus = "Genus";
static String Species = "Species"; static String Species = "Species";
static String databaseParameterName = "FishBase";
static String userParameterName = "user";
static String passwordParameterName = "password";
static String urlParameterName = "FishBase";
@Override @Override
public String getDescription() { public String getDescription() {
@ -38,11 +42,20 @@ public class TaxaMatchTransducer extends StandardLocalExternalAlgorithm {
String databasePwd = "0b1s@d4sc13nc3"; String databasePwd = "0b1s@d4sc13nc3";
String databaseName = "fishbase"; String databaseName = "fishbase";
*/ */
String databaseIP = "biodiversity.db.i-marine.research-infrastructures.eu"; String databaseJdbc = getInputParameter(urlParameterName);
String databaseUser = "postgres"; int separator = databaseJdbc.lastIndexOf("/");
String databasePwd = "0b1s@d4sc13nc3"; if (separator<0){
String databaseName = "fishbase"; 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("Computing matching for " + genus + " " + species);
log("With operators: " + genusOperator + " " + speciesOperator); log("With operators: " + genusOperator + " " + speciesOperator);
if ((genus == null) || (species == null)) { if ((genus == null) || (species == null)) {
@ -81,7 +94,7 @@ public class TaxaMatchTransducer extends StandardLocalExternalAlgorithm {
addStringInput(Species, "Species", "morhua"); addStringInput(Species, "Species", "morhua");
addEnumerateInput(operators.values(), GenusOperator, "Comparison Operator for Genus", "" + operators.EQUAL); addEnumerateInput(operators.values(), GenusOperator, "Comparison Operator for Genus", "" + operators.EQUAL);
addEnumerateInput(operators.values(), SpeciesOperator, "Comparison Operator for Species", "" + operators.EQUAL); addEnumerateInput(operators.values(), SpeciesOperator, "Comparison Operator for Species", "" + operators.EQUAL);
// addRemoteDatabaseInput("FishBase"); addRemoteDatabaseInput(databaseParameterName,urlParameterName,userParameterName,passwordParameterName,"driver","dialect");
} }
} }