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