diff flys-aft/src/main/java/de/intevation/aft/Sync.java @ 4072:88f801888d85

load configuration an setup db connections. flys-aft/trunk@3401 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 13 Dec 2011 12:33:36 +0000
parents d5aed044ca0d
children 2c70fae83d0c
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/Sync.java	Tue Dec 13 10:11:23 2011 +0000
+++ b/flys-aft/src/main/java/de/intevation/aft/Sync.java	Tue Dec 13 12:33:36 2011 +0000
@@ -1,8 +1,43 @@
 package de.intevation.aft;
 
+import java.io.File;
+
+import org.w3c.dom.Document;
+
+import de.intevation.utils.XML;
+
+import de.intevation.db.ConnectionBuilder;
+
 public class Sync
 {
+    public static final String FLYS = "flys";
+    public static final String AFT  = "aft";
+
+    public static final String CONFIG_FILE =
+        System.getProperty("config.file", "config.xml");
+
     public static void main(String [] args) {
+
+        File configFile = new File(CONFIG_FILE);
+
+        if (!configFile.isFile() || !configFile.canRead()) {
+            System.err.println("cannot read config file");
+            System.exit(1);
+        }
+
+        Document config = XML.parseDocument(configFile, Boolean.FALSE);
+
+        if (config == null) {
+            System.err.println("cannot load config");
+            System.exit(1);
+        }
+
+        ConnectionBuilder flysConnectionBuilder =
+            new ConnectionBuilder(FLYS, config);
+
+        ConnectionBuilder aftConnectionBuilder =
+            new ConnectionBuilder(AFT, config);
+
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org