diff flys-aft/src/main/java/de/intevation/aft/Sync.java @ 4075:dbd0b3b1b8b8

Sync each river. flys-aft/trunk@3419 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 14 Dec 2011 17:53:15 +0000
parents 2c70fae83d0c
children 97de7a552b79
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/Sync.java	Tue Dec 13 14:32:55 2011 +0000
+++ b/flys-aft/src/main/java/de/intevation/aft/Sync.java	Wed Dec 14 17:53:15 2011 +0000
@@ -9,6 +9,7 @@
 import de.intevation.utils.XML;
 
 import de.intevation.db.ConnectionBuilder;
+import de.intevation.db.ConnectedStatements;
 
 public class Sync
 {
@@ -40,18 +41,25 @@
         ConnectionBuilder flysConnectionBuilder =
             new ConnectionBuilder(FLYS, config);
 
-        Rivers rivers = new Rivers(
-            aftConnectionBuilder,
-            flysConnectionBuilder);
-
+        ConnectedStatements aftStatements  = null;
+        ConnectedStatements flysStatements = null;
         try {
-            rivers.sync();
+            aftStatements  = aftConnectionBuilder.getConnectedStatements();
+            flysStatements = flysConnectionBuilder.getConnectedStatements();
+            Rivers rivers = new Rivers();
+            rivers.sync(aftStatements, flysStatements);
         }
         catch (SQLException sqle) {
+            sqle.printStackTrace();
             System.err.println("syncing failed: " + sqle.getMessage());
         }
         finally {
-            rivers.close();
+            if (aftStatements != null) {
+                aftStatements.close();
+            }
+            if (flysStatements != null) {
+                flysStatements.close();
+            }
         }
     }
 }

http://dive4elements.wald.intevation.org