Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java @ 2847:dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
flys-backend/trunk@4290 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 24 Apr 2012 13:28:02 +0000 |
parents | 0d55b7722fae |
children | b6f94c5db89e |
rev | line source |
---|---|
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.backend; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifacts.common.utils.Config; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
2337
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
5 import java.lang.management.ManagementFactory; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 import java.util.Properties; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 |
2337
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
8 import javax.management.InstanceAlreadyExistsException; |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
9 import javax.management.MalformedObjectNameException; |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
10 import javax.management.MBeanRegistrationException; |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
11 import javax.management.MBeanServer; |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
12 import javax.management.NotCompliantMBeanException; |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
13 import javax.management.ObjectName; |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
14 |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import org.hibernate.SessionFactory; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
2361
e9b0fd1de89d
Made flys-backend compatible with oracle spatial.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2360
diff
changeset
|
17 import org.hibernate.impl.SessionFactoryImpl; |
e9b0fd1de89d
Made flys-backend compatible with oracle spatial.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2360
diff
changeset
|
18 |
2337
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
19 import org.hibernate.jmx.StatisticsService; |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
20 |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 import org.hibernate.cfg.Configuration; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 import org.hibernate.cfg.Environment; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.model.Annotation; |
763
8076f6a689d0
First part of flys/issue18
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
760
diff
changeset
|
25 import de.intevation.flys.model.AnnotationType; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.model.Attribute; |
2810
04eeb45df27b
Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2809
diff
changeset
|
27 import de.intevation.flys.model.BedHeightEpoch; |
04eeb45df27b
Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2809
diff
changeset
|
28 import de.intevation.flys.model.BedHeightEpochValue; |
2809
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
29 import de.intevation.flys.model.BedHeightSingle; |
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
30 import de.intevation.flys.model.BedHeightSingleValue; |
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
31 import de.intevation.flys.model.BedHeightType; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
32 import de.intevation.flys.model.Building; |
2364
efe19e669092
Added and registered a model Catchment for 'catchment' relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2363
diff
changeset
|
33 import de.intevation.flys.model.Catchment; |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1193
diff
changeset
|
34 import de.intevation.flys.model.CrossSection; |
1203
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1195
diff
changeset
|
35 import de.intevation.flys.model.CrossSectionLine; |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1193
diff
changeset
|
36 import de.intevation.flys.model.CrossSectionPoint; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
37 import de.intevation.flys.model.CrossSectionTrack; |
2817
8979f2294af9
Finished parsing MINFO specific sediment density.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2810
diff
changeset
|
38 import de.intevation.flys.model.Depth; |
1236
324cb486db9f
Added relation and hibernate classes for DGMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1232
diff
changeset
|
39 import de.intevation.flys.model.DGM; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 import de.intevation.flys.model.DischargeTable; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 import de.intevation.flys.model.DischargeTableValue; |
2825
a948366d8ac5
Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2818
diff
changeset
|
42 import de.intevation.flys.model.DischargeZone; |
760
c8a2fbc612be
Register the backend model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
464
diff
changeset
|
43 import de.intevation.flys.model.Edge; |
2809
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
44 import de.intevation.flys.model.ElevationModel; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
45 import de.intevation.flys.model.Fixpoint; |
2799
501f00e355eb
Added model class for 'floodmaps'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2364
diff
changeset
|
46 import de.intevation.flys.model.Floodmaps; |
1237
774dff3ee546
Added relation and hibernate classes for floodplains (german 'Talaue').
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1236
diff
changeset
|
47 import de.intevation.flys.model.Floodplain; |
2832
ac5bd90697c1
Added new parser for flow velocity measurements and fixed some smaller bugs while importing flow velocity data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2825
diff
changeset
|
48 import de.intevation.flys.model.FlowVelocityMeasurement; |
ac5bd90697c1
Added new parser for flow velocity measurements and fixed some smaller bugs while importing flow velocity data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2825
diff
changeset
|
49 import de.intevation.flys.model.FlowVelocityMeasurementValue; |
2825
a948366d8ac5
Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2818
diff
changeset
|
50 import de.intevation.flys.model.FlowVelocityModel; |
a948366d8ac5
Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2818
diff
changeset
|
51 import de.intevation.flys.model.FlowVelocityModelValue; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 import de.intevation.flys.model.Gauge; |
2837
8b910e3277b0
Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2832
diff
changeset
|
53 import de.intevation.flys.model.GrainFraction; |
2363
a8f408fdf58c
Added model for 'hws' relation and synced postgis with oracle spatial schema.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2362
diff
changeset
|
54 import de.intevation.flys.model.Hws; |
1210
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
55 import de.intevation.flys.model.HYK; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
56 import de.intevation.flys.model.HYKEntry; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
57 import de.intevation.flys.model.HYKFormation; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
58 import de.intevation.flys.model.HYKFlowZoneType; |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
59 import de.intevation.flys.model.HYKFlowZone; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
60 import de.intevation.flys.model.Line; |
2809
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
61 import de.intevation.flys.model.LocationSystem; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 import de.intevation.flys.model.MainValueType; |
2818
25ed1f18fcc4
Improved the MIFNO DB schema for morphological width and added model classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2817
diff
changeset
|
63 import de.intevation.flys.model.MorphologicalWidth; |
25ed1f18fcc4
Improved the MIFNO DB schema for morphological width and added model classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2817
diff
changeset
|
64 import de.intevation.flys.model.MorphologicalWidthValue; |
189
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
179
diff
changeset
|
65 import de.intevation.flys.model.NamedMainValue; |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
179
diff
changeset
|
66 import de.intevation.flys.model.MainValue; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 import de.intevation.flys.model.Position; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 import de.intevation.flys.model.Range; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 import de.intevation.flys.model.River; |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
70 import de.intevation.flys.model.RiverAxis; |
2360
9df06b88c079
Added model class for relation 'river_axes_km'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2346
diff
changeset
|
71 import de.intevation.flys.model.RiverAxisKm; |
2817
8979f2294af9
Finished parsing MINFO specific sediment density.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2810
diff
changeset
|
72 import de.intevation.flys.model.SedimentDensity; |
8979f2294af9
Finished parsing MINFO specific sediment density.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2810
diff
changeset
|
73 import de.intevation.flys.model.SedimentDensityValue; |
2837
8b910e3277b0
Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2832
diff
changeset
|
74 import de.intevation.flys.model.SedimentYield; |
8b910e3277b0
Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2832
diff
changeset
|
75 import de.intevation.flys.model.SedimentYieldValue; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 import de.intevation.flys.model.TimeInterval; |
2346
f834b411ca57
Added db table, model class and importer stuff for units.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2337
diff
changeset
|
77 import de.intevation.flys.model.Unit; |
2842
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2837
diff
changeset
|
78 import de.intevation.flys.model.Waterlevel; |
2847
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2842
diff
changeset
|
79 import de.intevation.flys.model.WaterlevelDifference; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2842
diff
changeset
|
80 import de.intevation.flys.model.WaterlevelDifferenceColumn; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2842
diff
changeset
|
81 import de.intevation.flys.model.WaterlevelDifferenceValue; |
2842
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2837
diff
changeset
|
82 import de.intevation.flys.model.WaterlevelQRange; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2837
diff
changeset
|
83 import de.intevation.flys.model.WaterlevelValue; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 import de.intevation.flys.model.WstColumn; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 import de.intevation.flys.model.WstColumnQRange; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 import de.intevation.flys.model.WstColumnValue; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 import de.intevation.flys.model.Wst; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 import de.intevation.flys.model.WstQRange; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 import org.apache.log4j.Logger; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 public final class SessionFactoryProvider |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 { |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 private static Logger log = Logger.getLogger(SessionFactoryProvider.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 public static final String XPATH_USER = |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 "/artifact-database/backend-database/user/text()"; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 public static final String XPATH_PASSWORD = |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 "/artifact-database/backend-database/password/text()"; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 public static final String XPATH_DIALECT = |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 "/artifact-database/backend-database/dialect/text()"; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 public static final String XPATH_DRIVER = |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 "/artifact-database/backend-database/driver/text()"; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 public static final String XPATH_URL = |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 "/artifact-database/backend-database/url/text()"; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 |
179
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
111 public static final String DEFAULT_USER = |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
112 System.getProperty("flys.backend.user", "flys"); |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
113 |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
114 public static final String DEFAULT_PASSWORD = |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
115 System.getProperty("flys.backend.password", "flys"); |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
116 |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
117 public static final String DEFAULT_DIALECT = |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
118 System.getProperty( |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
119 "flys.backend.dialect", |
1232
3383e042a655
Reverted the default db dialect back PostgreSQL.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1230
diff
changeset
|
120 "org.hibernate.dialect.PostgreSQLDialect"); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 public static final String DEFAULT_DRIVER = |
179
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
123 System.getProperty( |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
124 "flys.backend.driver", |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
125 "org.postgresql.Driver"); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 public static final String DEFAULT_URL = |
179
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
128 System.getProperty( |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
129 "flys.backend.url", |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
130 "jdbc:postgresql://localhost:5432/flys"); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 |
2337
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
132 public static final boolean ENABLE_JMX = |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
133 Boolean.getBoolean("flys.backend.enablejmx"); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
134 |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 private static SessionFactory sessionFactory; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 private SessionFactoryProvider() { |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 } |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 public static synchronized SessionFactory getSessionFactory() { |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 if (sessionFactory == null) { |
178
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
142 String user = |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
143 Config.getStringXPath(XPATH_USER, DEFAULT_USER); |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
144 String password = |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
145 Config.getStringXPath(XPATH_PASSWORD, DEFAULT_PASSWORD); |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
146 String dialect = |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
147 Config.getStringXPath(XPATH_DIALECT, DEFAULT_DIALECT); |
464
d37ccb04ab5d
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
148 String driver = |
178
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
149 Config.getStringXPath(XPATH_DRIVER, DEFAULT_DRIVER); |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
150 String url = |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
151 Config.getStringXPath(XPATH_URL, DEFAULT_URL); |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
152 |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
153 sessionFactory = createSessionFactory( |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
154 user, password, dialect, driver, url); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 } |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 return sessionFactory; |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 } |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 |
179
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
159 public static SessionFactory createSessionFactory() { |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
160 return createSessionFactory( |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
161 DEFAULT_USER, |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
162 DEFAULT_PASSWORD, |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
163 DEFAULT_DIALECT, |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
164 DEFAULT_DRIVER, |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
165 DEFAULT_URL); |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
166 } |
aaac9c291067
Default connection parameters are now overwritable with system properties.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
178
diff
changeset
|
167 |
178
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
168 public static SessionFactory createSessionFactory( |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
169 String user, |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
170 String password, |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
171 String dialect, |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
172 String driver, |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
173 String url |
82bc55666a97
Expose the creation of the SessionFactory to the public to
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
176
diff
changeset
|
174 ) { |
1229
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
175 Configuration cfg = createConfiguration( |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
176 user, password, dialect, driver, url); |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
177 |
2337
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
178 SessionFactory factory = cfg.buildSessionFactory(); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
179 |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
180 if (ENABLE_JMX) { |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
181 registerAsMBean(factory); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
182 } |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
183 else { |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
184 log.info("No JMX support for hibernate."); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
185 } |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
186 |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
187 return factory; |
1229
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
188 } |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
189 |
2337
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
190 |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
191 public static void registerAsMBean(SessionFactory factory) { |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
192 |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
193 StatisticsService statsMBean = new StatisticsService(); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
194 statsMBean.setSessionFactory(factory); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
195 statsMBean.setStatisticsEnabled(true); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
196 |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
197 try { |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
198 MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
199 mbs.registerMBean( |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
200 statsMBean, |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
201 new ObjectName("Hibernate:application=Statistics")); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
202 |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
203 log.info("Enabled JMX support for hibernate."); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
204 } |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
205 catch (MalformedObjectNameException mone) { |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
206 log.warn(mone, mone); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
207 } |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
208 catch (InstanceAlreadyExistsException iaee) { |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
209 log.warn(iaee, iaee); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
210 } |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
211 catch (MBeanRegistrationException mbre) { |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
212 log.warn(mbre, mbre); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
213 } |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
214 catch (NotCompliantMBeanException ncmbe) { |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
215 log.warn(ncmbe, ncmbe); |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
216 } |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
217 } |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
218 |
52d712cd2384
Added code and a system property 'flys.backend.enablejmx=true' to enable JMX support for hibernate.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1237
diff
changeset
|
219 |
1229
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
220 public static Configuration createConfiguration() { |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
221 return createConfiguration( |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
222 DEFAULT_USER, |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
223 DEFAULT_PASSWORD, |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
224 DEFAULT_DIALECT, |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
225 DEFAULT_DRIVER, |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
226 DEFAULT_URL); |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
227 } |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
228 |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
229 public static Configuration createConfiguration( |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
230 String user, |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
231 String password, |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
232 String dialect, |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
233 String driver, |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
234 String url |
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
235 ) { |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
236 Configuration cfg = new Configuration(); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
237 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
238 // TODO: Use package reflection here. |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
239 cfg.addAnnotatedClass(Annotation.class); |
763
8076f6a689d0
First part of flys/issue18
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
760
diff
changeset
|
240 cfg.addAnnotatedClass(AnnotationType.class); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
241 cfg.addAnnotatedClass(Attribute.class); |
2810
04eeb45df27b
Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2809
diff
changeset
|
242 cfg.addAnnotatedClass(BedHeightEpoch.class); |
04eeb45df27b
Implemented model classes and importer classes for bed height epochs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2809
diff
changeset
|
243 cfg.addAnnotatedClass(BedHeightEpochValue.class); |
2809
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
244 cfg.addAnnotatedClass(BedHeightSingle.class); |
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
245 cfg.addAnnotatedClass(BedHeightSingleValue.class); |
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
246 cfg.addAnnotatedClass(BedHeightType.class); |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
247 cfg.addAnnotatedClass(Building.class); |
2364
efe19e669092
Added and registered a model Catchment for 'catchment' relation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2363
diff
changeset
|
248 cfg.addAnnotatedClass(Catchment.class); |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1193
diff
changeset
|
249 cfg.addAnnotatedClass(CrossSection.class); |
1203
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1195
diff
changeset
|
250 cfg.addAnnotatedClass(CrossSectionLine.class); |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1193
diff
changeset
|
251 cfg.addAnnotatedClass(CrossSectionPoint.class); |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
252 cfg.addAnnotatedClass(CrossSectionTrack.class); |
2817
8979f2294af9
Finished parsing MINFO specific sediment density.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2810
diff
changeset
|
253 cfg.addAnnotatedClass(Depth.class); |
1236
324cb486db9f
Added relation and hibernate classes for DGMs.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1232
diff
changeset
|
254 cfg.addAnnotatedClass(DGM.class); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
255 cfg.addAnnotatedClass(DischargeTable.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
256 cfg.addAnnotatedClass(DischargeTableValue.class); |
2825
a948366d8ac5
Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2818
diff
changeset
|
257 cfg.addAnnotatedClass(DischargeZone.class); |
760
c8a2fbc612be
Register the backend model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
464
diff
changeset
|
258 cfg.addAnnotatedClass(Edge.class); |
2809
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
259 cfg.addAnnotatedClass(ElevationModel.class); |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
260 cfg.addAnnotatedClass(Fixpoint.class); |
1237
774dff3ee546
Added relation and hibernate classes for floodplains (german 'Talaue').
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1236
diff
changeset
|
261 cfg.addAnnotatedClass(Floodplain.class); |
2802
3fdac7b43dac
Registered missing Floodmaps and set its Geometry type to Geometry.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2799
diff
changeset
|
262 cfg.addAnnotatedClass(Floodmaps.class); |
2832
ac5bd90697c1
Added new parser for flow velocity measurements and fixed some smaller bugs while importing flow velocity data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2825
diff
changeset
|
263 cfg.addAnnotatedClass(FlowVelocityMeasurement.class); |
ac5bd90697c1
Added new parser for flow velocity measurements and fixed some smaller bugs while importing flow velocity data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2825
diff
changeset
|
264 cfg.addAnnotatedClass(FlowVelocityMeasurementValue.class); |
2825
a948366d8ac5
Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2818
diff
changeset
|
265 cfg.addAnnotatedClass(FlowVelocityModel.class); |
a948366d8ac5
Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2818
diff
changeset
|
266 cfg.addAnnotatedClass(FlowVelocityModelValue.class); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
267 cfg.addAnnotatedClass(Gauge.class); |
2837
8b910e3277b0
Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2832
diff
changeset
|
268 cfg.addAnnotatedClass(GrainFraction.class); |
2363
a8f408fdf58c
Added model for 'hws' relation and synced postgis with oracle spatial schema.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2362
diff
changeset
|
269 cfg.addAnnotatedClass(Hws.class); |
1210
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
270 cfg.addAnnotatedClass(HYK.class); |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
271 cfg.addAnnotatedClass(HYKEntry.class); |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
272 cfg.addAnnotatedClass(HYKFormation.class); |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
273 cfg.addAnnotatedClass(HYKFlowZoneType.class); |
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
274 cfg.addAnnotatedClass(HYKFlowZone.class); |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
275 cfg.addAnnotatedClass(Line.class); |
2809
f283212966e8
Finished work on MINFO bed heights (single).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2802
diff
changeset
|
276 cfg.addAnnotatedClass(LocationSystem.class); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
277 cfg.addAnnotatedClass(MainValueType.class); |
2818
25ed1f18fcc4
Improved the MIFNO DB schema for morphological width and added model classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2817
diff
changeset
|
278 cfg.addAnnotatedClass(MorphologicalWidth.class); |
25ed1f18fcc4
Improved the MIFNO DB schema for morphological width and added model classes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2817
diff
changeset
|
279 cfg.addAnnotatedClass(MorphologicalWidthValue.class); |
189
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
179
diff
changeset
|
280 cfg.addAnnotatedClass(NamedMainValue.class); |
bc3747a371cc
First part of parsing main values.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
179
diff
changeset
|
281 cfg.addAnnotatedClass(MainValue.class); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
282 cfg.addAnnotatedClass(Position.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
283 cfg.addAnnotatedClass(Range.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
284 cfg.addAnnotatedClass(River.class); |
1230
e2deda3b77a7
Introduced support for FLYS spatial data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1229
diff
changeset
|
285 cfg.addAnnotatedClass(RiverAxis.class); |
2360
9df06b88c079
Added model class for relation 'river_axes_km'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2346
diff
changeset
|
286 cfg.addAnnotatedClass(RiverAxisKm.class); |
2817
8979f2294af9
Finished parsing MINFO specific sediment density.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2810
diff
changeset
|
287 cfg.addAnnotatedClass(SedimentDensity.class); |
8979f2294af9
Finished parsing MINFO specific sediment density.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2810
diff
changeset
|
288 cfg.addAnnotatedClass(SedimentDensityValue.class); |
2837
8b910e3277b0
Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2832
diff
changeset
|
289 cfg.addAnnotatedClass(SedimentYield.class); |
8b910e3277b0
Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2832
diff
changeset
|
290 cfg.addAnnotatedClass(SedimentYieldValue.class); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
291 cfg.addAnnotatedClass(TimeInterval.class); |
2346
f834b411ca57
Added db table, model class and importer stuff for units.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2337
diff
changeset
|
292 cfg.addAnnotatedClass(Unit.class); |
2842
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2837
diff
changeset
|
293 cfg.addAnnotatedClass(Waterlevel.class); |
2847
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2842
diff
changeset
|
294 cfg.addAnnotatedClass(WaterlevelDifference.class); |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2842
diff
changeset
|
295 cfg.addAnnotatedClass(WaterlevelDifferenceColumn.class); |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2842
diff
changeset
|
296 cfg.addAnnotatedClass(WaterlevelDifferenceValue.class); |
2842
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2837
diff
changeset
|
297 cfg.addAnnotatedClass(WaterlevelQRange.class); |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2837
diff
changeset
|
298 cfg.addAnnotatedClass(WaterlevelValue.class); |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
299 cfg.addAnnotatedClass(WstColumn.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
300 cfg.addAnnotatedClass(WstColumnQRange.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
301 cfg.addAnnotatedClass(WstColumnValue.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
302 cfg.addAnnotatedClass(Wst.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
303 cfg.addAnnotatedClass(WstQRange.class); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
304 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
305 if (log.isDebugEnabled()) { |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
306 log.debug("user: " + user); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
307 log.debug("dialect: " + dialect); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
308 log.debug("driver: " + driver); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
309 log.debug("url: " + url); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
310 } |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
311 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
312 Properties props = new Properties(); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
313 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
314 // We rely on our own connection pool |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
315 props.setProperty( |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
316 "hibernate.connection.provider_class", |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
317 "org.hibernate.connection.DBCPConnectionProvider"); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
318 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
319 props.setProperty(Environment.DIALECT, dialect); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
320 props.setProperty(Environment.USER, user); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
321 props.setProperty(Environment.PASS, password); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
322 props.setProperty(Environment.DRIVER, driver); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
323 props.setProperty(Environment.URL, url); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
324 |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
325 cfg.mergeProperties(props); |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
326 |
1229
8b12b338a3f6
Re-enabled Hibernate schema dumps.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1210
diff
changeset
|
327 return cfg; |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
328 } |
2361
e9b0fd1de89d
Made flys-backend compatible with oracle spatial.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2360
diff
changeset
|
329 |
e9b0fd1de89d
Made flys-backend compatible with oracle spatial.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2360
diff
changeset
|
330 |
2362
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
331 public static String getProperty(SessionFactoryImpl factory, String key) { |
2361
e9b0fd1de89d
Made flys-backend compatible with oracle spatial.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2360
diff
changeset
|
332 Properties props = factory.getProperties(); |
2362
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
333 return props.getProperty(key); |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
334 } |
2361
e9b0fd1de89d
Made flys-backend compatible with oracle spatial.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2360
diff
changeset
|
335 |
2362
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
336 public static String getUser(SessionFactoryImpl factory) { |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
337 return getProperty(factory, Environment.USER); |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
338 } |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
339 |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
340 |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
341 public static String getPass(SessionFactoryImpl factory) { |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
342 return getProperty(factory, Environment.PASS); |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
343 } |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
344 |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
345 |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
346 public static String getURL(SessionFactoryImpl factory) { |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
347 return getProperty(factory, Environment.URL); |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
348 } |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
349 |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
350 |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
351 public static String getDriver(SessionFactoryImpl factory) { |
2649151c9500
Added some functions that return information about the db connection used by the current database session.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2361
diff
changeset
|
352 return getProperty(factory, Environment.DRIVER); |
2361
e9b0fd1de89d
Made flys-backend compatible with oracle spatial.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2360
diff
changeset
|
353 } |
176
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
354 } |
3035d861a576
SessionFactoryProvider for access to the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
355 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |