comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java @ 130:e4eacd613356

Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken ChangeLog wird nachgereicht da SubversionClientincompatiblitäten vorhanden sind. geo-backend/trunk@7 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 02 Sep 2009 15:15:52 +0000
parents
children 5a583cff97ea
comparison
equal deleted inserted replaced
129:110e3ac1b7d2 130:e4eacd613356
1 /**
2 *
3 */
4 package de.intevation.gnv.geobackend.base.connectionpool;
5
6 import java.util.Properties;
7
8 import org.apache.log4j.Logger;
9
10 import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEConnectionPool;
11
12 /**
13 * Factoryimplementation for the Interface ConnectionPool.
14 * This factory delivers Instances of the Interface ConnectionPool.
15 * @author Tim Englich <tim.englich@intevation.de>
16 */
17 public class ConnectionPoolFactory {
18
19
20 /**
21 * the logger, used to log exceptions and additonaly information
22 */
23 private static Logger log = Logger.getLogger(ConnectionPoolFactory.class);
24
25
26 /**
27 * The singleton Instance of this Factory.
28 */
29 private static ConnectionPoolFactory instance = null;
30
31 /**
32 * The ConnectionPool providing the Connections to the DatabaseBackends
33 */
34 private ConnectionPool connectionPool = null;
35
36 /**
37 * Basic-Constructor of this Class
38 */
39 private ConnectionPoolFactory() {
40 super();
41 }
42
43
44 /**
45 * This Method provides an singleton Instance of this Class.
46 * @return an singleton Instance of this Class
47 */
48 public static ConnectionPoolFactory getInstance(){
49 if (instance == null){
50 instance = new ConnectionPoolFactory();
51 }
52 return instance;
53 }
54
55
56 /**
57 * Getting the ConnectionPool
58 * @return the ConnectionPool
59 */
60 public ConnectionPool getConnectionPool(){
61 return this.connectionPool;
62 }
63
64
65 /**
66 * Initializes the ConnectionPool.
67 * Should only be called once on system startup
68 * @param properties the Properties for the Individual Configuration of the ConnectionPool
69 */
70 public void initializeConnectionPool(Properties properties){
71 log.debug("ConnectionPoolFactory.initializeConnectionPool");
72 if (this.connectionPool == null){
73 //TODO: Hier könnte anhand eines Flags die Instanz des Connectionpools umgeschaltet werden.
74 this.connectionPool = new ArcSDEConnectionPool();
75 this.connectionPool.initialize(properties);
76 }else{
77 log.warn("ConnectionPool already initialized");
78 }
79 }
80
81 /**
82 * Checks if the ConnectionPool has already been initialized.
83 * @return true if the ConnectionPool is initialized.
84 */
85 public boolean isInitialized(){
86 return this.connectionPool != null;
87 }
88 }

http://dive4elements.wald.intevation.org