Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
3468:f37e7e8907cb | 3471:e4250c6e1538 |
---|---|
1 package de.intevation.flys.backend; | |
2 | |
3 import de.intevation.artifacts.common.utils.Config; | |
4 | |
5 import de.intevation.seddb.model.Bezugspegel; | |
6 import de.intevation.seddb.model.Bezugspegelgew; | |
7 import de.intevation.seddb.model.BezugspegelgewId; | |
8 import de.intevation.seddb.model.Bild; | |
9 import de.intevation.seddb.model.Gewaesser; | |
10 import de.intevation.seddb.model.Gfaenger; | |
11 import de.intevation.seddb.model.Glotlinks; | |
12 import de.intevation.seddb.model.GlotlinksId; | |
13 import de.intevation.seddb.model.Glotrechte; | |
14 import de.intevation.seddb.model.Gprobe; | |
15 import de.intevation.seddb.model.GprobeId; | |
16 import de.intevation.seddb.model.Gsiebsatz; | |
17 import de.intevation.seddb.model.Gsiebung; | |
18 import de.intevation.seddb.model.Gsiebungsieb; | |
19 import de.intevation.seddb.model.GsiebungsiebId; | |
20 import de.intevation.seddb.model.Hpeilpunkt; | |
21 import de.intevation.seddb.model.HpeilpunktId; | |
22 import de.intevation.seddb.model.Hpeilung; | |
23 import de.intevation.seddb.model.Messung; | |
24 import de.intevation.seddb.model.Messunglotcount; | |
25 import de.intevation.seddb.model.MessunglotcountId; | |
26 import de.intevation.seddb.model.Messungsta; | |
27 import de.intevation.seddb.model.MessungstaId; | |
28 import de.intevation.seddb.model.Messunguferbezug; | |
29 import de.intevation.seddb.model.MessunguferbezugId; | |
30 import de.intevation.seddb.model.Mpeilpunkt; | |
31 import de.intevation.seddb.model.MpeilpunktId; | |
32 import de.intevation.seddb.model.Mpeilung; | |
33 import de.intevation.seddb.model.Probebild; | |
34 import de.intevation.seddb.model.Siebanalyse; | |
35 import de.intevation.seddb.model.Slotlinks; | |
36 import de.intevation.seddb.model.SlotlinksId; | |
37 import de.intevation.seddb.model.Slotrechte; | |
38 import de.intevation.seddb.model.Sohlprobe; | |
39 import de.intevation.seddb.model.Sohltest; | |
40 import de.intevation.seddb.model.Sprobe; | |
41 import de.intevation.seddb.model.SprobeId; | |
42 import de.intevation.seddb.model.Ssiebung; | |
43 import de.intevation.seddb.model.Ssiebungsieb; | |
44 import de.intevation.seddb.model.SsiebungsiebId; | |
45 import de.intevation.seddb.model.Station; | |
46 import de.intevation.seddb.model.Stationgew; | |
47 import de.intevation.seddb.model.StationgewId; | |
48 import de.intevation.seddb.model.TmpGloChanged; | |
49 import de.intevation.seddb.model.TmpMesAchanged; | |
50 import de.intevation.seddb.model.TmpMesGchanged; | |
51 import de.intevation.seddb.model.TmpMesQchanged; | |
52 import de.intevation.seddb.model.TmpMesSchanged; | |
53 import de.intevation.seddb.model.Zzarchiv; | |
54 import de.intevation.seddb.model.Zzprobenahmeart; | |
55 import de.intevation.seddb.model.Zzsondierungart; | |
56 import de.intevation.seddb.model.Zzthema; | |
57 | |
58 public class SedDBCredentials | |
59 extends Credentials | |
60 { | |
61 public static final String XPATH_USER = | |
62 "/artifact-database/seddb-database/user/text()"; | |
63 | |
64 public static final String XPATH_PASSWORD = | |
65 "/artifact-database/seddb-database/password/text()"; | |
66 | |
67 public static final String XPATH_DIALECT = | |
68 "/artifact-database/seddb-database/dialect/text()"; | |
69 | |
70 public static final String XPATH_DRIVER = | |
71 "/artifact-database/seddb-database/driver/text()"; | |
72 | |
73 public static final String XPATH_URL = | |
74 "/artifact-database/seddb-database/url/text()"; | |
75 | |
76 public static final String DEFAULT_USER = | |
77 System.getProperty("flys.seddb.user", "seddb"); | |
78 | |
79 public static final String DEFAULT_PASSWORD = | |
80 System.getProperty("flys.seddb.password", "seddb"); | |
81 | |
82 public static final String DEFAULT_DIALECT = | |
83 System.getProperty( | |
84 "flys.seddb.dialect", | |
85 "org.hibernate.dialect.PostgreSQLDialect"); | |
86 | |
87 public static final String DEFAULT_DRIVER = | |
88 System.getProperty( | |
89 "flys.seddb.driver", | |
90 "org.postgresql.Driver"); | |
91 | |
92 public static final String DEFAULT_URL = | |
93 System.getProperty( | |
94 "flys.seddb.url", | |
95 "jdbc:postgresql://localhost:5432/seddb"); | |
96 | |
97 public static final Class [] CLASSES = { | |
98 BezugspegelgewId.class, | |
99 Bezugspegelgew.class, | |
100 Bezugspegel.class, | |
101 Bild.class, | |
102 Gewaesser.class, | |
103 Gfaenger.class, | |
104 GlotlinksId.class, | |
105 Glotlinks.class, | |
106 Glotrechte.class, | |
107 GprobeId.class, | |
108 Gprobe.class, | |
109 Gsiebsatz.class, | |
110 Gsiebung.class, | |
111 GsiebungsiebId.class, | |
112 Gsiebungsieb.class, | |
113 HpeilpunktId.class, | |
114 Hpeilpunkt.class, | |
115 Hpeilung.class, | |
116 Messung.class, | |
117 MessunglotcountId.class, | |
118 Messunglotcount.class, | |
119 MessungstaId.class, | |
120 Messungsta.class, | |
121 MessunguferbezugId.class, | |
122 Messunguferbezug.class, | |
123 MpeilpunktId.class, | |
124 Mpeilpunkt.class, | |
125 Mpeilung.class, | |
126 Probebild.class, | |
127 Siebanalyse.class, | |
128 SlotlinksId.class, | |
129 Slotlinks.class, | |
130 Slotrechte.class, | |
131 Sohlprobe.class, | |
132 Sohltest.class, | |
133 SprobeId.class, | |
134 Sprobe.class, | |
135 Ssiebung.class, | |
136 SsiebungsiebId.class, | |
137 Ssiebungsieb.class, | |
138 StationgewId.class, | |
139 Stationgew.class, | |
140 Station.class, | |
141 TmpGloChanged.class, | |
142 TmpMesAchanged.class, | |
143 TmpMesGchanged.class, | |
144 TmpMesQchanged.class, | |
145 TmpMesSchanged.class, | |
146 Zzarchiv.class, | |
147 Zzprobenahmeart.class, | |
148 Zzsondierungart.class, | |
149 Zzthema.class | |
150 }; | |
151 | |
152 private static Credentials instance; | |
153 | |
154 public SedDBCredentials() { | |
155 } | |
156 | |
157 public SedDBCredentials( | |
158 String user, | |
159 String password, | |
160 String dialect, | |
161 String driver, | |
162 String url | |
163 ) { | |
164 super(user, password, dialect, driver, url, CLASSES); | |
165 } | |
166 | |
167 public static synchronized Credentials getInstance() { | |
168 if (instance == null) { | |
169 String user = | |
170 Config.getStringXPath(XPATH_USER, DEFAULT_USER); | |
171 String password = | |
172 Config.getStringXPath(XPATH_PASSWORD, DEFAULT_PASSWORD); | |
173 String dialect = | |
174 Config.getStringXPath(XPATH_DIALECT, DEFAULT_DIALECT); | |
175 String driver = | |
176 Config.getStringXPath(XPATH_DRIVER, DEFAULT_DRIVER); | |
177 String url = | |
178 Config.getStringXPath(XPATH_URL, DEFAULT_URL); | |
179 | |
180 instance = new SedDBCredentials( | |
181 user, password, dialect, driver, url); | |
182 } | |
183 return instance; | |
184 } | |
185 | |
186 public static Credentials getDefault() { | |
187 return new SedDBCredentials( | |
188 DEFAULT_USER, | |
189 DEFAULT_PASSWORD, | |
190 DEFAULT_DIALECT, | |
191 DEFAULT_DRIVER, | |
192 DEFAULT_URL); | |
193 } | |
194 } | |
195 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |