changeset 1063:732cea65cee7

Changed the geo-backend initialization regarding the changes of rev1149. An sql-cache is integrated and enabled now. gnv-artifacts/trunk@1150 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 03 Jun 2010 16:10:27 +0000
parents 58b4a07db856
children 026b936290bc
files gnv-artifacts/ChangeLog gnv-artifacts/doc/conf/conf.xml gnv-artifacts/doc/conf/sql-cache.xml gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java
diffstat 4 files changed, 43 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Wed Jun 02 09:52:39 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Thu Jun 03 16:10:27 2010 +0000
@@ -1,3 +1,17 @@
+2010-06-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/sql-cache.xml: SQL-cache configuration.
+
+	* doc/conf/conf.xml: Added a new section to the geo-backend section to
+	  configure, enable/disable the sql-cache. The sql-cache is activated in
+	  the default configuration.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Removed the initialization of geo-backend related objects (as ArcSDE
+	  connection settings, queries). This work is done in the geo-backend
+	  itself, now. At this place, a new geo-backend Configuration object is
+	  created and its init(.) method is called.
+
 2010-06-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Remove
--- a/gnv-artifacts/doc/conf/conf.xml	Wed Jun 02 09:52:39 2010 +0000
+++ b/gnv-artifacts/doc/conf/conf.xml	Thu Jun 03 16:10:27 2010 +0000
@@ -535,6 +535,9 @@
               Queries of the System are stored. -->
         <backend-configuration>${artifacts.config.dir}/arcsdeconnectionpool.properties</backend-configuration>
         <query-configuration>${artifacts.config.dir}/queries.properties</query-configuration>
+        <cache enabled="true">
+            <configuration>${artifacts.config.dir}/sql-cache.xml</configuration>
+        </cache>
     </geo-backend>
     <rest-server>
         <!--  at this Point it is possible to Change the Port the ArtifactDatabase will bind to.-->
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/sql-cache.xml	Thu Jun 03 16:10:27 2010 +0000
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ehcache>
+    <defaultCache 
+        maxElementsInMemory="10000"
+        eternal="false"
+        memoryStoreEvictionPolicy="LFU"
+        timeToIdleSeconds="10800"
+        timeToLiveSeconds="14400"
+        />
+</ehcache>
+
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java	Wed Jun 02 09:52:39 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java	Thu Jun 03 16:10:27 2010 +0000
@@ -15,6 +15,8 @@
 
 import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
 
+import de.intevation.gnv.geobackend.config.Configuration;
+
 import de.intevation.gnv.raster.Filter;
 import de.intevation.gnv.raster.Palette;
 import de.intevation.gnv.raster.PaletteManager;
@@ -34,11 +36,14 @@
 import java.util.HashMap;
 import java.util.Properties;
 
+import javax.xml.xpath.XPathConstants;
+
 import org.apache.log4j.Logger;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
 
 /**
  * This factory class is used to create new GNVArtfactContext objects,
@@ -59,7 +64,7 @@
      *
      */
     public static final String XPATH_GEOBACKEND_CONFIGURATION =
-        "artifact-database/geo-backend/backend-configuration";
+        "artifact-database/geo-backend";
 
     /**
      *
@@ -171,25 +176,8 @@
         GNVArtifactContext returnValue = null;
         try {
             log.debug("GNVArtifactContextFactory.createArtifactContext");
-            log.info("Initialisation of the Geo-BackendConnectionPool");
-            String backendConfigurationFile = Config.getStringXPath(config,
-                    XPATH_GEOBACKEND_CONFIGURATION);
-            backendConfigurationFile = Config.replaceConfigDir(
-                backendConfigurationFile);
 
-            Properties properties = getProperties(backendConfigurationFile);
-            ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
-            cpf.initializeConnectionPool(properties);
-
-            log.info("Initialisation of the QueryContainer");
-            String queryConfigurationFile = Config.getStringXPath(config,
-                    XPATH_GEOBACKEND_QUERYCONFIGURATION);
-            queryConfigurationFile = Config.replaceConfigDir(
-                queryConfigurationFile);
-
-            Properties queryProperties = getProperties(queryConfigurationFile);
-            QueryContainerFactory qcf = QueryContainerFactory.getInstance();
-            qcf.initializeQueryContainer(queryProperties);
+            configureGeoBackend(config);
 
             configureCache(config);
 
@@ -217,6 +205,14 @@
         return returnValue;
     }
 
+    protected void configureGeoBackend(Document config)
+    throws FileNotFoundException, IOException, QueryContainerException
+    {
+        Configuration geoConf = Configuration.getInstance();
+        String configDir      = Config.getConfigDirectory().getAbsolutePath();
+        geoConf.init(config, configDir, Config.CONFIG_DIR_PLACEHOLDER);
+    }
+
     /**
      *
      * @param config

http://dive4elements.wald.intevation.org