package org.gcube.dataanalysis.test renamed in org.gcube.dataaccess.test in src/test/java
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-access/DatabasesResourcesManager@96726 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fe61b11c54
commit
ce0e91da4a
|
@ -0,0 +1,36 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
|
||||||
|
import org.gcube.common.encryption.StringEncrypter;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||||
|
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
||||||
|
import org.gcube.dataanalysis.ecoengine.interfaces.StandardLocalExternalAlgorithm;
|
||||||
|
|
||||||
|
public class Prova {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
// AnalysisLogger.setLogger("./cfg/"+AlgorithmConfiguration.defaultLoggerFile);
|
||||||
|
|
||||||
|
// AnalysisLogger.getLogger().debug("ciao");
|
||||||
|
|
||||||
|
|
||||||
|
ScopeProvider.instance.set("/gcube/devsec");
|
||||||
|
|
||||||
|
try {
|
||||||
|
String password = StringEncrypter.getEncrypter().decrypt("UwNMZOK7FlIjGPR+NZCV6w==");
|
||||||
|
|
||||||
|
System.out.println(password);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
StandardLocalExternalAlgorithm sle = null;
|
||||||
|
// System.out.println("CIAO");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,164 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
//package org.gcube.dataanalysis.test;
|
||||||
|
//
|
||||||
|
//import java.io.IOException;
|
||||||
|
//
|
||||||
|
//import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||||
|
//import org.gcube.dataanalysis.databases.utils.DatabaseManagement;
|
||||||
|
//
|
||||||
|
//public class RegressionRandomSampleOnTable {
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @param args
|
||||||
|
// */
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
// AnalysisLogger.getLogger().debug("Executing: " + "Postgres");
|
||||||
|
// testPostgres();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug("Executing: " + "Mysql1");
|
||||||
|
//// testMysql1();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug("Executing: " + "Mysql2");
|
||||||
|
//// testMysql2();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug("Executing: " + "Mysql3");
|
||||||
|
//// testMysql3();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Postgres database
|
||||||
|
// private static void testPostgres() {
|
||||||
|
//
|
||||||
|
// // connection to database
|
||||||
|
// DatabaseManagement mgt = new DatabaseManagement("");
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// mgt.createConnection(
|
||||||
|
// "postgres",
|
||||||
|
// "d4science2",
|
||||||
|
// "org.postgresql.Driver",
|
||||||
|
// "org.hibernate.dialect.PostgreSQLDialect",
|
||||||
|
// "jdbc:postgresql://geoserver-dev.d4science-ii.research-infrastructures.eu:5432/aquamapsdb",
|
||||||
|
// "aquamapsdb");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SmartSampleOnTable operation
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // for database postgres, if a table is not in lower case format, it
|
||||||
|
// // is necessary to include the table name in quotes ""
|
||||||
|
// mgt.randomSampleOnTable("Divisions", "public");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug(
|
||||||
|
// "In RegressionRandomSampleOnTable->EXCEPTION: " + e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Mysql database
|
||||||
|
// private static void testMysql1() {
|
||||||
|
//
|
||||||
|
// // connection to database
|
||||||
|
// DatabaseManagement mgt = new DatabaseManagement("");
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// mgt.createConnection("root", "test", "com.mysql.jdbc.Driver",
|
||||||
|
// "org.hibernate.dialect.MySQLDialect",
|
||||||
|
// // "jdbc:mysql://146.48.87.169:3306/col2oct2010",
|
||||||
|
// "jdbc:mysql://146.48.87.169:3306/aquamaps", "hcaf_d");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SmartSampleOnTable operation
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // for database postgres, if a table is not in lower case format, it
|
||||||
|
// // is necessary to include the table name in quotes ""
|
||||||
|
// mgt.randomSampleOnTable("hcaf_d", "aquamaps");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug(
|
||||||
|
// "In RegressionRandomSampleOnTable->EXCEPTION: " + e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Mysql database
|
||||||
|
// private static void testMysql2() {
|
||||||
|
//
|
||||||
|
// // connection to database
|
||||||
|
// DatabaseManagement mgt = new DatabaseManagement("");
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// mgt.createConnection("root", "test", "com.mysql.jdbc.Driver",
|
||||||
|
// "org.hibernate.dialect.MySQLDialect",
|
||||||
|
// "jdbc:mysql://146.48.87.169:3306/col2oct2010",
|
||||||
|
//// "jdbc:mysql://146.48.87.169:3306/aquamaps",
|
||||||
|
// "example");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SmartSampleOnTable operation
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // for database postgres, if a table is not in lower case format, it
|
||||||
|
// // is necessary to include the table name in quotes ""
|
||||||
|
// mgt.randomSampleOnTable("example", "col2oct2010");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug(
|
||||||
|
// "In RegressionRandomSampleOnTable->EXCEPTION: " + e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //Mysql database
|
||||||
|
// private static void testMysql3() {
|
||||||
|
//
|
||||||
|
// // connection to database
|
||||||
|
// DatabaseManagement mgt = new DatabaseManagement("");
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// mgt.createConnection("root", "test", "com.mysql.jdbc.Driver",
|
||||||
|
// "org.hibernate.dialect.MySQLDialect",
|
||||||
|
// "jdbc:mysql://146.48.87.169:3306/col2oct2010",
|
||||||
|
//// "jdbc:mysql://146.48.87.169:3306/aquamaps",
|
||||||
|
// "common_names");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SmartSampleOnTable operation
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // for database postgres, if a table is not in lower case format, it
|
||||||
|
// // is necessary to include the table name in quotes ""
|
||||||
|
// mgt.randomSampleOnTable("common_names", "col2oct2010");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug(
|
||||||
|
// "In RegressionRandomSampleOnTable->EXCEPTION: " + e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
//package org.gcube.dataanalysis.test;
|
||||||
|
//
|
||||||
|
//import java.io.IOException;
|
||||||
|
//
|
||||||
|
//import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||||
|
//import org.gcube.dataanalysis.databases.utils.DatabaseManagement;
|
||||||
|
//import org.junit.rules.TestName;
|
||||||
|
//
|
||||||
|
//public class RegressionSmartSampleOnTable {
|
||||||
|
//
|
||||||
|
// // String [] testName = {"Postgres", "Mysql"};
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug("Executing: " + "Postgres");
|
||||||
|
// testPostgres();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug("Executing: " + "Mysql");
|
||||||
|
//// testMysql();
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Postgres database
|
||||||
|
// private static void testPostgres() {
|
||||||
|
//
|
||||||
|
// // connection to database
|
||||||
|
// DatabaseManagement mgt = new DatabaseManagement("");
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// mgt.createConnection(
|
||||||
|
// "postgres",
|
||||||
|
// "d4science2",
|
||||||
|
// "org.postgresql.Driver",
|
||||||
|
// "org.hibernate.dialect.PostgreSQLDialect",
|
||||||
|
// "jdbc:postgresql://geoserver-dev.d4science-ii.research-infrastructures.eu:5432/aquamapsdb",
|
||||||
|
// "aquamapsdb");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SmartSampleOnTable operation
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // for database postgres, if a table is not in lower case format, it
|
||||||
|
// // is necessary to include the table name in quotes ""
|
||||||
|
// mgt.smartSampleOnTable("Divisions", "public");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug(
|
||||||
|
// "In TestSmartSampleOnTable->EXCEPTION: " + e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Mysql database
|
||||||
|
// private static void testMysql() {
|
||||||
|
//
|
||||||
|
// // connection to database
|
||||||
|
// DatabaseManagement mgt = new DatabaseManagement("");
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// mgt.createConnection("root", "test", "com.mysql.jdbc.Driver",
|
||||||
|
// "org.hibernate.dialect.MySQLDialect",
|
||||||
|
// // "jdbc:mysql://146.48.87.169:3306/col2oct2010",
|
||||||
|
// "jdbc:mysql://146.48.87.169:3306/aquamaps", "hcaf_d");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SmartSampleOnTable operation
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // for database postgres, if a table is not in lower case format, it
|
||||||
|
// // is necessary to include the table name in quotes ""
|
||||||
|
// mgt.smartSampleOnTable("hcaf_d", "aquamaps");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug(
|
||||||
|
// "In TestSampleOnTable->EXCEPTION: " + e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,434 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
//package org.gcube.dataanalysis.test;
|
||||||
|
//import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||||
|
//import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
|
//
|
||||||
|
//import java.io.BufferedReader;
|
||||||
|
//import java.io.IOException;
|
||||||
|
//import java.io.InputStreamReader;
|
||||||
|
//import java.util.List;
|
||||||
|
//import java.util.Scanner;
|
||||||
|
//
|
||||||
|
//import org.gcube.common.encryption.StringEncrypter;
|
||||||
|
//import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
|
//import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
//import org.gcube.dataanalysis.databases.resources.DBResource;
|
||||||
|
//import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
||||||
|
//import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
|
//import org.gcube.resources.discovery.client.queries.impl.XQuery;
|
||||||
|
//import org.hibernate.SessionFactory;
|
||||||
|
//
|
||||||
|
//public class TestApp {
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @param args
|
||||||
|
// */
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
||||||
|
// ScopeProvider.instance.set("/gcube/devsec");
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// XQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
// query.addCondition("$resource/Profile/Category/text() eq 'Database'");
|
||||||
|
//
|
||||||
|
// DiscoveryClient<DBResource> prova=clientFor(DBResource.class);
|
||||||
|
// List<DBResource> access = prova.submit(query);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("size resource: "+access.size());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// for(int i=0;i<access.size();i++){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //access.get(i).parse();
|
||||||
|
// System.out.println("{ ID: "+access.get(i).getID()
|
||||||
|
// +" ResourceName: "+access.get(i).getResourceName()+" HostedOn: "+access.get(i).getHostedOn()
|
||||||
|
// +" PlatformName: "+access.get(i).getPlatformName()+" PlatformVersion: "+access.get(i).getPlatformVersion()+" }");
|
||||||
|
//
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
// for (int j=0;j<access.get(i).getAccessPoints().size();j++){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("############################# AccessPointInfo #################################");
|
||||||
|
// System.out.println("Description: "+access.get(i).getAccessPoints().get(j).getDescription()
|
||||||
|
// +"\n"+"Endpoint: "+access.get(i).getAccessPoints().get(j).address()
|
||||||
|
// //+"\n"+"Port Number: "+access.get(i).getAccessPoints().get(j).getPort());
|
||||||
|
// +"\n"+"Port Number: "+access.get(i).getPort());
|
||||||
|
//// );
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("Username: "+access.get(i).getAccessPoints().get(j).getUsername()
|
||||||
|
// +"\n"+"Password: "+access.get(i).getAccessPoints().get(j).getPassword()
|
||||||
|
// +"\n"+"DatabaseName: "+access.get(i).getAccessPoints().get(j).getDatabaseName()
|
||||||
|
// +"\n"+"Driver: "+access.get(i).getAccessPoints().get(j).getDriver()
|
||||||
|
// +"\n"+"Dialect: "+access.get(i).getAccessPoints().get(j).getDialect()
|
||||||
|
// +"\n"+"MaxConnections: "+access.get(i).getAccessPoints().get(j).getMaxConnections()
|
||||||
|
// +"\n"+"Schema: "+access.get(i).getAccessPoints().get(j).getSchema()
|
||||||
|
// +"\n"+"tableSpaceCount: "+access.get(i).getAccessPoints().get(j).getTableSpaceCount()
|
||||||
|
// +"\n"+"tableSpacePrefix: "+access.get(i).getAccessPoints().get(j).getTableSpacePrefix());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //System.out.println("Dim: "+access.get(i).getAccessPoints().get(j).getAuxiliaryProperties().size());
|
||||||
|
//
|
||||||
|
// if (access.get(i).getAccessPoints().get(j).getAuxiliaryProperties().size()!=0){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("AuxiliaryProperty: "+"'aquamapsWorldTable' "+access.get(i).getAccessPoints().get(j).getAuxiliaryProperties().get("aquamapsWorldTable"));
|
||||||
|
// System.out.println("AuxiliaryProperty: "+"'aquamapsDataStore' "+access.get(i).getAccessPoints().get(j).getAuxiliaryProperties().get("aquamapsDataStore"));
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// System.out.println();
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //System.out.println("ID "+access.get(i).getID()+" User "+access.get(i).getTestData().size());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // Fase di Selezione del DB e Normalizzazione
|
||||||
|
//
|
||||||
|
// //access.get(2).normalize("//geoserver-dev.d4science-ii.research-infrastructures.eu:5432/aquamapsdb");
|
||||||
|
//
|
||||||
|
//// access.get(1).normalize("jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // retrieve the decrypted version
|
||||||
|
//// try {
|
||||||
|
//// String password = StringEncrypter.getEncrypter().decrypt("Db/lnp5cAPwrAfjqorqctA==");
|
||||||
|
////
|
||||||
|
//// System.out.println("password Obis: " +password);
|
||||||
|
//// } catch (Exception e) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e.printStackTrace();
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Scanner sc = new Scanner(System.in);
|
||||||
|
//
|
||||||
|
// System.out.println("Seleziona la risorsa database: inserisci un numero fra 0 e "+Integer.toString((access.size())-1));
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
// String index_resource = sc.next();
|
||||||
|
//
|
||||||
|
// System.out.println("Ho letto: " + index_resource);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// int resourceIndex= Integer.valueOf(index_resource).intValue();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// System.out.println("Inserisci l'Endpoint della risorsa");
|
||||||
|
//// String Endpoint_value = sc.next();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("Seleziona il database: inserisci un numero fra 0 e "+Integer.toString(access.get(resourceIndex).getAccessPoints().size()-1));
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// String db_value = sc.next();
|
||||||
|
//
|
||||||
|
// System.out.println("Ho letto: " + db_value);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// int dbIndex= Integer.valueOf(db_value).intValue();
|
||||||
|
//
|
||||||
|
// //access.get(resourceIndex).normalize(access.get(resourceIndex).getAccessPoints().get(dbIndex).address());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //Fase di Stampa
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ///***** Da qui ho commentato
|
||||||
|
//
|
||||||
|
//// try {
|
||||||
|
// access.get(resourceIndex).normalize(dbIndex);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println();
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("---------------------------------------------------------------"+" Normalization: "+"-----------------------------------------------------");
|
||||||
|
// System.out.println();
|
||||||
|
// System.out.println();
|
||||||
|
// System.out.println();
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// for(int i=0;i<access.size();i++){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //access.get(i).parse();
|
||||||
|
// System.out.println("{ ID: "+access.get(i).getID()
|
||||||
|
// +" ResourceName: "+access.get(i).getResourceName()+" HostedOn: "+access.get(i).getHostedOn()
|
||||||
|
// +" PlatformName: "+access.get(i).getPlatformName()+" PlatformVersion: "+access.get(i).getPlatformVersion()+" }");
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
// for (int j=0;j<access.get(i).getAccessPoints().size();j++){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("############################# AccessPointInfo #################################");
|
||||||
|
// System.out.println("Description: "+access.get(i).getAccessPoints().get(j).getDescription()
|
||||||
|
// +"\n"+"Endpoint: "+access.get(i).getAccessPoints().get(j).address()
|
||||||
|
// //+"\n"+"Port Number: "+access.get(i).getAccessPoints().get(j).getPort());
|
||||||
|
// +"\n"+"Port Number: "+access.get(i).getPort());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("Username: "+access.get(i).getAccessPoints().get(j).getUsername()
|
||||||
|
// +"\n"+"Password: "+access.get(i).getAccessPoints().get(j).getPassword()
|
||||||
|
// +"\n"+"DatabaseName: "+access.get(i).getAccessPoints().get(j).getDatabaseName()
|
||||||
|
// +"\n"+"Driver: "+access.get(i).getAccessPoints().get(j).getDriver()
|
||||||
|
// +"\n"+"Dialect: "+access.get(i).getAccessPoints().get(j).getDialect()
|
||||||
|
// +"\n"+"MaxConnections: "+access.get(i).getAccessPoints().get(j).getMaxConnections()
|
||||||
|
// +"\n"+"Schema: "+access.get(i).getAccessPoints().get(j).getSchema()
|
||||||
|
// +"\n"+"tableSpaceCount: "+access.get(i).getAccessPoints().get(j).getTableSpaceCount()
|
||||||
|
// +"\n"+"tableSpacePrefix: "+access.get(i).getAccessPoints().get(j).getTableSpacePrefix());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //System.out.println("Dim: "+access.get(i).getAccessPoints().get(j).getAuxiliaryProperties().size());
|
||||||
|
//
|
||||||
|
// if (access.get(i).getAccessPoints().get(j).getAuxiliaryProperties().size()!=0){
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("AuxiliaryProperty: "+"'aquamapsWorldTable' "+access.get(i).getAccessPoints().get(j).getAuxiliaryProperties().get("aquamapsWorldTable"));
|
||||||
|
// System.out.println("AuxiliaryProperty: "+"'aquamapsDataStore' "+access.get(i).getAccessPoints().get(j).getAuxiliaryProperties().get("aquamapsDataStore"));
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// System.out.println();
|
||||||
|
// System.out.println();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //System.out.println("ID "+access.get(i).getID()+" User "+access.get(i).getTestData().size());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("---------------------------------------------------------------"+" Database Query: "+"-----------------------------------------------------");
|
||||||
|
//
|
||||||
|
//// // Sottomissione query
|
||||||
|
////
|
||||||
|
//// System.out.println("Insert the Query");
|
||||||
|
////
|
||||||
|
////
|
||||||
|
////
|
||||||
|
////
|
||||||
|
//// InputStreamReader is = new InputStreamReader(System.in);
|
||||||
|
//// BufferedReader br = new BufferedReader(is);
|
||||||
|
////
|
||||||
|
//// String q="";
|
||||||
|
//// try {
|
||||||
|
//// q = br.readLine();
|
||||||
|
//// } catch (IOException e1) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e1.printStackTrace();
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// System.out.println("Letta: "+q);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// org.gcube.dataanalysis.databases.utilsold.ConnectionManager df=new org.gcube.dataanalysis.databases.utilsold.ConnectionManager();
|
||||||
|
//
|
||||||
|
//// AlgorithmConfiguration config=df.setconfiguration
|
||||||
|
//// ("./cfg/", access.get(1).getAccessPoints().get(0).getUsername(), access.get(1).getAccessPoints().get(0).getPassword(),
|
||||||
|
//// access.get(1).getAccessPoints().get(0).getDriver(), access.get(1).getAccessPoints().get(0).getDialect(),
|
||||||
|
//// access.get(1).getAccessPoints().get(0).address());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //Codice funzionante
|
||||||
|
//// AlgorithmConfiguration config=df.setconfiguration("./cfg/", "utente", "d4science", "org.postgresql.Driver","org.hibernate.dialect.MySQLDialect",
|
||||||
|
//// "jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu:5432/testdb");
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// AlgorithmConfiguration config;
|
||||||
|
// try {
|
||||||
|
// config = df.setconfiguration("./cfg/", access.get(resourceIndex).getAccessPoints().get(dbIndex).getUsername(),
|
||||||
|
// access.get(resourceIndex).getAccessPoints().get(dbIndex).getPassword(), access.get(resourceIndex).getAccessPoints().get(dbIndex).getDriver(), access.get(resourceIndex).getAccessPoints().get(dbIndex).getDialect(),
|
||||||
|
// access.get(resourceIndex).getAccessPoints().get(dbIndex).address(), access.get(resourceIndex).getAccessPoints().get(dbIndex).getDatabaseName());
|
||||||
|
//
|
||||||
|
// SessionFactory sf=df.createConnection(config);
|
||||||
|
//
|
||||||
|
// boolean val=sf.isClosed();
|
||||||
|
//
|
||||||
|
// if (val!=true){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("la connessione è attiva");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// if (config!=null){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// SessionFactory sf=df.createConnection(config);
|
||||||
|
////
|
||||||
|
//// boolean val=sf.isClosed();
|
||||||
|
////
|
||||||
|
//// if (val!=true){
|
||||||
|
////
|
||||||
|
////
|
||||||
|
//// System.out.println("la connessione è attiva");
|
||||||
|
////
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// try {
|
||||||
|
////// List<Object> rawnames = df.executeQuery("select * from (select a.field1 as aa, b.field1_id as bb, b.field1 as cc from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a "+
|
||||||
|
////// "left join cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b on a.field3_id=b.field1_id) as cd", sf);
|
||||||
|
////
|
||||||
|
//// /*List<Object> rawnames = df.executeQuery("select * from (select a.field1, b.field1_id, b.field1 from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a "+
|
||||||
|
//// "left join cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b on a.field3_id=b.field1_id) as cd", sf);*/
|
||||||
|
////
|
||||||
|
////// List<Object> rawnames = df.executeQuery("select a.field1 as aa, b.field1_id as bb, b.field1 as cc from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a "+
|
||||||
|
////// "left join cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b on a.field3_id=b.field1_id)", sf);
|
||||||
|
////
|
||||||
|
////
|
||||||
|
////
|
||||||
|
////
|
||||||
|
////
|
||||||
|
//// //Query funzionante
|
||||||
|
////
|
||||||
|
////// List<Object> rawnames = df.executeQuery("select a.field1, b.field1_id from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a "+
|
||||||
|
////// "left join cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b on a.field3_id=b.field1_id", sf);
|
||||||
|
////
|
||||||
|
////
|
||||||
|
//// //Query non funzionante
|
||||||
|
////// List<Object> rawnames = df.executeQuery("select a.field1, b.field1_id, b.field1 from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a "+
|
||||||
|
////// "left join cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b on a.field3_id=b.field1_id", sf);
|
||||||
|
////
|
||||||
|
//// //Query funzionante con alias
|
||||||
|
////
|
||||||
|
////// List<Object> rawnames = df.executeQuery("select a.field1 as aa, b.field1_id as bb, b.field1 as cc from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a "+
|
||||||
|
////// "left join cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b on a.field3_id=b.field1_id", sf);
|
||||||
|
////
|
||||||
|
//// //Query funzionante
|
||||||
|
////// List<Object> rawnames = df.executeQuery("select a.source_data as sourceA, b.source_data as sourceB, a.target_data_scientific_name as targetA, b.target_data_scientific_name as tagertB " +
|
||||||
|
////// "from bionymoutsimplefaked1csvpreprcsv as a join bionymoutfaked1csvpreprcsv as b on a.source_data=b.source_data limit 10",sf);
|
||||||
|
////
|
||||||
|
//// List<Object> rawnames = df.executeQuery(q,sf);
|
||||||
|
////
|
||||||
|
////
|
||||||
|
//// System.out.println("***************************************************************");
|
||||||
|
//// System.out.println();
|
||||||
|
////
|
||||||
|
//// System.out.println("Size: "+rawnames.size());
|
||||||
|
// //
|
||||||
|
//// for (int i = 0; i < rawnames.size(); i++) {
|
||||||
|
// //
|
||||||
|
//// Object[] row = (Object[]) rawnames.get(i);
|
||||||
|
// //
|
||||||
|
//// for (int j = 0; j < row.length; j++) {
|
||||||
|
// //
|
||||||
|
//// System.out.print("\"" + row[j] + "\"; ");
|
||||||
|
// //
|
||||||
|
//// }
|
||||||
|
//// System.out.println();
|
||||||
|
//// //System.out.println("Fine ");
|
||||||
|
// //
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////
|
||||||
|
////
|
||||||
|
//// } catch (Exception e) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// //e.printStackTrace();
|
||||||
|
////
|
||||||
|
//// System.out.println("***************************************************************");
|
||||||
|
//// System.out.println();
|
||||||
|
////
|
||||||
|
//// String error=e.getCause().toString();
|
||||||
|
////
|
||||||
|
//// if (error.contains("MySQLSyntaxErrorException"))
|
||||||
|
//// {
|
||||||
|
////
|
||||||
|
//// System.out.println("ERROR "+e.getMessage()+" "+"because an error is present: "+e.getCause().getMessage());
|
||||||
|
//// System.out.println("Suggestion: insert an alias name for the columns");
|
||||||
|
////
|
||||||
|
////
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
////
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// }else {
|
||||||
|
//// System.out.println("ERRORE: Non è possibile eseguire la connessione perchè l'indirizzo non è completo: databasename non dsiponibile");
|
||||||
|
//// }8
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// } catch (IOException e1) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e1.printStackTrace();
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
|
||||||
|
/** Class that interacts with the IS in order to recover some information about the available databases and the contained data.
|
||||||
|
* Once recovered the interested data he can import these in the database used by the SM.
|
||||||
|
* */
|
||||||
|
|
||||||
|
public class TestDatabasesResourcesManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
|
||||||
|
// the user sets the scope
|
||||||
|
|
||||||
|
|
||||||
|
// the user views the available databases in the fixed scope
|
||||||
|
|
||||||
|
// the user selects a database
|
||||||
|
|
||||||
|
// the user wants to view some characteristics of the chosen database such as: the tables, rows' number and the create statement
|
||||||
|
|
||||||
|
// the user wants to recover data from a certain table so he submits a 'select' query on the database
|
||||||
|
|
||||||
|
// ?? the user create a table in the database's SM and import the recovered data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,114 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||||
|
import org.gcube.dataaccess.databases.utils.DatabaseManagement;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Class that tests the code for the recovery of the tables */
|
||||||
|
public class TestGetTables {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
|
||||||
|
System.out.println("Specifica il nome del file di configurazione");
|
||||||
|
|
||||||
|
String configurationfile=sc.next();
|
||||||
|
|
||||||
|
//TODO: decommentare per la corretta esecuzione della classe
|
||||||
|
// try {
|
||||||
|
// DatabaseManagement obj=new DatabaseManagement("./cfg/", configurationfile);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //Retrieve the schema for the postgres database
|
||||||
|
//
|
||||||
|
// List <String> schemas=new ArrayList<String>();
|
||||||
|
//
|
||||||
|
// schemas=obj.getSchemas();
|
||||||
|
//
|
||||||
|
// if (schemas!=null){
|
||||||
|
//
|
||||||
|
// //test Print
|
||||||
|
// for (int i=0;i<schemas.size();i++)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// System.out.println("Schema's name: "+ schemas.get(i));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("il database nn ha schemi");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// List <String> tables=new ArrayList<String>();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //Retrieve the table's names of the database
|
||||||
|
// tables=obj.getTables();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //test print
|
||||||
|
// for (int i=0;i<tables.size();i++)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// System.out.println(tables.get(i));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //Retrieve the "Create Table" statement
|
||||||
|
// System.out.println("Specifica il nome della tabella");
|
||||||
|
// String tablename=sc.next();
|
||||||
|
//
|
||||||
|
// String createtable=obj.getCreateTable(tablename);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //View number of rows
|
||||||
|
// try {
|
||||||
|
//
|
||||||
|
// BigInteger rows=obj.getNumberOfRows(tablename);
|
||||||
|
//
|
||||||
|
// System.out.println("il numero di righe è: " + rows);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO: handle exception
|
||||||
|
//
|
||||||
|
// System.out.println("The table does not exist.");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
//// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
//package org.gcube.dataanalysis.test;
|
||||||
|
//
|
||||||
|
//import java.util.Scanner;
|
||||||
|
//import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||||
|
//import org.gcube.dataanalysis.databases.lexer.MySQLLexicalAnalyzer;
|
||||||
|
//import org.gcube.dataanalysis.databases.lexer.PostgresLexicalAnalyzer;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
///** Class that tests the query's parsing by means of a lexical analyzer. It allows to filter a query no read-only compliant. */
|
||||||
|
//public class TestParsing {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
//
|
||||||
|
// String query="INSERT INTO ANTIQUES VALUES (21, 01, 'Ottoman', 200.00);";
|
||||||
|
//
|
||||||
|
// // String query =
|
||||||
|
// // "SELECT COUNT(*) FROM EMPLOYEESTATISTICSTABLE WHERE POSITION = 'Staff';";
|
||||||
|
// // String
|
||||||
|
// // query="SELECT COUNT(*) FROM EMPLOYEESTATISTICSTABLE WHERE POSITION = 'Staff';";
|
||||||
|
//
|
||||||
|
// // String query =
|
||||||
|
// // "SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE WHERE SALARY<40000 OR BENEFITS<10000;";
|
||||||
|
//
|
||||||
|
// // String
|
||||||
|
// // query="SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE WHERE POSITION='Manager' AND SALARY>60000 OR BENEFITS>12000;";
|
||||||
|
//
|
||||||
|
// // String
|
||||||
|
// // query="SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE WHERE SALARY>=50000;";
|
||||||
|
//
|
||||||
|
// // String
|
||||||
|
// // query="SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE WHERE SALARY<=50000;";
|
||||||
|
//
|
||||||
|
// // String
|
||||||
|
// // query="SELECT SUM(SALARY), AVG(SALARY) FROM EMPLOYEESTATISTICSTABLE;";
|
||||||
|
//
|
||||||
|
// // String
|
||||||
|
// // query="SELECT FirstName, LastName, Address, City, State FROM EmployeeAddressTable;";
|
||||||
|
//
|
||||||
|
// // String
|
||||||
|
// // query="SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE WHERE SALARY<>50000;";
|
||||||
|
//
|
||||||
|
// // String query="INSERT INTO ANTIQUES from select * from hcaf_d;";
|
||||||
|
//
|
||||||
|
// // String query = "COPY lori FROM lavoro";
|
||||||
|
//
|
||||||
|
//// String query = "COPY lori FROM \"lavoro\";";
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // String query="SELECT TITLE, DIRECTOR "
|
||||||
|
// // +"FROM MOVIE "
|
||||||
|
// // +"WHERE MOVIE_ID IN"
|
||||||
|
// // +"("
|
||||||
|
// // +"("
|
||||||
|
// // +"SELECT MOVIE_ID "
|
||||||
|
// // +"FROM ACTOR "
|
||||||
|
// // +"WHERE NAME=?Tom Cruise? "
|
||||||
|
// // +"UNION "
|
||||||
|
// // +"SELECT "
|
||||||
|
// // +"MOVIE_ID "
|
||||||
|
// // +"FROM ACTOR "
|
||||||
|
// // +"WHERE NAME=?Kelly McGillis? "
|
||||||
|
// // +")"
|
||||||
|
// // +"INTERSECT "
|
||||||
|
// // +"SELECT MOVIE_ID "
|
||||||
|
// // +"FROM KEYWORD "
|
||||||
|
// // +"WHERE KEYWORD=?drama? "
|
||||||
|
// // +");";
|
||||||
|
//
|
||||||
|
// // String query="select * from `drop` where `drop`.id>10;";
|
||||||
|
//
|
||||||
|
// // System.out.println("Inserisci la query");
|
||||||
|
// // Scanner scanIn = new Scanner(System.in);
|
||||||
|
// //
|
||||||
|
// // String query=scanIn.nextLine();
|
||||||
|
// //
|
||||||
|
// // scanIn.close();
|
||||||
|
//
|
||||||
|
// // StringTokenizer string=new StringTokenizer(query, " ()[]{}<;>=,",
|
||||||
|
// // false);
|
||||||
|
// //
|
||||||
|
// // ArrayList<String> tokenslist=new ArrayList<String>();
|
||||||
|
// //
|
||||||
|
// // //StringTokenizer
|
||||||
|
// // AnalysisLogger.getLogger().debug("------------ Tokenizer ----------- ");
|
||||||
|
// //
|
||||||
|
// //
|
||||||
|
// // int count = string.countTokens();
|
||||||
|
// //
|
||||||
|
// // for (int i=0; i< count; i++){
|
||||||
|
// //
|
||||||
|
// // String token=string.nextToken();
|
||||||
|
// //
|
||||||
|
// //
|
||||||
|
// // tokenslist.add(token);
|
||||||
|
// //
|
||||||
|
// // AnalysisLogger.getLogger().debug("TestParsing->: "+ token);
|
||||||
|
// //
|
||||||
|
// // }
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug("TestParsing->: Query " + query);
|
||||||
|
// // System.out.println();
|
||||||
|
//
|
||||||
|
// boolean AllowedQuery = false;
|
||||||
|
//
|
||||||
|
// // LexicalAnalyzer lexer=new LexicalAnalyzer();
|
||||||
|
// // AllowedQuery=lexer.analyze(query);
|
||||||
|
//
|
||||||
|
// System.out.println("Specifica il tipo di piattaforma");
|
||||||
|
//
|
||||||
|
// Scanner scanIn = new Scanner(System.in);
|
||||||
|
// String platform = scanIn.nextLine();
|
||||||
|
// scanIn.close();
|
||||||
|
//
|
||||||
|
// if (platform.toLowerCase().contains("postgres")) {
|
||||||
|
//
|
||||||
|
// PostgresLexicalAnalyzer obj = new PostgresLexicalAnalyzer();
|
||||||
|
//
|
||||||
|
// AllowedQuery = obj.analyze(query);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (platform.toLowerCase().contains("mysql")) {
|
||||||
|
//
|
||||||
|
// MySQLLexicalAnalyzer obj = new MySQLLexicalAnalyzer();
|
||||||
|
//
|
||||||
|
// AllowedQuery = obj.analyze(query);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (AllowedQuery == true) {
|
||||||
|
//
|
||||||
|
// AnalysisLogger.getLogger().debug("TestParsing->: filtered Query");
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// AnalysisLogger.getLogger().debug(
|
||||||
|
// "TestParsing->: not filtered query");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,284 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
||||||
|
import org.gcube.dataanalysis.ecoengine.utils.DatabaseUtils;
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class TestPostgres {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
public static List<Object> executeHQLQuery(String query, SessionFactory DBSessionFactory, boolean useSQL) throws Exception{
|
||||||
|
|
||||||
|
List<Object> obj = null;
|
||||||
|
Session ss = null;
|
||||||
|
try {
|
||||||
|
ss = DBSessionFactory.getCurrentSession();
|
||||||
|
|
||||||
|
ss.beginTransaction();
|
||||||
|
|
||||||
|
Query qr = null;
|
||||||
|
|
||||||
|
if (useSQL)
|
||||||
|
qr = ss.createSQLQuery(query);
|
||||||
|
else
|
||||||
|
qr = ss.createQuery(query);
|
||||||
|
|
||||||
|
List<Object> result = qr.list();
|
||||||
|
|
||||||
|
ss.getTransaction().commit();
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (result == null)
|
||||||
|
System.out.println("Hibernate doesn't return a valid object when org.gcube.contentmanagement.lexicalmatcher retrieve UserState Object");
|
||||||
|
|
||||||
|
if (result != null && result.size() == 0)
|
||||||
|
System.out.println(String.format("found nothing in database"));
|
||||||
|
*/
|
||||||
|
if (result != null && result.size() != 0) {
|
||||||
|
obj = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
// System.out.println(String.format("Error while executing query: %1$s %2$s", query, e.getMessage()));
|
||||||
|
// e.printStackTrace();
|
||||||
|
System.out.println(String.format("Error while executing query: %1$s %2$s", query, e.getMessage()));
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
/*AlgorithmConfiguration config = new AlgorithmConfiguration();
|
||||||
|
config.setConfigPath("./cfg/");
|
||||||
|
config.setParam("DatabaseUserName", "utente");
|
||||||
|
config.setParam("DatabasePassword", "d4science");
|
||||||
|
config.setParam("DatabaseDriver","org.postgresql.Driver");
|
||||||
|
//config.setParam("DatabaseDialect", "org.hibernate.dialect.PostgresPlusDialect");
|
||||||
|
config.setParam(
|
||||||
|
"DatabaseURL",
|
||||||
|
"jdbc:postgresql://statistical-manager.d.d4science.research-infrastructures.eu/testdb");
|
||||||
|
|
||||||
|
SessionFactory dbconnection = DatabaseUtils.initDBSession(config);
|
||||||
|
List<Object> rawnames = DatabaseFactory
|
||||||
|
.executeSQLQuery(
|
||||||
|
"select a.source_data as sourceA, b.source_data as sourceB, a.target_data_scientific_name as targetA, b.target_data_scientific_name as tagertB " +
|
||||||
|
"from bionymoutsimplefaked1csvpreprcsv as a join bionymoutfaked1csvpreprcsv as b on a.source_data=b.source_data limit 10",
|
||||||
|
dbconnection);
|
||||||
|
|
||||||
|
|
||||||
|
List<Object> rawnames = DatabaseFactory
|
||||||
|
.executeSQLQuery(
|
||||||
|
"select a.source_data as sourceA, a.target_data_scientific_name as targetA, b.source_data sourceB " +
|
||||||
|
"from bion_id_a1f27126_df23_4980_8e2b_4afc8aaa404f as a " +
|
||||||
|
"left join bion_id_ab251ee0_7cc6_49b2_8956_330f4716650f as b " +
|
||||||
|
"on a.source_data=b.source_data",
|
||||||
|
dbconnection);
|
||||||
|
|
||||||
|
|
||||||
|
//List<Object> rawnames = DatabaseFactory.executeHQLQuery(query, DBSessionFactory, useSQL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("***************************************************************");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
for (int i = 0; i < rawnames.size(); i++) {
|
||||||
|
|
||||||
|
Object[] row = (ObEntityManagerject[]) rawnames.get(i);
|
||||||
|
|
||||||
|
for (int j = 0; j < row.length; j++) {
|
||||||
|
|
||||||
|
System.out.print("\"" + row[j] + "\"; ");
|
||||||
|
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
//System.out.println("Fine ");
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
AlgorithmConfiguration config = new AlgorithmConfiguration();
|
||||||
|
config.setConfigPath("./cfg/");
|
||||||
|
config.setParam("DatabaseUserName", "root");
|
||||||
|
config.setParam("DatabasePassword", "test");
|
||||||
|
config.setParam("DatabaseDriver","com.mysql.jdbc.Driver");
|
||||||
|
config.setParam("DatabaseDialect", "org.hibernate.dialect.MySQLDialect");
|
||||||
|
config.setParam(
|
||||||
|
"DatabaseURL",
|
||||||
|
"jdbc:mysql://146.48.87.169/timeseries");
|
||||||
|
|
||||||
|
SessionFactory dbconnection = DatabaseUtils.initDBSession(config);
|
||||||
|
|
||||||
|
|
||||||
|
/*List<Object> rawnames = DatabaseFactory
|
||||||
|
.executeSQLQuery(
|
||||||
|
"select a.source_data as sourceA, b.source_data as sourceB, a.target_data_scientific_name as targetA, b.target_data_scientific_name as tagertB " +
|
||||||
|
"from bionymoutsimplefaked1csvpreprcsv as a join bionymoutfaked1csvpreprcsv as b on a.source_data=b.source_data limit 10",
|
||||||
|
dbconnection);*/
|
||||||
|
|
||||||
|
//try{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// dbconnection.getCurrentSession().;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ss.getCause()
|
||||||
|
|
||||||
|
// }
|
||||||
|
/*catch(JDBCExceptionReporter e)
|
||||||
|
{
|
||||||
|
Throwable t = e.getCause();
|
||||||
|
SQLException ex = (SQLException) t.getCause();
|
||||||
|
while(ex != null){
|
||||||
|
while(t != null) {
|
||||||
|
t = t.getCause();
|
||||||
|
}
|
||||||
|
// Logger logger=new Logger();
|
||||||
|
// logger.warn("SQLException="+ex.getLocalizedMessage());
|
||||||
|
|
||||||
|
System.out.println("sono qui");
|
||||||
|
|
||||||
|
ex = ex.getNextException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
System.out.println("***************************************************************");
|
||||||
|
System.out.println();
|
||||||
|
|
||||||
|
//List<Object> rawnames =((javax.persistence.Query) query).getResultList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
/*List<Object> rawnames = executeHQLQuery(
|
||||||
|
"select * from (select a.field1, b.field1_id as bb, b.field1 from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a "+
|
||||||
|
"left join cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b on a.field3_id=b.field1_id) as cd",*/
|
||||||
|
// "select * "+
|
||||||
|
// "from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a, cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b limit 10",
|
||||||
|
// dbconnection, true);
|
||||||
|
|
||||||
|
|
||||||
|
List<Object> rawnames = executeHQLQuery(
|
||||||
|
"select a.field1, b.field1_id from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a "+
|
||||||
|
"left join cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b on a.field3_id=b.field1_id",dbconnection, true);
|
||||||
|
// "select * "+
|
||||||
|
// "from a7f768710_c7b0_11df_b2bc_e0f36cf4c8cd as a, cur_00d4e2d0_ecbd_11df_87fa_de008e0850ff as b limit 10",
|
||||||
|
// dbconnection, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("Size: "+rawnames.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < rawnames.size(); i++) {
|
||||||
|
|
||||||
|
Object[] row = (Object[]) rawnames.get(i);
|
||||||
|
|
||||||
|
for (int j = 0; j < row.length; j++) {
|
||||||
|
|
||||||
|
System.out.print("\"" + row[j] + "\"; ");
|
||||||
|
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
//System.out.println("Fine ");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("message: "+e.getMessage());
|
||||||
|
//System.out.println(e.getLocalizedMessage());
|
||||||
|
|
||||||
|
StackTraceElement [] elem=e.getStackTrace();
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("localized: "+e.getCause().toString());
|
||||||
|
String error=e.getCause().toString();
|
||||||
|
if (error.contains("MySQLSyntaxErrorException"))
|
||||||
|
{
|
||||||
|
|
||||||
|
System.out.println("ERROR "+e.getMessage()+" "+"because an error is present: "+e.getCause().getMessage());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// System.out.println("cause: "+e.getCause().getMessage());
|
||||||
|
|
||||||
|
// for (int i=0;i<elem.length;i++){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// System.out.println("elem: "+ elem[i]);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//System.out.println("JDBC Error: "+JDBCExceptionReporter.DEFAULT_EXCEPTION_MSG);
|
||||||
|
//System.out.println("JDBC Error: "+JDBCExceptionReporter.DEFAULT_WARNING_MSG);
|
||||||
|
//System.out.println("JDBC Error: "+JDBCExceptionReporter.log.getName());
|
||||||
|
//System.out.println("JDBC Error: "+JDBCExceptionReporter.log.ROOT_LOGGER_NAME);
|
||||||
|
//org.slf4j.Logger logger = LoggerFactory.getLogger("log4j.logger.org.hibernate");
|
||||||
|
|
||||||
|
|
||||||
|
// Session s=dbconnection.openSession();
|
||||||
|
// s.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// System.out.println(dbconnection.getCache().getClass());
|
||||||
|
|
||||||
|
//SQLException ex= new SQLException(JDBCExceptionReporter.log.getName());
|
||||||
|
|
||||||
|
//SQLException ex= new SQLException
|
||||||
|
|
||||||
|
//System.out.println("message: "+ex.getLocalizedMessage());
|
||||||
|
|
||||||
|
// System.out.println(ex.getCause();
|
||||||
|
|
||||||
|
// JDBCExceptionReporter.;
|
||||||
|
|
||||||
|
//System.out.println("Eccezione:" +e.getMessage());
|
||||||
|
//e.printStackTrace();
|
||||||
|
//e.getLocalizedMessage();
|
||||||
|
|
||||||
|
|
||||||
|
/*Connection a=dbconnection.getCurrentSession().disconnect();
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
System.out.println(a.getWarnings().getSQLState());
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
|
||||||
|
System.out.println("message: "+e1.getCause().getStackTrace().length);
|
||||||
|
//e1.printStackTrace();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.dataaccess.databases.accessold.AddressesDiscoverer;
|
||||||
|
|
||||||
|
|
||||||
|
public class TestRetrieveEndpoint {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AddressesDiscoverer obj=new AddressesDiscoverer();
|
||||||
|
List <String> addresses=new ArrayList<String>();
|
||||||
|
|
||||||
|
obj.setScope("/gcube/devsec");
|
||||||
|
|
||||||
|
addresses=obj.retrieveAddress("Database");
|
||||||
|
|
||||||
|
//Stampa
|
||||||
|
for (int i=0; i<addresses.size();i++){
|
||||||
|
|
||||||
|
System.out.println(addresses.get(i));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
//package org.gcube.dataanalysis.test;
|
||||||
|
//
|
||||||
|
//import java.io.IOException;
|
||||||
|
//
|
||||||
|
//import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||||
|
//import org.gcube.dataanalysis.databases.utils.DatabaseManagement;
|
||||||
|
//
|
||||||
|
//public class TestSampleOnTable {
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
//
|
||||||
|
// // connection to database
|
||||||
|
// DatabaseManagement mgt = new DatabaseManagement("");
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //Postgres Database
|
||||||
|
// try {
|
||||||
|
// mgt.createConnection(
|
||||||
|
// "postgres",
|
||||||
|
// "d4science2",
|
||||||
|
// "org.postgresql.Driver",
|
||||||
|
// "org.hibernate.dialect.PostgreSQLDialect",
|
||||||
|
// "jdbc:postgresql://geoserver-dev.d4science-ii.research-infrastructures.eu:5432/aquamapsdb",
|
||||||
|
// "aquamapsdb");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SampleOnTable operation
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // for database postgres, if a table is not in lower case format, it
|
||||||
|
// // is necessary to include the table name in quotes ""
|
||||||
|
// mgt.sampleOnTable("Divisions", "public");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// AnalysisLogger
|
||||||
|
// .getLogger()
|
||||||
|
// .debug("In TestSampleOnTable->EXCEPTION: "+ e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SmartSampleOnTable operation
|
||||||
|
//
|
||||||
|
// // mgt.smartSampleOnTable(tableName);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //MYSQL Database
|
||||||
|
//
|
||||||
|
//// try {
|
||||||
|
//// mgt.createConnection(
|
||||||
|
//// "root",
|
||||||
|
//// "test",
|
||||||
|
//// "com.mysql.jdbc.Driver",
|
||||||
|
//// "org.hibernate.dialect.MySQLDialect",
|
||||||
|
////// "jdbc:mysql://146.48.87.169:3306/col2oct2010",
|
||||||
|
//// "jdbc:mysql://146.48.87.169:3306/aquamaps",
|
||||||
|
//// "hcaf_d");
|
||||||
|
//// } catch (IOException e) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e.printStackTrace();
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// // SampleOnTable operation
|
||||||
|
////
|
||||||
|
//// try {
|
||||||
|
//// // for database postgres, if a table is not in lower case format, it
|
||||||
|
//// // is necessary to include the table name in quotes ""
|
||||||
|
//// mgt.sampleOnTable("hcaf_d", "aquamaps");
|
||||||
|
//// } catch (Exception e) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e.printStackTrace();
|
||||||
|
////
|
||||||
|
//// AnalysisLogger
|
||||||
|
//// .getLogger()
|
||||||
|
//// .debug("In TestSampleOnTable->EXCEPTION: "+ e);
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package org.gcube.dataaccess.test;
|
||||||
|
//package org.gcube.dataanalysis.test;
|
||||||
|
//
|
||||||
|
//import java.io.IOException;
|
||||||
|
//
|
||||||
|
//import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
||||||
|
//import org.gcube.dataanalysis.databases.utils.DatabaseManagement;
|
||||||
|
//
|
||||||
|
//public class TestSmartSampleOnTable {
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
//
|
||||||
|
// // connection to database
|
||||||
|
// DatabaseManagement mgt = new DatabaseManagement("");
|
||||||
|
//
|
||||||
|
//// // Postgres Database
|
||||||
|
//// try {
|
||||||
|
//// mgt.createConnection(
|
||||||
|
//// "postgres",
|
||||||
|
//// "d4science2",
|
||||||
|
//// "org.postgresql.Driver",
|
||||||
|
//// "org.hibernate.dialect.PostgreSQLDialect",
|
||||||
|
//// "jdbc:postgresql://geoserver-dev.d4science-ii.research-infrastructures.eu:5432/aquamapsdb",
|
||||||
|
//// "aquamapsdb");
|
||||||
|
//// } catch (IOException e) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e.printStackTrace();
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// // SampleOnTable operation
|
||||||
|
////
|
||||||
|
//// try {
|
||||||
|
//// // for database postgres, if a table is not in lower case format, it
|
||||||
|
//// // is necessary to include the table name in quotes ""
|
||||||
|
//// mgt.smartSampleOnTable("Divisions", "public");
|
||||||
|
//// } catch (Exception e) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e.printStackTrace();
|
||||||
|
////
|
||||||
|
//// AnalysisLogger.getLogger().debug(
|
||||||
|
//// "In TestSmartSampleOnTable->EXCEPTION: " + e);
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //Mysql database
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// mgt.createConnection(
|
||||||
|
// "root",
|
||||||
|
// "test",
|
||||||
|
// "com.mysql.jdbc.Driver",
|
||||||
|
// "org.hibernate.dialect.MySQLDialect",
|
||||||
|
//// "jdbc:mysql://146.48.87.169:3306/col2oct2010",
|
||||||
|
// "jdbc:mysql://146.48.87.169:3306/aquamaps",
|
||||||
|
// "hcaf_d");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // SampleOnTable operation
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // for database postgres, if a table is not in lower case format, it
|
||||||
|
// // is necessary to include the table name in quotes ""
|
||||||
|
// mgt.smartSampleOnTable("hcaf_d", "aquamaps");
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// AnalysisLogger
|
||||||
|
// .getLogger()
|
||||||
|
// .debug("In TestSampleOnTable->EXCEPTION: "+ e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //Mysql database
|
||||||
|
//
|
||||||
|
//// try {
|
||||||
|
//// mgt.createConnection(
|
||||||
|
//// "root",
|
||||||
|
//// "test",
|
||||||
|
//// "com.mysql.jdbc.Driver",
|
||||||
|
//// "org.hibernate.dialect.MySQLDialect",
|
||||||
|
////// "jdbc:mysql://146.48.87.169:3306/col2oct2010",
|
||||||
|
//// "jdbc:mysql://146.48.87.169:3306/col2oct2010",
|
||||||
|
//// "common_names");
|
||||||
|
//// } catch (IOException e) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e.printStackTrace();
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// // SampleOnTable operation
|
||||||
|
////
|
||||||
|
//// try {
|
||||||
|
//// // for database postgres, if a table is not in lower case format, it
|
||||||
|
//// // is necessary to include the table name in quotes ""
|
||||||
|
//// mgt.smartSampleOnTable("common_names", "col2oct2010");
|
||||||
|
//// } catch (Exception e) {
|
||||||
|
//// // TODO Auto-generated catch block
|
||||||
|
//// e.printStackTrace();
|
||||||
|
////
|
||||||
|
//// AnalysisLogger
|
||||||
|
//// .getLogger()
|
||||||
|
//// .debug("In TestSampleOnTable->EXCEPTION: "+ e);
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
Loading…
Reference in New Issue