some not useful code commented removed in servlet

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@99790 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-09-12 14:47:32 +00:00
parent 5386131130
commit 9528ed747c
2 changed files with 65 additions and 620 deletions

View File

@ -84,46 +84,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
public GWTdbManagerServiceImpl() throws Exception { public GWTdbManagerServiceImpl() throws Exception {
// create the cache
// CacheManager cacheManager;
// ClassLoader contextClassLoader =
// Thread.currentThread().getContextClassLoader();
// InputStream resourceAsStream =
// contextClassLoader.getResourceAsStream("ehcache.xml");
// cacheManager = CacheManager.create(resourceAsStream);
// TODO: DA MODIFICARE LA MODALITÀ DI RECUPERO DEL FILE
// try {
//
// // CacheManager cacheManager = CacheManager
// //
// .newInstance("/home/loredana/workspace/databases-manager-portlet-TRUNK/configCache/encache.xml");
//
// // InputStream is =
// // ClassLoader.getSystemResourceAsStream("encache.xml");
// // CacheManager cacheManager = CacheManager.newInstance(is);
// // is.close();
//
// URL url = getClass().getResource("/encache.xml");
// CacheManager cacheManager = CacheManager.newInstance(url);
// // getcache
// employeeCache = cacheManager.getEhcache("DBCache");
//
// //set Disk Store Path in the configuration file encache.xml
// // CacheConfiguration config = employeeCache.getCacheConfiguration();
// // String DiskCacheFolderName="DBManagerDisk";
// ////
// config.setDiskStorePath(this.getServletContext().getRealPath("")+DiskCacheFolderName);
// //
// //
// config.setDiskStorePath(this.getServletContext().getRealPath("")+DiskCacheFolderName);
//
// } catch (Exception e) {
// // TODO: handle exception
// e.printStackTrace();
// throw new Exception("Failed to get cache. " + e);
// }
} }
@Override @Override
@ -131,65 +91,29 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
super.init(); super.init();
// //build the list of available algorithms
// listAlgorithms.add("LISTDBNAMES");
// listAlgorithms.add("LISTDBINFO");
// listAlgorithms.add("LISTDBSCHEMA");
// listAlgorithms.add("LISTTABLES");
// listAlgorithms.add("GETTABLEDETAILS");
// listAlgorithms.add("SUBMITQUERY");
// listAlgorithms.add("SAMPLEONTABLE");
// listAlgorithms.add("SMARTSAMPLEONTABLE");
// listAlgorithms.add("RANDOMSAMPLEONTABLE");
//craete cache //craete cache
try { try {
// CacheManager cacheManager = CacheManager
// .newInstance("/home/loredana/workspace/databases-manager-portlet-TRUNK/configCache/encache.xml");
// InputStream is =
// ClassLoader.getSystemResourceAsStream("encache.xml");
// CacheManager cacheManager = CacheManager.newInstance(is);
// is.close();
URL url = getClass().getResource("/encache.xml"); URL url = getClass().getResource("/encache.xml");
CacheManager cacheManager = CacheManager.newInstance(url); CacheManager cacheManager = CacheManager.newInstance(url);
// getcache // getcache
employeeCache = cacheManager.getEhcache("DBCache"); employeeCache = cacheManager.getEhcache("DBCache");
// set Disk Store Path in the configuration file encache.xml
// CacheConfiguration config =
// employeeCache.getCacheConfiguration();
// String DiskCacheFolderName="DBManagerDisk";
// //
// config.setDiskStorePath(this.getServletContext().getRealPath("")+DiskCacheFolderName);
//
// config.setDiskStorePath(this.getServletContext().getRealPath("")+DiskCacheFolderName);
String path = System.getenv("CATALINA_TMPDIR"); String path = System.getenv("CATALINA_TMPDIR");
System.out.println("Path: " + // System.out.println("Path: " +
this.getServletContext().getRealPath("")); // this.getServletContext().getRealPath(""));
// System.out.println("Path: " + path);
// create folder for caching data
// String DiskCacheFolderName="DBManagerDisk";
// File f = new
// File(this.getServletContext().getRealPath("")+DiskCacheFolderName);
CacheConfiguration config = employeeCache.getCacheConfiguration(); CacheConfiguration config = employeeCache.getCacheConfiguration();
String DiskCacheFolderName = "DBManagerDisk"; String DiskCacheFolderName = "DBManagerDisk";
// config.setDiskStorePath(this.getServletContext().getRealPath("")+DiskCacheFolderName);
// File f = new File(path+"/"+DiskCacheFolderName); // File f = new File(path+"/"+DiskCacheFolderName);
// if (!f.exists()){ // if (!f.exists()){
// f.mkdir(); // f.mkdir();
// //
// } // }
// config.setDiskStorePath(path+"/"+DiskCacheFolderName);
config.setDiskStorePath(path); config.setDiskStorePath(path);
// config.setDiskPersistent(true); // config.setDiskPersistent(true);
// config.setOverflowToDisk(true); // config.setOverflowToDisk(true);
@ -260,47 +184,17 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data output // data output
List<FileModel> outputParameters = new ArrayList<FileModel>(); List<FileModel> outputParameters = new ArrayList<FileModel>();
// if (listAlgorithms==null){
// // get list of algorithms
//// List<String> algorithms = new ArrayList<String>();
//// algorithms = getDatabaseManagerAlgorithms();
//
// listAlgorithms = getDatabaseManagerAlgorithms();
//
// }
// get algorithmId // get algorithmId
String algorithmId = "LISTDBNAMES"; String algorithmId = "LISTDBNAMES";
// for (int i = 0; i < listAlgorithms.size(); i++) {
// if (listAlgorithms.get(i).equals("LISTDBNAMES")) {
// algorithmId = listAlgorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
// get input parameters of the algorithm specified by id
// inputParameters = getParameters(algorithmId);
Parameter maxNumber = new Parameter("MaxNumber", "", "String", "-1"); Parameter maxNumber = new Parameter("MaxNumber", "", "String", "-1");
inputParameters.add(maxNumber); inputParameters.add(maxNumber);
// if (inputParameters.size() != 0) {
// print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
// // print check input parameters
// for (int i = 0; i < inputParameters.size(); i++) {
// logger.info(inputParameters.get(i).getName());
// }
// check if the value is in cache. If data does not exist in cache // check if the value is in cache. If data does not exist in cache
// the computation is started otherwise data are retrieved from // the computation is started otherwise data are retrieved from
// cache. // cache.
try { try {
// get data from cache // get data from cache
@ -378,40 +272,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data output // data output
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>(); LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
// get list of algorithms
// List<String> algorithms = new ArrayList<String>();
// algorithms = getDatabaseManagerAlgorithms();
// if (listAlgorithms==null){
// listAlgorithms = getDatabaseManagerAlgorithms();
// }
//
// // get algorithmId
// String algorithmId = null;
//
// for (int i = 0; i < listAlgorithms.size(); i++) {
// if (listAlgorithms.get(i).equals("LISTDBINFO")) {
// algorithmId = listAlgorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
// get input parameters of the algorithm specified by id
// inputParameters = getParameters(algorithmId);
// if (inputParameters.size() != 0) {
// print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
String algorithmId = "LISTDBINFO"; String algorithmId = "LISTDBINFO";
//print check //print check
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: "
+ resourceName); + resourceName);
// if (!resourceName.equals("")){
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
inputParameters.add(resource); inputParameters.add(resource);
inputParameters.get(0).setValue(resourceName); inputParameters.get(0).setValue(resourceName);
@ -482,9 +348,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// employeeCache.put(dataToCache); // employeeCache.put(dataToCache);
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -493,17 +356,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
throw new Exception("Failed to load data. " + e); throw new Exception("Failed to load data. " + e);
} }
// }
// inputParameters.get(0).setValue(resourceName);
// print check
// logger.info(inputParameters.get(0).getName());
// }
return outputParameters; return outputParameters;
} }
@ -517,28 +369,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data output // data output
List<FileModel> outputParameters = new ArrayList<FileModel>(); List<FileModel> outputParameters = new ArrayList<FileModel>();
// get list of algorithms
// List<String> algorithms = new ArrayList<String>();
// algorithms = getDatabaseManagerAlgorithms();
// if (listAlgorithms==null){
// listAlgorithms = getDatabaseManagerAlgorithms();
// }
//
// // get algorithmId
// String algorithmId = null;
//
// for (int i = 0; i < listAlgorithms.size(); i++) {
// if (listAlgorithms.get(i).equals("LISTDBSCHEMA")) {
// algorithmId = listAlgorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
// get input parameters of the algorithm specified by id
// inputParameters = getParameters(algorithmId);
String algorithmId = "LISTDBSCHEMA"; String algorithmId = "LISTDBSCHEMA";
// print check // print check
String rs = dataInput.get("ResourceName"); String rs = dataInput.get("ResourceName");
@ -549,14 +379,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> DatabaseName: " logger.info("dbmanager-> DatabaseName: "
+ db); + db);
// if (inputParameters.size() != 0) {
// print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
// if ((!rs.equals(""))&&(!db.equals(""))){
//set input parameters //set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -589,7 +411,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
outputParameters = (List<FileModel>) value; outputParameters = (List<FileModel>) value;
} else { } else {
// if (algorithmId!=null){
// start the computation // start the computation
// create data structure // create data structure
ComputationOutput outputData = new ComputationOutput(); ComputationOutput outputData = new ComputationOutput();
@ -630,9 +451,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// employeeCache.put(dataToCache); // employeeCache.put(dataToCache);
} }
// }
} }
} catch (Exception e) { } catch (Exception e) {
@ -642,11 +460,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
} }
// }
// }
return outputParameters; return outputParameters;
} }
@ -658,37 +471,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data output // data output
List<Result> outputParameters = new ArrayList<Result>(); List<Result> outputParameters = new ArrayList<Result>();
// get list of algorithms
// List<String> algorithms = new ArrayList<String>();
// algorithms = getDatabaseManagerAlgorithms();
// if (listAlgorithms==null){
// listAlgorithms = getDatabaseManagerAlgorithms();
// }
//
// // get algorithmId
// String algorithmId = null;
//
// for (int i = 0; i < listAlgorithms.size(); i++) {
// if (listAlgorithms.get(i).equals("LISTTABLES")) {
// algorithmId = listAlgorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
// get input parameters of the algorithm
// inputParameters = getParameters(algorithmId);
// if (inputParameters.size() != 0) {
// // print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
// }
// print check algorithm input parameters
// for (int i = 0; i < inputParameters.size(); i++) {
// logger.info(inputParameters.get(i).getName());
// }
String algorithmId = "LISTTABLES"; String algorithmId = "LISTTABLES";
@ -704,8 +486,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> SchemaName: " logger.info("dbmanager-> SchemaName: "
+ scm); + scm);
// if ((!rs.equals(""))&&(!db.equals(""))){
//set input parameters //set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -742,44 +522,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
outputParameters.add(row); outputParameters.add(row);
} }
// }
// inputParameters.get(0).setValue(dataInput.get("ResourceName"));
// inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
// inputParameters.get(2).setValue(dataInput.get("SchemaName"));
// // print check
// logger.info("dbmanager-> ResourceName: "
// + dataInput.get("ResourceName"));
// logger.info("dbmanager-> DatabaseName: "
// + dataInput.get("DatabaseName"));
// logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
// // create data structure
// ComputationOutput outputData = new ComputationOutput();
// // computation id
// String computationId = startComputation(algorithmId, inputParameters,
// outputData);
//
// // print check on retrieving data
// // logger.info("output data retrieved");
//
// // data output values
// LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
// // data output keys
// LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
//
// mapValues = outputData.getMapValues();
// mapKeys = outputData.getmapKeys();
//
// for (int i = 0; i < mapValues.size(); i++) {
// Result row = new Result(String.valueOf(i), mapValues.get(String
// .valueOf(i)));
// outputParameters.add(row);
// }
return outputParameters; return outputParameters;
} }
@ -901,38 +643,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// list that contains table attributes // list that contains table attributes
List<String> listAttributes = null; List<String> listAttributes = null;
// get list of algorithms
// List<String> algorithms = new ArrayList<String>();
// algorithms = getDatabaseManagerAlgorithms();
// if (listAlgorithms==null){
// listAlgorithms = getDatabaseManagerAlgorithms();
// }
//
// // get algorithmId
// String algorithmId = null;
//
// for (int i = 0; i < listAlgorithms.size(); i++) {
// if (listAlgorithms.get(i).equals("SUBMITQUERY")) {
// algorithmId = listAlgorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
// // get input parameters of the algorithm
// inputParameters = getParameters(algorithmId);
//
// if (inputParameters.size() != 0) {
// // print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
// }
// print check
// for (int i = 0; i < inputParameters.size(); i++) {
// logger.info(inputParameters.get(i).getName());
// }
String algorithmId = "SUBMITQUERY"; String algorithmId = "SUBMITQUERY";
@ -947,15 +657,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> DatabaseName: " logger.info("dbmanager-> DatabaseName: "
+ db); + db);
// logger.info("dbmanager-> ResourceName: " + dataDB.get("ResourceName"));
// logger.info("dbmanager-> DatabaseName: " + dataDB.get("DatabaseName"));
logger.info("dbmanager-> Query: " + query); logger.info("dbmanager-> Query: " + query);
logger.info("dbmanager-> SmartCorrections check: " logger.info("dbmanager-> SmartCorrections check: "
+ smartCorrectionQuery); + smartCorrectionQuery);
// if ((!rs.equals(""))&&(!db.equals(""))){
//set input parameters //set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
Parameter readOnlyQuery = new Parameter("Read-Only Query", "", "Boolean", "true"); Parameter readOnlyQuery = new Parameter("Read-Only Query", "", "Boolean", "true");
@ -1039,17 +745,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
throw e; throw e;
} }
// }
// inputParameters.get(0).setValue(dataDB.get("ResourceName"));
// inputParameters.get(1).setValue(dataDB.get("DatabaseName"));
// inputParameters.get(2).setValue(String.valueOf(valueReadOnlyQuery));
// inputParameters.get(3).setValue(String.valueOf(smartCorrectionQuery));
// inputParameters.get(4).setValue(language);
// inputParameters.get(5).setValue(query);
return listAttributes; return listAttributes;
} }
@ -1061,33 +756,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// output sample result // output sample result
List<Result> output = new ArrayList<Result>(); List<Result> output = new ArrayList<Result>();
// // get list of algorithms
// List<String> algorithms = new ArrayList<String>();
// algorithms = getDatabaseManagerAlgorithms();
//
// // get algorithmId
//// String algorithmId = null;
//
// for (int i = 0; i < algorithms.size(); i++) {
// if (algorithms.get(i).equals("SAMPLEONTABLE")) {
// algorithmId = algorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
//
// // get input parameters of the algorithm specified by id
// inputParameters = getParameters(algorithmId);
//
// if (inputParameters.size() != 0) {
// // print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
// }
// print check
// for (int i = 0; i < inputParameters.size(); i++) {
// logger.info(inputParameters.get(i).getName());
// }
String algorithmId = "SAMPLEONTABLE"; String algorithmId = "SAMPLEONTABLE";
@ -1107,8 +775,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> TableName: " logger.info("dbmanager-> TableName: "
+ tab); + tab);
// if ((!rs.equals(""))&&(!db.equals(""))&&(!scm.equals(""))&&(!tab.equals(""))){
//set input parameters //set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -1148,24 +814,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
output.add(row); output.add(row);
} }
// }
// // print check
// logger.info("dbmanager-> ResourceName: "
// + dataInput.get("ResourceName"));
// logger.info("dbmanager-> DatabaseName: "
// + dataInput.get("DatabaseName"));
// logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
// logger.info("dbmanager-> TableName: " + dataInput.get("TableName"));
// inputParameters.get(0).setValue(dataInput.get("ResourceName"));
// inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
// inputParameters.get(2).setValue(dataInput.get("SchemaName"));
// inputParameters.get(3).setValue(dataInput.get("TableName"));
return output; return output;
} }
@ -1177,34 +825,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// output sample result // output sample result
List<Result> output = new ArrayList<Result>(); List<Result> output = new ArrayList<Result>();
// // get list of algorithms
// List<String> algorithms = new ArrayList<String>();
// algorithms = getDatabaseManagerAlgorithms();
//
// // get algorithmId
//// String algorithmId = null;
//
// for (int i = 0; i < algorithms.size(); i++) {
// if (algorithms.get(i).equals("SMARTSAMPLEONTABLE")) {
// algorithmId = algorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
//
// // get input parameters of the algorithm
// inputParameters = getParameters(algorithmId);
//
// if (inputParameters.size() != 0) {
// // print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
// }
// print check
// for (int i = 0; i < inputParameters.size(); i++) {
// logger.info(inputParameters.get(i).getName());
// }
String algorithmId = "SMARTSAMPLEONTABLE"; String algorithmId = "SMARTSAMPLEONTABLE";
//print check //print check
@ -1223,8 +843,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> TableName: " logger.info("dbmanager-> TableName: "
+ tab); + tab);
// if ((!rs.equals(""))&&(!db.equals(""))&&(!scm.equals(""))&&(!tab.equals(""))){
//set input parameters //set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -1263,44 +881,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
output.add(row); output.add(row);
} }
// }
// // print check
// logger.info("dbmanager-> ResourceName: "
// + dataInput.get("ResourceName"));
// logger.info("dbmanager-> DatabaseName: "
// + dataInput.get("DatabaseName"));
// logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
// logger.info("dbmanager-> TableName: " + dataInput.get("TableName"));
//
// inputParameters.get(0).setValue(dataInput.get("ResourceName"));
// inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
// inputParameters.get(2).setValue(dataInput.get("SchemaName"));
// inputParameters.get(3).setValue(dataInput.get("TableName"));
// // create data structure
// ComputationOutput outputData = new ComputationOutput();
// // computation id
// String computationId = startComputation(algorithmId, inputParameters,
// outputData);
//
// // print check on retrieving data
// // logger.info("dbmanager-> output data retrieved");
//
// // data output values
// LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
// // data output keys
// LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
//
// mapValues = outputData.getMapValues();
// mapKeys = outputData.getmapKeys();
//
// for (int i = 0; i < mapValues.size(); i++) {
// Result row = new Result(mapKeys.get(String.valueOf(i)),
// mapValues.get(String.valueOf(i)));
// output.add(row);
// }
return output; return output;
} }
@ -1313,34 +893,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// output sample result // output sample result
List<Result> output = new ArrayList<Result>(); List<Result> output = new ArrayList<Result>();
// // get list of algorithms
// List<String> algorithms = new ArrayList<String>();
// algorithms = getDatabaseManagerAlgorithms();
//
// // get algorithmId
//// String algorithmId = null;
//
// for (int i = 0; i < algorithms.size(); i++) {
// if (algorithms.get(i).equals("RANDOMSAMPLEONTABLE")) {
// algorithmId = algorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
//
// // get input parameters of the algorithm specified by id
// inputParameters = getParameters(algorithmId);
//
// if (inputParameters.size() != 0) {
// // print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
// }
// print check algorithm input parameters
// for (int i = 0; i < inputParameters.size(); i++) {
// logger.info(inputParameters.get(i).getName());
// }
String algorithmId = "RANDOMSAMPLEONTABLE"; String algorithmId = "RANDOMSAMPLEONTABLE";
//print check //print check
@ -1359,9 +911,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
logger.info("dbmanager-> TableName: " logger.info("dbmanager-> TableName: "
+ tab); + tab);
// if ((!rs.equals(""))&&(!db.equals(""))&&(!scm.equals(""))&&(!tab.equals(""))){
//set input parameters //set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -1400,43 +949,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
output.add(row); output.add(row);
} }
// }
// // print check
// logger.info("dbmanager-> ResourceName: "
// + dataInput.get("ResourceName"));
// logger.info("dbmanager-> DatabaseName: "
// + dataInput.get("DatabaseName"));
// logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
// logger.info("dbmanager-> TableName: " + dataInput.get("TableName"));
//
// inputParameters.get(0).setValue(dataInput.get("ResourceName"));
// inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
// inputParameters.get(2).setValue(dataInput.get("SchemaName"));
// inputParameters.get(3).setValue(dataInput.get("TableName"));
// // create data structure
// ComputationOutput outputData = new ComputationOutput();
// // computation id
// String computationId = startComputation(algorithmId, inputParameters,
// outputData);
//
// // print check on retrieving data
// // logger.info("dbmanager-> output data retrieved");
//
// // data output values
// LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
// // data output keys
// LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
//
// mapValues = outputData.getMapValues();
// mapKeys = outputData.getmapKeys();
//
// for (int i = 0; i < mapValues.size(); i++) {
// Result row = new Result(mapKeys.get(String.valueOf(i)),
// mapValues.get(String.valueOf(i)));
// output.add(row);
// }
return output; return output;
} }
@ -1448,33 +960,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data ouptut // data ouptut
LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>(); LinkedHashMap<String, FileModel> outputParameters = new LinkedHashMap<String, FileModel>();
// // get list of algorithms
// List<String> algorithms = new ArrayList<String>();
// algorithms = getDatabaseManagerAlgorithms();
//
// // get algorithmId
// String algorithmId = null;
//
// for (int i = 0; i < algorithms.size(); i++) {
// if (algorithms.get(i).equals("GETTABLEDETAILS")) {
// algorithmId = algorithms.get(i);
// // print check
// // logger.info("algorithmId: " + algorithmId);
// }
// }
//
// // get input parameters of the algorithm specified by id
// inputParameters = getParameters(algorithmId);
//
// if (inputParameters.size() != 0) {
// // print check
// logger.info("dbmanager-> algorithm input parameters retrieved");
// }
// print check algorithm input parameters
// for (int i = 0; i < inputParameters.size(); i++) {
// logger.info(inputParameters.get(i).getName());
// }
String algorithmId = "GETTABLEDETAILS"; String algorithmId = "GETTABLEDETAILS";
//print check //print check
@ -1494,8 +979,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
+ tab); + tab);
// if ((!rs.equals(""))&&(!db.equals(""))&&(!scm.equals(""))&&(!tab.equals(""))){
//set input parameters //set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
Parameter database = new Parameter("DatabaseName", "", "String", ""); Parameter database = new Parameter("DatabaseName", "", "String", "");
@ -1538,46 +1021,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// logger.info("key: " + outputKey.get(String.valueOf(i))); // logger.info("key: " + outputKey.get(String.valueOf(i)));
} }
// }
// // print check
// logger.info("dbmanager-> ResourceName: "
// + dataInput.get("ResourceName"));
// logger.info("dbmanager-> DatabaseName: "
// + dataInput.get("DatabaseName"));
// logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
// logger.info("dbmanager-> TableName: " + dataInput.get("TableName"));
//
// inputParameters.get(0).setValue(dataInput.get("ResourceName"));
// inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
// inputParameters.get(2).setValue(dataInput.get("SchemaName"));
// inputParameters.get(3).setValue(dataInput.get("TableName"));
// // create data structure
// ComputationOutput outputData = new ComputationOutput();
// // computation id
// String computationId = startComputation(algorithmId, inputParameters,
// outputData);
//
// // print check on retrieving data
// // logger.info("output data retrieved");
//
// // output data values
// LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
// // output data keys
// LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
//
// mapValues = outputData.getMapValues();
// mapKeys = outputData.getmapKeys();
//
// for (int i = 0; i < mapValues.size(); i++) {
// FileModel obj = new FileModel(mapValues.get(String.valueOf(i)));
// // obj.setIsLoaded(true);
// outputParameters.put(mapKeys.get(String.valueOf(i)), obj);
// // print check
// // logger.info("value: " + outputMap.get(String.valueOf(i)));
// // logger.info("key: " + outputKey.get(String.valueOf(i)));
// }
return outputParameters; return outputParameters;
} }
@ -1724,53 +1167,55 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
return elements; return elements;
} }
private List<String> getDatabaseManagerAlgorithms() { //not called
ArrayList<String> dbAlg = new ArrayList<String>(); // private List<String> getDatabaseManagerAlgorithms() {
StatisticalManagerFactory factory = getFactory(); // ArrayList<String> dbAlg = new ArrayList<String>();
// get and print algorithms // StatisticalManagerFactory factory = getFactory();
SMListGroupedAlgorithms groups = factory.getAlgorithms(); // // get and print algorithms
// SMListGroupedAlgorithms groups = factory.getAlgorithms();
//
// if (groups == null)
// logger.info("dbmanager-> GROUPS OF ALGORITHMS IS NULL!");
// else
// logger.info("dbmanager-> GROUPS OF ALGORITHMS IS NOT NULL!");
//
// // get list categories
// for (SMGroupedAlgorithms group : groups.thelist()) {
// for (SMAlgorithm algorithm : group.thelist()) {
// dbAlg.add(algorithm.name());
// }
// }
// return dbAlg;
// }
if (groups == null) //not used
logger.info("dbmanager-> GROUPS OF ALGORITHMS IS NULL!"); // private List<Parameter> getParameters(String algorithmId) {
else // StatisticalManagerFactory factory = getFactory();
logger.info("dbmanager-> GROUPS OF ALGORITHMS IS NOT NULL!"); // SMParameters smParams = factory.getAlgorithmParameters(algorithmId);
// List<Parameter> params = new ArrayList<Parameter>();
// get list categories //
for (SMGroupedAlgorithms group : groups.thelist()) { // for (SMParameter smParam : smParams.list()) {
for (SMAlgorithm algorithm : group.thelist()) { // SMTypeParameter smType = smParam.type();
dbAlg.add(algorithm.name()); // StatisticalServiceType smTypeName = smType.name();
} //
} // String paramName = smParam.name();
return dbAlg; // String paramDescription = smParam.description();
} // String defaultValue = smParam.defaultValue();
// String objectType = smType.values().get(0);
private List<Parameter> getParameters(String algorithmId) { //
StatisticalManagerFactory factory = getFactory(); // // print CHECK
SMParameters smParams = factory.getAlgorithmParameters(algorithmId); //// logger.info("parameters: ");
List<Parameter> params = new ArrayList<Parameter>(); //// logger.info(paramName);
//// logger.info(paramDescription);
for (SMParameter smParam : smParams.list()) { //// logger.info(objectType);
SMTypeParameter smType = smParam.type(); //// logger.info(defaultValue);
StatisticalServiceType smTypeName = smType.name(); //
// Parameter objectParam = new Parameter(paramName, paramDescription,
String paramName = smParam.name(); // objectType, defaultValue);
String paramDescription = smParam.description(); // params.add(objectParam);
String defaultValue = smParam.defaultValue(); // }
String objectType = smType.values().get(0); // return params;
// }
// print CHECK
logger.info("parameters: ");
logger.info(paramName);
logger.info(paramDescription);
logger.info(objectType);
logger.info(defaultValue);
Parameter objectParam = new Parameter(paramName, paramDescription,
objectType, defaultValue);
params.add(objectParam);
}
return params;
}
private synchronized List<Result> getSubmitQueryResult(String submitQueryUID) { private synchronized List<Result> getSubmitQueryResult(String submitQueryUID) {
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest() ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()

View File

@ -5,7 +5,7 @@
<inherits name='com.extjs.gxt.ui.GXT' /> <inherits name='com.extjs.gxt.ui.GXT' />
<inherits name="com.google.gwt.logging.Logging"/> <!-- <inherits name="com.google.gwt.logging.Logging"/> -->
<!-- We need the JUnit module in the main module, --> <!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) --> <!-- otherwise eclipse complains (Google plugin bug?) -->
@ -27,8 +27,8 @@
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />
<set-property name="gwt.logging.logLevel" value="SEVERE"/> <!-- <set-property name="gwt.logging.logLevel" value="SEVERE"/> -->
<set-property name="gwt.logging.logLevel" value="INFO"/> <!-- <set-property name="gwt.logging.logLevel" value="INFO"/> -->
<set-property name="gwt.logging.enabled" value="TRUE"/> <!-- <set-property name="gwt.logging.enabled" value="TRUE"/> -->
</module> </module>