added type for variables
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@49683 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fc765e5a15
commit
857c8b9731
|
@ -185,7 +185,9 @@ public class LocalSplitGenerator implements Generator {
|
|||
} catch (Exception e) {
|
||||
AnalysisLogger.getLogger().trace("recreating table->"+e.getLocalizedMessage());
|
||||
}
|
||||
DatabaseFactory.executeUpdateNoTransaction(distributionModel.getDistributionTableStatement(), config.getParam("DatabaseDriver"), config.getParam("DatabaseUserName"), config.getParam("DatabasePassword"), config.getParam("DatabaseURL"), true);
|
||||
|
||||
// DatabaseFactory.executeUpdateNoTransaction(distributionModel.getDistributionTableStatement(), config.getParam("DatabaseDriver"), config.getParam("DatabaseUserName"), config.getParam("DatabasePassword"), config.getParam("DatabaseURL"), true);
|
||||
DatabaseFactory.executeUpdateNoTransaction(distributionModel.getDistributionTableStatement(), config.getDatabaseDriver(), config.getDatabaseUserName(), config.getDatabasePassword(), config.getDatabaseURL(), true);
|
||||
|
||||
AnalysisLogger.getLogger().trace("createTable()->OK!");
|
||||
}
|
||||
|
|
|
@ -115,10 +115,12 @@ public static void main(String[] args) throws Exception {
|
|||
config.setParam("EnvelopeTable","hspen_micro");
|
||||
config.setParam("PreprocessedTable", "maxminlat_hspen");
|
||||
config.setParam("CreateTable","true");
|
||||
/*
|
||||
config.setParam("DatabaseUserName","gcube");
|
||||
config.setParam("DatabasePassword","d4science2");
|
||||
config.setParam("DatabaseURL","jdbc:postgresql://localhost/testdb");
|
||||
config.setParam("DatabaseDriver","org.postgresql.Driver");
|
||||
*/
|
||||
|
||||
return config;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,6 @@ import java.io.File;
|
|||
import java.io.FileInputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLWarning;
|
||||
import java.sql.Statement;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -19,13 +16,11 @@ import org.dom4j.Document;
|
|||
import org.dom4j.Node;
|
||||
import org.dom4j.io.SAXReader;
|
||||
import org.gcube.contentmanagement.lexicalmatcher.analysis.core.LexicalEngineConfiguration;
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||
import org.gcube.contentmanagement.lexicalmatcher.utils.FileTools;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.jdbc.Work;
|
||||
|
||||
public class DatabaseFactory{
|
||||
|
||||
|
@ -58,33 +53,47 @@ public class DatabaseFactory{
|
|||
while (nodesIterator.hasNext()) {
|
||||
Node currentnode = nodesIterator.next();
|
||||
String element = currentnode.valueOf("@name");
|
||||
if (element.equals("connection.driver_class"))
|
||||
if ((config.getDatabaseDriver() != null)&&(config.getDatabaseDriver().length()>0)){
|
||||
if (element.equals("connection.driver_class")){
|
||||
if ((config.getDatabaseDriver() != null)&&(config.getDatabaseDriver().length()>0))
|
||||
currentnode.setText(config.getDatabaseDriver());
|
||||
else
|
||||
config.setDatabaseDriver(currentnode.getText());
|
||||
}
|
||||
if (element.equals("connection.url")) {
|
||||
if ((config.getDatabaseURL() != null)&&(config.getDatabaseURL().length()>0))
|
||||
currentnode.setText(config.getDatabaseURL());
|
||||
else
|
||||
config.setDatabaseURL(currentnode.getText());
|
||||
}
|
||||
if (element.equals("connection.username")) {
|
||||
if ((config.getDatabaseUserName() != null)&&(config.getDatabaseUserName().length()>0))
|
||||
currentnode.setText(config.getDatabaseUserName());
|
||||
else
|
||||
config.setDatabaseUserName(currentnode.getText());
|
||||
}
|
||||
if (element.equals("connection.password")) {
|
||||
if ((config.getDatabasePassword() != null)&&(config.getDatabasePassword().length()>0))
|
||||
currentnode.setText(config.getDatabasePassword());
|
||||
else
|
||||
config.setDatabasePassword(currentnode.getText());
|
||||
}
|
||||
if (element.equals("dialect")) {
|
||||
if ((config.getDatabaseDialect() != null)&&(config.getDatabaseDialect().length()>0))
|
||||
currentnode.setText(config.getDatabaseDialect());
|
||||
else
|
||||
config.setDatabaseDialect(currentnode.getText());
|
||||
}
|
||||
if (element.equals("c3p0.idleConnectionTestPeriod")) {
|
||||
if (config.getDatabaseIdleConnectionTestPeriod() != null)
|
||||
currentnode.setText(config.getDatabaseIdleConnectionTestPeriod());
|
||||
else
|
||||
config.setDatabaseIdleConnectionTestPeriod(currentnode.getText());
|
||||
}
|
||||
if (element.equals("c3p0.automaticTestTable")) {
|
||||
if (config.getDatabaseAutomaticTestTable() != null)
|
||||
currentnode.setText(config.getDatabaseAutomaticTestTable());
|
||||
else
|
||||
config.setDatabaseAutomaticTestTable(currentnode.getText());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue