Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
4074:100c4e0a45e1 | 4075:dbd0b3b1b8b8 |
---|---|
7 import org.w3c.dom.Document; | 7 import org.w3c.dom.Document; |
8 | 8 |
9 import de.intevation.utils.XML; | 9 import de.intevation.utils.XML; |
10 | 10 |
11 import de.intevation.db.ConnectionBuilder; | 11 import de.intevation.db.ConnectionBuilder; |
12 import de.intevation.db.ConnectedStatements; | |
12 | 13 |
13 public class Sync | 14 public class Sync |
14 { | 15 { |
15 public static final String FLYS = "flys"; | 16 public static final String FLYS = "flys"; |
16 public static final String AFT = "aft"; | 17 public static final String AFT = "aft"; |
38 new ConnectionBuilder(AFT, config); | 39 new ConnectionBuilder(AFT, config); |
39 | 40 |
40 ConnectionBuilder flysConnectionBuilder = | 41 ConnectionBuilder flysConnectionBuilder = |
41 new ConnectionBuilder(FLYS, config); | 42 new ConnectionBuilder(FLYS, config); |
42 | 43 |
43 Rivers rivers = new Rivers( | 44 ConnectedStatements aftStatements = null; |
44 aftConnectionBuilder, | 45 ConnectedStatements flysStatements = null; |
45 flysConnectionBuilder); | |
46 | |
47 try { | 46 try { |
48 rivers.sync(); | 47 aftStatements = aftConnectionBuilder.getConnectedStatements(); |
48 flysStatements = flysConnectionBuilder.getConnectedStatements(); | |
49 Rivers rivers = new Rivers(); | |
50 rivers.sync(aftStatements, flysStatements); | |
49 } | 51 } |
50 catch (SQLException sqle) { | 52 catch (SQLException sqle) { |
53 sqle.printStackTrace(); | |
51 System.err.println("syncing failed: " + sqle.getMessage()); | 54 System.err.println("syncing failed: " + sqle.getMessage()); |
52 } | 55 } |
53 finally { | 56 finally { |
54 rivers.close(); | 57 if (aftStatements != null) { |
58 aftStatements.close(); | |
59 } | |
60 if (flysStatements != null) { | |
61 flysStatements.close(); | |
62 } | |
55 } | 63 } |
56 } | 64 } |
57 } | 65 } |
58 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 66 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |