changeset 1123:f76541120bcb

Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached. geo-backend/trunk@1154 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 04 Jun 2010 08:19:38 +0000
parents 1985d5db0feb
children f3fdbeef1c68
files geo-backend/ChangeLog geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java
diffstat 5 files changed, 66 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/geo-backend/ChangeLog	Thu Jun 03 13:31:07 2010 +0000
+++ b/geo-backend/ChangeLog	Fri Jun 04 08:19:38 2010 +0000
@@ -1,3 +1,20 @@
+2010-06-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java:
+	  A new marker interface. It should be implemented by objects that should
+	  not be cached.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java:
+	  A new SDEResultSet class that implements Uncacheable. Currently, it is
+	  used for raster elements returned from ArcSDE.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java:
+	  Raster elements are put into an UncacheableSDEResultSet container. This
+	  has the effect that raster elements are not cached.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java:
+	  Only objects that do not implement Uncacheable will be cached.
+
 2010-06-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* src/main/java/de/intevation/gnv/geobackend/config/Configuration.java: A
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java	Thu Jun 03 13:31:07 2010 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java	Fri Jun 04 08:19:38 2010 +0000
@@ -13,6 +13,8 @@
 
 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
 
+import de.intevation.gnv.geobackend.sde.datasources.Uncacheable;
+
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -74,7 +76,8 @@
                     return returnValue;
                 }
 
-                Connection connection = null;
+                boolean cacheable             = true;
+                Connection connection         = null;
                 ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool();
                 try {
                     // Submit the Query
@@ -86,13 +89,22 @@
                         Date end = new Date();
                         log.info("-> Database query took " +
                             (end.getTime() - start.getTime()) + " ms.");
+
+                        cacheable = rs instanceof Uncacheable ? false : true;
+
                         returnValue = super.createResultCollection(rs);
                     }else{
                         log.error("Could not establish Databaseconnection.");
                         throw new QueryException("Could not establish Databaseconnection.");
                     }
 
-                    cacheResults(queryString, returnValue);
+                    if (cacheable) {
+                        log.debug("Elements are cacheable.");
+                        cacheResults(queryString, returnValue);
+                    }
+                    else {
+                        log.debug("Elements are NOT cacheable.");
+                    }
 
                 } catch (ConnectionException e) {
                     log.error(e,e);
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java	Thu Jun 03 13:31:07 2010 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java	Fri Jun 04 08:19:38 2010 +0000
@@ -494,7 +494,9 @@
             log.debug("ArcSDEStatement.handleResultSet()");
         }
 
-        SDEResultSet lSet = new SDEResultSet();
+        SDEResultSet lSet = isRaster
+            ? new UncacheableSDEResultSet()
+            : new SDEResultSet();
         SeRow row = null;
         int lCount;
         if (!isRaster){
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java	Fri Jun 04 08:19:38 2010 +0000
@@ -0,0 +1,12 @@
+package de.intevation.gnv.geobackend.sde.datasources;
+
+/**
+ * This interface is a marker interface. It is used for objects that should
+ * not be cached.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public interface Uncacheable {
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java	Fri Jun 04 08:19:38 2010 +0000
@@ -0,0 +1,20 @@
+package de.intevation.gnv.geobackend.sde.datasources;
+
+/**
+ * This <i>ResultSet</i> has no special tasks but implements <i>Uncacheable</i>
+ * to avoid this objects being cached.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class UncacheableSDEResultSet
+extends      SDEResultSet
+implements   Uncacheable
+{
+    /**
+     * Creates a new UncacheableSDResultSet object.
+     */
+    public UncacheableSDEResultSet() {
+
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org