bug fixed and related to the cache. File related to cache removed with the portlet unregistering. Class GWTdbManagerServiceImpl modified adding the method destroy that removes the cache and file encache.xml changed setting the parameter diskPersistent to false value in order to remove the file in temp folder.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@99964 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-09-17 08:27:30 +00:00
parent 5e277ab215
commit 6b87523db1
2 changed files with 738 additions and 752 deletions

View File

@ -5,7 +5,6 @@ import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
@ -56,12 +55,9 @@ import org.gcube.portlets.user.databasesmanager.client.datamodel.Row;
import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet; import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
import org.gcube.portlets.user.databasesmanager.server.util.SessionUtil; import org.gcube.portlets.user.databasesmanager.server.util.SessionUtil;
import org.gcube.portlets.user.databasesmanager.server.util.WsUtil; import org.gcube.portlets.user.databasesmanager.server.util.WsUtil;
import com.extjs.gxt.ui.client.core.El;
import com.extjs.gxt.ui.client.data.BasePagingLoadResult; import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.data.PagingLoadConfig; import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult; import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.XStream;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -84,7 +80,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
public static List<String> listAlgorithms; public static List<String> listAlgorithms;
public GWTdbManagerServiceImpl() throws Exception { public GWTdbManagerServiceImpl() throws Exception {
} }
@Override @Override
@ -92,22 +87,17 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
super.init(); super.init();
// create cache
//craete cache
try { try {
// System.out.println("*** CACHE NOT EXISTING");
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");
String path = System.getenv("CATALINA_TMPDIR"); String path = System.getenv("CATALINA_TMPDIR");
// System.out.println("Path: " + // CacheConfiguration config =
// this.getServletContext().getRealPath("")); // employeeCache.getCacheConfiguration();
// String DiskCacheFolderName = "DBManagerDisk";
CacheConfiguration config = employeeCache.getCacheConfiguration();
String DiskCacheFolderName = "DBManagerDisk";
// File f = new File(path+"/"+DiskCacheFolderName); // File f = new File(path+"/"+DiskCacheFolderName);
// if (!f.exists()){ // if (!f.exists()){
@ -115,22 +105,37 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// //
// } // }
config.setDiskStorePath(path); // config.setDiskStorePath(path);
// config.setDiskPersistent(true); // config.setDiskPersistent(true);
// config.setOverflowToDisk(true); // config.setOverflowToDisk(true);
} catch (Exception e) { } catch (Exception e) {
logger.error("Failed to get cache: " + e); logger.error("dbmanager-> Failed to get cache: " + e);
e.printStackTrace(); e.printStackTrace();
throw e; throw e;
} }
}
// File f = new File(path+"/"+DiskCacheFolderName); public void destroy() {
// super.destroy();
// if (!f.exists()){
// f.mkdir(); try {
// } // System.out.println("*** REMOVING CACHE");
CacheManager cacheManager = CacheManager.getInstance();
if (cacheManager.cacheExists("DBCache")) {
// System.out.println("*** cache exist");
cacheManager.removeCache("DBCache");
// cacheManager.removalAll();
// System.out.println("*** cache removed");
}
cacheManager.shutdown();
} catch (Exception e) {
// TODO: handle exception
logger.error("dbmanager-> " + e);
e.printStackTrace();
}
} }
@ -188,7 +193,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// get algorithmId // get algorithmId
String algorithmId = "LISTDBNAMES"; String algorithmId = "LISTDBNAMES";
Parameter maxNumber = new Parameter("MaxNumber", "", "String", "-1"); Parameter maxNumber = new Parameter("MaxNumber", "", "String", "-1");
inputParameters.add(maxNumber); inputParameters.add(maxNumber);
@ -206,6 +210,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// System.out.println("***KEY: " + key); // System.out.println("***KEY: " + key);
// net.sf.ehcache.Element dataFromCache = // net.sf.ehcache.Element dataFromCache =
// employeeCache.get(key); // employeeCache.get(key);
net.sf.ehcache.Element dataFromCache = getDataFromCache(key); net.sf.ehcache.Element dataFromCache = getDataFromCache(key);
Object value = null; Object value = null;
@ -217,7 +222,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
outputParameters = (List<FileModel>) value; outputParameters = (List<FileModel>) value;
} else { } else {
// start the computation // start the computation
// System.out.println("***STARTING THE COMPUTATION"); // System.out.println("***STARTING THE COMPUTATION");
// create data structure for data output // create data structure for data output
@ -241,24 +245,22 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
outputParameters.add(obj); outputParameters.add(obj);
} }
if (outputParameters != null if (outputParameters != null && outputParameters.size() != 0) {
&& outputParameters.size() != 0) {
// put data in cache // put data in cache
net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element( net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element(
key, outputParameters); key, outputParameters);
insertDataIntoCache(dataToCache); insertDataIntoCache(dataToCache);
// employeeCache.put(dataToCache);
} }
} }
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
// e.printStackTrace(); // e.printStackTrace();
throw new Exception("Failed to load data. " + e); // throw new Exception("Failed to load data. " + e);
throw e;
} }
// } // }
return outputParameters; return outputParameters;
@ -276,8 +278,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String algorithmId = "LISTDBINFO"; String algorithmId = "LISTDBINFO";
// print check // print check
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: " + resourceName);
+ resourceName);
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
inputParameters.add(resource); inputParameters.add(resource);
@ -333,17 +334,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// mapValues.get(String.valueOf(i))); // mapValues.get(String.valueOf(i)));
// logger.info("key: " + // logger.info("key: " +
// mapKeys.get(String.valueOf(i))); // mapKeys.get(String.valueOf(i)));
outputParameters.put(mapKeys.get(String.valueOf(i)), outputParameters.put(mapKeys.get(String.valueOf(i)), obj);
obj);
} }
// write data in cache // write data in cache
if (outputParameters != null if (outputParameters != null && outputParameters.size() != 0) {
&& outputParameters.size() != 0) {
// put data in cache // put data in cache
net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element( net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element(
inputParameters.get(0).getValue(), inputParameters.get(0).getValue(), outputParameters);
outputParameters);
insertDataIntoCache(dataToCache); insertDataIntoCache(dataToCache);
// employeeCache.put(dataToCache); // employeeCache.put(dataToCache);
@ -354,7 +352,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
e.printStackTrace(); e.printStackTrace();
throw new Exception("Failed to load data. " + e); // throw new Exception("Failed to load data " + );
throw e;
} }
return outputParameters; return outputParameters;
@ -375,10 +374,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String rs = dataInput.get("ResourceName"); String rs = dataInput.get("ResourceName");
String db = dataInput.get("DatabaseName"); String db = dataInput.get("DatabaseName");
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: " + rs);
+ rs); logger.info("dbmanager-> DatabaseName: " + db);
logger.info("dbmanager-> DatabaseName: "
+ db);
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
@ -440,8 +437,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
} }
// write data in cache // write data in cache
if (outputParameters != null if (outputParameters != null && outputParameters.size() != 0) {
&& outputParameters.size() != 0) {
// put data in cache // put data in cache
net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element( net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element(
inputParameters.get(0).getValue() inputParameters.get(0).getValue()
@ -457,7 +453,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
e.printStackTrace(); e.printStackTrace();
throw new Exception("Failed to load data. " + e); // throw new Exception("Failed to load data. " + e);
throw e;
} }
@ -472,7 +469,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// data output // data output
List<Result> outputParameters = new ArrayList<Result>(); List<Result> outputParameters = new ArrayList<Result>();
String algorithmId = "LISTTABLES"; String algorithmId = "LISTTABLES";
String rs = dataInput.get("ResourceName"); String rs = dataInput.get("ResourceName");
@ -480,12 +476,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String scm = dataInput.get("SchemaName"); String scm = dataInput.get("SchemaName");
// print check // print check
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: " + rs);
+ rs); logger.info("dbmanager-> DatabaseName: " + db);
logger.info("dbmanager-> DatabaseName: " logger.info("dbmanager-> SchemaName: " + scm);
+ db);
logger.info("dbmanager-> SchemaName: "
+ scm);
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
@ -502,8 +495,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
try { try {
// get data from cache // get data from cache
// check if data exist considering as key the input parameters // check if data exist considering as key the input parameters
String key = inputParameters.get(0).getValue()+inputParameters.get(1).getValue()+ String key = inputParameters.get(0).getValue()
inputParameters.get(2).getValue(); + inputParameters.get(1).getValue()
+ inputParameters.get(2).getValue();
// System.out.println("***KEY: " + key); // System.out.println("***KEY: " + key);
net.sf.ehcache.Element dataFromCache = getDataFromCache(key); net.sf.ehcache.Element dataFromCache = getDataFromCache(key);
@ -522,8 +516,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// create data structure // create data structure
ComputationOutput outputData = new ComputationOutput(); ComputationOutput outputData = new ComputationOutput();
// computation id // computation id
String computationId = startComputation(algorithmId, inputParameters, String computationId = startComputation(algorithmId,
outputData); inputParameters, outputData);
// print check on retrieving data // print check on retrieving data
// logger.info("output data retrieved"); // logger.info("output data retrieved");
@ -537,18 +531,18 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
mapKeys = outputData.getmapKeys(); mapKeys = outputData.getmapKeys();
for (int i = 0; i < mapValues.size(); i++) { for (int i = 0; i < mapValues.size(); i++) {
Result row = new Result(String.valueOf(i), mapValues.get(String Result row = new Result(String.valueOf(i),
.valueOf(i))); mapValues.get(String.valueOf(i)));
outputParameters.add(row); outputParameters.add(row);
} }
// write data in cache // write data in cache
if (outputParameters != null if (outputParameters != null && outputParameters.size() != 0) {
&& outputParameters.size() != 0) {
// put data in cache // put data in cache
net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element( net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element(
inputParameters.get(0).getValue() inputParameters.get(0).getValue()
+ inputParameters.get(1).getValue()+inputParameters.get(2).getValue(), + inputParameters.get(1).getValue()
+ inputParameters.get(2).getValue(),
outputParameters); outputParameters);
insertDataIntoCache(dataToCache); insertDataIntoCache(dataToCache);
@ -557,14 +551,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
} }
} catch (Exception e) { } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
throw new Exception("Failed to load data. " + e); // throw new Exception("Failed to load data. " + e);
throw e;
} }
// // create data structure // // create data structure
// ComputationOutput outputData = new ComputationOutput(); // ComputationOutput outputData = new ComputationOutput();
// // computation id // // computation id
@ -575,9 +567,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// // logger.info("output data retrieved"); // // logger.info("output data retrieved");
// //
// // data output values // // data output values
// LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>(); // LinkedHashMap<String, String> mapValues = new LinkedHashMap<String,
// String>();
// // data output keys // // data output keys
// LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>(); // LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String,
// String>();
// //
// mapValues = outputData.getMapValues(); // mapValues = outputData.getMapValues();
// mapKeys = outputData.getmapKeys(); // mapKeys = outputData.getmapKeys();
@ -598,7 +592,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String keyword) throws Exception { String keyword) throws Exception {
// tables' list stored for a user session // tables' list stored for a user session
// ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest() // ASLSession session =
// WsUtil.getAslSession(this.getThreadLocalRequest()
// .getSession()); // .getSession());
// List<Result> result = (List<Result>) session // List<Result> result = (List<Result>) session
// .getAttribute("TablesResult"); // .getAttribute("TablesResult");
@ -619,7 +614,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// // check on a schema // // check on a schema
// String currentSchema = ""; // String currentSchema = "";
// currentSchema = dataInput.get("SchemaName"); // currentSchema = dataInput.get("SchemaName");
// String previousSchema = (String) session.getAttribute("previousSchema"); // String previousSchema = (String)
// session.getAttribute("previousSchema");
// if (!currentSchema.equals(previousSchema)) { // if (!currentSchema.equals(previousSchema)) {
// // result = null; // // result = null;
// result = new ArrayList<Result>(); // result = new ArrayList<Result>();
@ -711,19 +707,15 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// list that contains table attributes // list that contains table attributes
List<String> listAttributes = null; List<String> listAttributes = null;
String algorithmId = "SUBMITQUERY"; String algorithmId = "SUBMITQUERY";
// print check // print check
String rs = dataDB.get("ResourceName"); String rs = dataDB.get("ResourceName");
String db = dataDB.get("DatabaseName"); String db = dataDB.get("DatabaseName");
// print check // print check
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: " + rs);
+ rs); logger.info("dbmanager-> DatabaseName: " + db);
logger.info("dbmanager-> DatabaseName: "
+ db);
logger.info("dbmanager-> Query: " + query); logger.info("dbmanager-> Query: " + query);
logger.info("dbmanager-> SmartCorrections check: " logger.info("dbmanager-> SmartCorrections check: "
@ -732,8 +724,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// 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", "",
Parameter applySmartCorrection = new Parameter("Apply Smart Correction", "", "Boolean", "true"); "Boolean", "true");
Parameter applySmartCorrection = new Parameter(
"Apply Smart Correction", "", "Boolean", "true");
Parameter lng = new Parameter("Language", "", "NONE", "NONE"); Parameter lng = new Parameter("Language", "", "NONE", "NONE");
Parameter q = new Parameter("Query", "", "String", ""); Parameter q = new Parameter("Query", "", "String", "");
@ -744,7 +738,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
inputParameters.add(lng); inputParameters.add(lng);
inputParameters.add(q); inputParameters.add(q);
inputParameters.get(0).setValue(rs); inputParameters.get(0).setValue(rs);
inputParameters.get(1).setValue(db); inputParameters.get(1).setValue(db);
inputParameters.get(2).setValue(String.valueOf(valueReadOnlyQuery)); inputParameters.get(2).setValue(String.valueOf(valueReadOnlyQuery));
@ -824,7 +817,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>();
String algorithmId = "SAMPLEONTABLE"; String algorithmId = "SAMPLEONTABLE";
// print check // print check
@ -834,14 +826,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String tab = dataInput.get("TableName"); String tab = dataInput.get("TableName");
// print check // print check
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: " + rs);
+ rs); logger.info("dbmanager-> DatabaseName: " + db);
logger.info("dbmanager-> DatabaseName: " logger.info("dbmanager-> SchemaName: " + scm);
+ db); logger.info("dbmanager-> TableName: " + tab);
logger.info("dbmanager-> SchemaName: "
+ scm);
logger.info("dbmanager-> TableName: "
+ tab);
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
@ -858,7 +846,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
inputParameters.get(2).setValue(scm); inputParameters.get(2).setValue(scm);
inputParameters.get(3).setValue(tab); inputParameters.get(3).setValue(tab);
// create data structure // create data structure
ComputationOutput outputData = new ComputationOutput(); ComputationOutput outputData = new ComputationOutput();
// computation id // computation id
@ -902,14 +889,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String tab = dataInput.get("TableName"); String tab = dataInput.get("TableName");
// print check // print check
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: " + rs);
+ rs); logger.info("dbmanager-> DatabaseName: " + db);
logger.info("dbmanager-> DatabaseName: " logger.info("dbmanager-> SchemaName: " + scm);
+ db); logger.info("dbmanager-> TableName: " + tab);
logger.info("dbmanager-> SchemaName: "
+ scm);
logger.info("dbmanager-> TableName: "
+ tab);
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
@ -970,14 +953,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String tab = dataInput.get("TableName"); String tab = dataInput.get("TableName");
// print check // print check
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: " + rs);
+ rs); logger.info("dbmanager-> DatabaseName: " + db);
logger.info("dbmanager-> DatabaseName: " logger.info("dbmanager-> SchemaName: " + scm);
+ db); logger.info("dbmanager-> TableName: " + tab);
logger.info("dbmanager-> SchemaName: "
+ scm);
logger.info("dbmanager-> TableName: "
+ tab);
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
@ -1037,15 +1016,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String tab = dataInput.get("TableName"); String tab = dataInput.get("TableName");
// print check // print check
logger.info("dbmanager-> ResourceName: " logger.info("dbmanager-> ResourceName: " + rs);
+ rs); logger.info("dbmanager-> DatabaseName: " + db);
logger.info("dbmanager-> DatabaseName: " logger.info("dbmanager-> SchemaName: " + scm);
+ db); logger.info("dbmanager-> TableName: " + tab);
logger.info("dbmanager-> SchemaName: "
+ scm);
logger.info("dbmanager-> TableName: "
+ tab);
// set input parameters // set input parameters
Parameter resource = new Parameter("ResourceName", "", "String", ""); Parameter resource = new Parameter("ResourceName", "", "String", "");
@ -1062,7 +1036,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
inputParameters.get(2).setValue(scm); inputParameters.get(2).setValue(scm);
inputParameters.get(3).setValue(tab); inputParameters.get(3).setValue(tab);
// create data structure // create data structure
ComputationOutput outputData = new ComputationOutput(); ComputationOutput outputData = new ComputationOutput();
// computation id // computation id
@ -1729,7 +1702,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// clear the cache on the user request // clear the cache on the user request
public GeneralOutputFromServlet refreshDataTree(String ElementType, public GeneralOutputFromServlet refreshDataTree(String ElementType,
LinkedHashMap<String, String> inputData, FileModel element) throws Exception { LinkedHashMap<String, String> inputData, FileModel element)
throws Exception {
// // call the method related to the element selected // // call the method related to the element selected
// //
@ -1752,11 +1726,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
key = inputData.get("ResourceName"); key = inputData.get("ResourceName");
break; break;
case "database": case "database":
if (element.getDatabaseType().equals(ConstantsPortlet.POSTGRES)){ //refresh schema list if (element.getDatabaseType().equals(
ConstantsPortlet.POSTGRES)) { // refresh schema list
key = inputData.get("ResourceName") key = inputData.get("ResourceName")
+ inputData.get("DatabaseName"); + inputData.get("DatabaseName");
} }
if (element.getDatabaseType().equals(ConstantsPortlet.MYSQL)){ //refresh table list if (element.getDatabaseType()
.equals(ConstantsPortlet.MYSQL)) { // refresh table
// list
key = inputData.get("ResourceName") key = inputData.get("ResourceName")
+ inputData.get("DatabaseName") + inputData.get("DatabaseName")
+ inputData.get("SchemaName"); + inputData.get("SchemaName");
@ -1771,14 +1748,15 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
} }
} }
// System.out.println("server->KEY: " + key); // System.out.println("server->KEY: " + key);
net.sf.ehcache.Element dataFromCache = getDataFromCache(key); net.sf.ehcache.Element dataFromCache = getDataFromCache(key);
if (dataFromCache != null) { if (dataFromCache != null) {
// System.out.println("server-> data in cache with key: " + key); // System.out.println("server-> data in cache with key: " +
// key);
refreshCache(key); refreshCache(key);
// System.out.println("server-> data removed from cache with key: " + key); // System.out.println("server-> data removed from cache with key: "
// + key);
if (!ElementType.equals("")) { if (!ElementType.equals("")) {
// System.out.println("server-> element type not null"); // System.out.println("server-> element type not null");
@ -1794,11 +1772,19 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
result = new GeneralOutputFromServlet(output2); result = new GeneralOutputFromServlet(output2);
break; break;
case "database": case "database":
if (element.getDatabaseType()!=null && (element.getDatabaseType().equals(ConstantsPortlet.POSTGRES))){ //refresh schema list if (element.getDatabaseType() != null
&& (element.getDatabaseType()
.equals(ConstantsPortlet.POSTGRES))) { // refresh
// schema
// list
List<FileModel> output3 = getDBSchema(inputData); List<FileModel> output3 = getDBSchema(inputData);
result = new GeneralOutputFromServlet(output3); result = new GeneralOutputFromServlet(output3);
} }
if (element.getDatabaseType()!=null && element.getDatabaseType().equals(ConstantsPortlet.MYSQL)){ //refresh table list if (element.getDatabaseType() != null
&& element.getDatabaseType().equals(
ConstantsPortlet.MYSQL)) { // refresh
// table
// list
getTables(inputData); getTables(inputData);
} }

View File

@ -27,7 +27,7 @@
memoryStoreEvictionPolicy="LRU" memoryStoreEvictionPolicy="LRU"
transactionalMode="off" transactionalMode="off"
overflowToDisk="true" overflowToDisk="true"
diskPersistent="true" diskPersistent="false"
> >
</cache> </cache>