diff --git a/pom.xml b/pom.xml
index 19170a6..c19af7b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -155,6 +155,7 @@
net.sf.ehcache
ehcache
2.8.0
+ provided
diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java b/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java
index 1993db6..d15db47 100644
--- a/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java
@@ -15,6 +15,7 @@ import java.net.URLStreamHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
+import net.didion.jwnl.data.Exc;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.config.CacheConfiguration;
@@ -90,6 +91,45 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// 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
+ public void init() throws ServletException {
+
+
+ super.init();
+
+
+ //TODO MODIFY: SET THE NAME OF THE CACHE DISK WITH CODE AND NOT IN FILE ENCACHE.XML
+
try {
// CacheManager cacheManager = CacheManager
@@ -103,7 +143,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
URL url = getClass().getResource("/encache.xml");
CacheManager cacheManager = CacheManager.newInstance(url);
// getcache
- employeeCache = cacheManager.getEhcache("DBCache");
+ employeeCache = cacheManager.getEhcache("DBCache");
//set Disk Store Path in the configuration file encache.xml
// CacheConfiguration config = employeeCache.getCacheConfiguration();
@@ -112,24 +152,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
//
// config.setDiskStorePath(this.getServletContext().getRealPath("")+DiskCacheFolderName);
- } catch (Exception e) {
- // TODO: handle exception
- e.printStackTrace();
- throw new Exception("Failed to get cache. " + e);
- }
-
- }
-
- @Override
- public void init() throws ServletException {
- super.init();
-
-
- //TODO MODIFY: SET THE NAME OF THE CACHE DISK WITH CODE AND NOT IN FILE ENCACHE.XML
-
-// String path = System.getenv("CATALINA_TMPDIR");
+ String path = System.getenv("CATALINA_TMPDIR");
// System.out.println("Path: " + this.getServletContext().getRealPath(""));
// System.out.println("Path: " + path);
@@ -139,11 +164,33 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// String DiskCacheFolderName="DBManagerDisk";
// File f = new File(this.getServletContext().getRealPath("")+DiskCacheFolderName);
-// CacheConfiguration config = employeeCache.getCacheConfiguration();
-// String DiskCacheFolderName="DBManagerDisk";
+ CacheConfiguration config = employeeCache.getCacheConfiguration();
+ String DiskCacheFolderName="DBManagerDisk";
// config.setDiskStorePath(this.getServletContext().getRealPath("")+DiskCacheFolderName);
+// File f = new File(path+"/"+DiskCacheFolderName);
+
+// if (!f.exists()){
+// f.mkdir();
+//
+// }
+
+
+
// config.setDiskStorePath(path+"/"+DiskCacheFolderName);
+ config.setDiskStorePath(path);
+// config.setDiskPersistent(true);
+// config.setOverflowToDisk(true);
+
+
+
+ } catch (Exception e) {
+ // TODO: handle exception
+ e.printStackTrace();
+// throw new Exception("Failed to get cache. " + e);
+// Exception exc = new Exception("Failed to get cache. " + e.getMessage());
+ throw e;
+ }
// File f = new File(path+"/"+DiskCacheFolderName);
//
diff --git a/src/main/resources/encache.xml b/src/main/resources/encache.xml
index 3889b22..a7e3e49 100644
--- a/src/main/resources/encache.xml
+++ b/src/main/resources/encache.xml
@@ -5,8 +5,6 @@
dynamicConfig="true">
-
-
-
-
+
-
+ diskPersistent="true"
+ >