Mercurial > dive4elements > gnv-client
annotate geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java @ 888:65dd801fbee6
Added package description with text 'DOCUMENT ME!'.
geo-backend/trunk@862 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 29 Mar 2010 10:37:04 +0000 |
parents | b757def3ff55 |
children | ebeb56428409 |
rev | line source |
---|---|
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.geobackend.base.connectionpool; |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 |
886
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
3 import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEConnectionPool; |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
4 |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 import java.util.Properties; |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 import org.apache.log4j.Logger; |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 /** |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 * Factoryimplementation for the Interface ConnectionPool. |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 * This factory delivers Instances of the Interface ConnectionPool. |
887
b757def3ff55
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
886
diff
changeset
|
12 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 */ |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 public class ConnectionPoolFactory { |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
16 /** |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 * the logger, used to log exceptions and additonaly information |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 */ |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 private static Logger log = Logger.getLogger(ConnectionPoolFactory.class); |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
20 |
885
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
884
diff
changeset
|
21 |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 /** |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 * The singleton Instance of this Factory. |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 */ |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
25 private static ConnectionPoolFactory instance = null; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
26 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
27 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
28 * The ConnectionPool providing the Connections to the DatabaseBackends |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
29 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
30 private ConnectionPool connectionPool = null; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
31 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
32 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
33 * Basic-Constructor of this Class |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
34 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
35 private ConnectionPoolFactory() { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
36 super(); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
37 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
38 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
39 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
40 * This Method provides an singleton Instance of this Class. |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
41 * @return an singleton Instance of this Class |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
42 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
43 public static ConnectionPoolFactory getInstance(){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
44 if (instance == null){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
45 instance = new ConnectionPoolFactory(); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
46 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
47 return instance; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
48 } |
884
12f88239fb33
Updated Javadocs to the Listed Classes.
Tim Englich <tim.englich@intevation.de>
parents:
546
diff
changeset
|
49 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
50 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
51 * Getting the ConnectionPool |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
52 * @return the ConnectionPool |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
53 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
54 public ConnectionPool getConnectionPool(){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
55 return this.connectionPool; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
56 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
57 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
58 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
59 * Initializes the ConnectionPool. |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
60 * Should only be called once on system startup |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
61 * @param properties the Properties for the Individual Configuration of the ConnectionPool |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
62 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
63 public void initializeConnectionPool(Properties properties){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
64 log.debug("ConnectionPoolFactory.initializeConnectionPool"); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
65 if (this.connectionPool == null){ |
546
210716612c30
Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
Tim Englich <tim.englich@intevation.de>
parents:
132
diff
changeset
|
66 //TODO: Here it might be possible to switch the ConnectionPoolInstance using a FLAG. |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
67 this.connectionPool = new ArcSDEConnectionPool(); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
68 this.connectionPool.initialize(properties); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
69 }else{ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
70 log.warn("ConnectionPool already initialized"); |
885
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
884
diff
changeset
|
71 } |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
72 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
73 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
74 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
75 * Checks if the ConnectionPool has already been initialized. |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
76 * @return true if the ConnectionPool is initialized. |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
77 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
78 public boolean isInitialized(){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
79 return this.connectionPool != null; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
130
diff
changeset
|
80 } |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 } |