diff flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java @ 4841:ad0990a82ab8

Insert db connection into riveraxis map files. * Added new MapUtils. * Moved connection specific strings to maputils. * Updated mapfile template.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 23 Jan 2013 17:32:30 +0100
parents 8062b571884d
children 88014b9852d0
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java	Wed Jan 23 13:20:39 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java	Wed Jan 23 17:32:30 2013 +0100
@@ -5,6 +5,7 @@
 
 import de.intevation.flys.artifacts.model.LayerInfo;
 import de.intevation.flys.artifacts.model.RiverFactory;
+import de.intevation.flys.backend.SessionFactoryProvider;
 import de.intevation.flys.model.River;
 import de.intevation.flys.model.RiverAxis;
 
@@ -12,9 +13,12 @@
 import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.log4j.Logger;
 import org.apache.velocity.Template;
+import org.hibernate.impl.SessionFactoryImpl;
 
 public class RiverMapfileGenerator extends MapfileGenerator {
 
@@ -39,6 +43,12 @@
     public static final String XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH =
             "/artifact-database/rivermap/mapserver/templates/@path";
 
+    public static final Pattern DB_URL_PATTERN =
+        Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z]+)");
+
+    public static final Pattern DB_PSQL_URL_PATTERN =
+        Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z0-9]+)");
+
     private static Logger logger = Logger.getLogger(RiverMapfileGenerator.class);
 
     /**
@@ -80,6 +90,8 @@
     protected void createRiverAxisLayer(String riverName, int riverID, String srid, String extend) {
         LayerInfo layerInfo = new LayerInfo();
         layerInfo.setName(riverName);
+        layerInfo.setConnection(MapUtils.getConnection());
+        layerInfo.setConnectionType(MapUtils.getConnectionType());
         layerInfo.setSrid(srid);
         layerInfo.setExtent(extend);
         layerInfo.setType("line");

http://dive4elements.wald.intevation.org