annotate 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
rev   line source
4067
d5aed044ca0d Added AFT sync module.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.aft;
d5aed044ca0d Added AFT sync module.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
4072
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
3 import java.io.File;
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
4
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
5 import org.w3c.dom.Document;
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
6
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
7 import de.intevation.utils.XML;
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
8
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
9 import de.intevation.db.ConnectionBuilder;
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
10
4067
d5aed044ca0d Added AFT sync module.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 public class Sync
d5aed044ca0d Added AFT sync module.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 {
4072
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
13 public static final String FLYS = "flys";
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
14 public static final String AFT = "aft";
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
15
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
16 public static final String CONFIG_FILE =
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
17 System.getProperty("config.file", "config.xml");
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
18
4067
d5aed044ca0d Added AFT sync module.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 public static void main(String [] args) {
4072
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
20
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
21 File configFile = new File(CONFIG_FILE);
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
22
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
23 if (!configFile.isFile() || !configFile.canRead()) {
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
24 System.err.println("cannot read config file");
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
25 System.exit(1);
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
26 }
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
27
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
28 Document config = XML.parseDocument(configFile, Boolean.FALSE);
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
29
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
30 if (config == null) {
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
31 System.err.println("cannot load config");
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
32 System.exit(1);
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
33 }
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
34
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
35 ConnectionBuilder flysConnectionBuilder =
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
36 new ConnectionBuilder(FLYS, config);
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
37
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
38 ConnectionBuilder aftConnectionBuilder =
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
39 new ConnectionBuilder(AFT, config);
88f801888d85 load configuration an setup db connections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4067
diff changeset
40
4067
d5aed044ca0d Added AFT sync module.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 }
d5aed044ca0d Added AFT sync module.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 }
d5aed044ca0d Added AFT sync module.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org