Mercurial > dive4elements > gnv-client
comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java @ 132:5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
geo-backend/trunk@12 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 04 Sep 2009 08:11:30 +0000 |
parents | |
children | 3cbf11c67fdc |
comparison
equal
deleted
inserted
replaced
131:d8ff739b9f3b | 132:5a583cff97ea |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.geobackend.base.query.container; | |
5 | |
6 import java.util.Properties; | |
7 | |
8 import org.apache.log4j.Logger; | |
9 | |
10 import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; | |
11 | |
12 /** | |
13 * @author Tim Englich <tim.englich@intevation.de> | |
14 * | |
15 */ | |
16 public class QueryContainerFactory { | |
17 | |
18 /** | |
19 * the logger, used to log exceptions and additonaly information | |
20 */ | |
21 private static Logger log = Logger.getLogger(QueryContainerFactory.class); | |
22 | |
23 | |
24 /** | |
25 * The singleton Instance of this Factory. | |
26 */ | |
27 private static QueryContainerFactory instance = null; | |
28 | |
29 /** | |
30 * The ConnectionPool providing the Connections to the DatabaseBackends | |
31 */ | |
32 private QueryContainer queryContainer = null; | |
33 | |
34 /** | |
35 * Basic-Constructor of this Class | |
36 */ | |
37 private QueryContainerFactory() { | |
38 super(); | |
39 } | |
40 | |
41 /** | |
42 * This Method provides an singleton Instance of this Class. | |
43 * @return an singleton Instance of this Class | |
44 */ | |
45 public static QueryContainerFactory getInstance(){ | |
46 if (instance == null){ | |
47 instance = new QueryContainerFactory(); | |
48 } | |
49 return instance; | |
50 } | |
51 | |
52 | |
53 /** | |
54 * Getting the QueryContainer | |
55 * @return the QueryContainer | |
56 */ | |
57 public QueryContainer getQueryContainer(){ | |
58 return this.queryContainer; | |
59 } | |
60 | |
61 /** | |
62 * Initializes the QueryContainer. | |
63 * Should only be called once on system startup | |
64 * @param properties the Properties for the Individual Configuration of the QueryContainerbb | |
65 * @throws QueryContainerException | |
66 */ | |
67 public synchronized void initializeQueryContainer(Properties properties) throws QueryContainerException{ | |
68 log.debug("ConnectionPoolFactory.initializeConnectionPool"); | |
69 if (this.queryContainer == null){ | |
70 this.queryContainer = new DefaultQueryContainer(); | |
71 this.queryContainer.initialize(properties); | |
72 }else{ | |
73 log.warn("ConnectionPool already initialized"); | |
74 } | |
75 } | |
76 | |
77 /** | |
78 * Checks if the QueryContainer has already been initialized. | |
79 * @return true if the QueryContainer is initialized. | |
80 */ | |
81 public boolean isInitialized(){ | |
82 return this.queryContainer != null; | |
83 } | |
84 } |