diff flys-backend/src/main/java/de/intevation/flys/backend/SedDBCredentials.java @ 3471:e4250c6e1538 2.8.1

merged flys-backend/2.8.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:40 +0200
parents 76c75c8b9ee0
children fb9dcc68b9c2
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/backend/SedDBCredentials.java	Fri Sep 28 12:14:40 2012 +0200
@@ -0,0 +1,195 @@
+package de.intevation.flys.backend;
+
+import de.intevation.artifacts.common.utils.Config;
+
+import de.intevation.seddb.model.Bezugspegel;
+import de.intevation.seddb.model.Bezugspegelgew;
+import de.intevation.seddb.model.BezugspegelgewId;
+import de.intevation.seddb.model.Bild;
+import de.intevation.seddb.model.Gewaesser;
+import de.intevation.seddb.model.Gfaenger;
+import de.intevation.seddb.model.Glotlinks;
+import de.intevation.seddb.model.GlotlinksId;
+import de.intevation.seddb.model.Glotrechte;
+import de.intevation.seddb.model.Gprobe;
+import de.intevation.seddb.model.GprobeId;
+import de.intevation.seddb.model.Gsiebsatz;
+import de.intevation.seddb.model.Gsiebung;
+import de.intevation.seddb.model.Gsiebungsieb;
+import de.intevation.seddb.model.GsiebungsiebId;
+import de.intevation.seddb.model.Hpeilpunkt;
+import de.intevation.seddb.model.HpeilpunktId;
+import de.intevation.seddb.model.Hpeilung;
+import de.intevation.seddb.model.Messung;
+import de.intevation.seddb.model.Messunglotcount;
+import de.intevation.seddb.model.MessunglotcountId;
+import de.intevation.seddb.model.Messungsta;
+import de.intevation.seddb.model.MessungstaId;
+import de.intevation.seddb.model.Messunguferbezug;
+import de.intevation.seddb.model.MessunguferbezugId;
+import de.intevation.seddb.model.Mpeilpunkt;
+import de.intevation.seddb.model.MpeilpunktId;
+import de.intevation.seddb.model.Mpeilung;
+import de.intevation.seddb.model.Probebild;
+import de.intevation.seddb.model.Siebanalyse;
+import de.intevation.seddb.model.Slotlinks;
+import de.intevation.seddb.model.SlotlinksId;
+import de.intevation.seddb.model.Slotrechte;
+import de.intevation.seddb.model.Sohlprobe;
+import de.intevation.seddb.model.Sohltest;
+import de.intevation.seddb.model.Sprobe;
+import de.intevation.seddb.model.SprobeId;
+import de.intevation.seddb.model.Ssiebung;
+import de.intevation.seddb.model.Ssiebungsieb;
+import de.intevation.seddb.model.SsiebungsiebId;
+import de.intevation.seddb.model.Station;
+import de.intevation.seddb.model.Stationgew;
+import de.intevation.seddb.model.StationgewId;
+import de.intevation.seddb.model.TmpGloChanged;
+import de.intevation.seddb.model.TmpMesAchanged;
+import de.intevation.seddb.model.TmpMesGchanged;
+import de.intevation.seddb.model.TmpMesQchanged;
+import de.intevation.seddb.model.TmpMesSchanged;
+import de.intevation.seddb.model.Zzarchiv;
+import de.intevation.seddb.model.Zzprobenahmeart;
+import de.intevation.seddb.model.Zzsondierungart;
+import de.intevation.seddb.model.Zzthema;
+
+public class SedDBCredentials
+extends      Credentials
+{
+    public static final String XPATH_USER =
+        "/artifact-database/seddb-database/user/text()";
+
+    public static final String XPATH_PASSWORD =
+        "/artifact-database/seddb-database/password/text()";
+
+    public static final String XPATH_DIALECT =
+        "/artifact-database/seddb-database/dialect/text()";
+
+    public static final String XPATH_DRIVER =
+        "/artifact-database/seddb-database/driver/text()";
+
+    public static final String XPATH_URL =
+        "/artifact-database/seddb-database/url/text()";
+
+    public static final String DEFAULT_USER =
+        System.getProperty("flys.seddb.user", "seddb");
+
+    public static final String DEFAULT_PASSWORD =
+        System.getProperty("flys.seddb.password", "seddb");
+
+    public static final String DEFAULT_DIALECT =
+        System.getProperty(
+            "flys.seddb.dialect",
+            "org.hibernate.dialect.PostgreSQLDialect");
+
+    public static final String DEFAULT_DRIVER =
+        System.getProperty(
+            "flys.seddb.driver",
+            "org.postgresql.Driver");
+
+    public static final String DEFAULT_URL =
+        System.getProperty(
+            "flys.seddb.url",
+            "jdbc:postgresql://localhost:5432/seddb");
+
+    public static final Class [] CLASSES = {
+        BezugspegelgewId.class,
+        Bezugspegelgew.class,
+        Bezugspegel.class,
+        Bild.class,
+        Gewaesser.class,
+        Gfaenger.class,
+        GlotlinksId.class,
+        Glotlinks.class,
+        Glotrechte.class,
+        GprobeId.class,
+        Gprobe.class,
+        Gsiebsatz.class,
+        Gsiebung.class,
+        GsiebungsiebId.class,
+        Gsiebungsieb.class,
+        HpeilpunktId.class,
+        Hpeilpunkt.class,
+        Hpeilung.class,
+        Messung.class,
+        MessunglotcountId.class,
+        Messunglotcount.class,
+        MessungstaId.class,
+        Messungsta.class,
+        MessunguferbezugId.class,
+        Messunguferbezug.class,
+        MpeilpunktId.class,
+        Mpeilpunkt.class,
+        Mpeilung.class,
+        Probebild.class,
+        Siebanalyse.class,
+        SlotlinksId.class,
+        Slotlinks.class,
+        Slotrechte.class,
+        Sohlprobe.class,
+        Sohltest.class,
+        SprobeId.class,
+        Sprobe.class,
+        Ssiebung.class,
+        SsiebungsiebId.class,
+        Ssiebungsieb.class,
+        StationgewId.class,
+        Stationgew.class,
+        Station.class,
+        TmpGloChanged.class,
+        TmpMesAchanged.class,
+        TmpMesGchanged.class,
+        TmpMesQchanged.class,
+        TmpMesSchanged.class,
+        Zzarchiv.class,
+        Zzprobenahmeart.class,
+        Zzsondierungart.class,
+        Zzthema.class
+    };
+
+    private static Credentials instance;
+
+    public SedDBCredentials() {
+    }
+
+    public SedDBCredentials(
+        String user,
+        String password,
+        String dialect,
+        String driver,
+        String url
+    ) {
+        super(user, password, dialect, driver, url, CLASSES);
+    }
+
+    public static synchronized Credentials getInstance() {
+        if (instance == null) {
+            String user =
+                Config.getStringXPath(XPATH_USER, DEFAULT_USER);
+            String password =
+                Config.getStringXPath(XPATH_PASSWORD, DEFAULT_PASSWORD);
+            String dialect =
+                Config.getStringXPath(XPATH_DIALECT, DEFAULT_DIALECT);
+            String driver =
+                Config.getStringXPath(XPATH_DRIVER, DEFAULT_DRIVER);
+            String url =
+                Config.getStringXPath(XPATH_URL, DEFAULT_URL);
+
+            instance = new SedDBCredentials(
+                user, password, dialect, driver, url);
+        }
+        return instance;
+    }
+
+    public static Credentials getDefault() {
+        return new SedDBCredentials(
+            DEFAULT_USER,
+            DEFAULT_PASSWORD,
+            DEFAULT_DIALECT,
+            DEFAULT_DRIVER,
+            DEFAULT_URL);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org