Mercurial > dive4elements > gnv-client
annotate geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java @ 1145:dfe1ac687c7f tip
added tags
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:16:15 +0200 |
parents | 81f0a5e66d71 |
children |
rev | line source |
---|---|
1127
ebeb56428409
Added license headers and license file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1123
diff
changeset
|
1 /* |
ebeb56428409
Added license headers and license file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1123
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
ebeb56428409
Added license headers and license file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1123
diff
changeset
|
3 * |
ebeb56428409
Added license headers and license file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1123
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
ebeb56428409
Added license headers and license file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1123
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
ebeb56428409
Added license headers and license file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1123
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
ebeb56428409
Added license headers and license file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1123
diff
changeset
|
7 */ |
ebeb56428409
Added license headers and license file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1123
diff
changeset
|
8 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.gnv.geobackend.base.query; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 |
886
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
11 import de.intevation.gnv.geobackend.base.Result; |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
12 |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
13 import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool; |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
14 import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory; |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
15 |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
16 import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
17 |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
18 import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory; |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
19 |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
20 import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException; |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
21 |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
22 import de.intevation.gnv.geobackend.base.query.exception.QueryException; |
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
23 |
1123
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
24 import de.intevation.gnv.geobackend.sde.datasources.Uncacheable; |
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
25 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 import java.sql.Connection; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
27 import java.sql.ResultSet; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 import java.sql.SQLException; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 import java.sql.Statement; |
886
8b442223741c
Ordered imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
885
diff
changeset
|
30 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 import java.util.Collection; |
1120
d387a97807a3
Added an INFO log statement displaying the execution time of a database query.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
887
diff
changeset
|
32 import java.util.Date; |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 import org.apache.log4j.Logger; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 * This is an Standard Implementation of the Interface QueryExecutor. |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 * It fetchs the Query from the Querycontainer an put the Filtervalues into the Query. |
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
|
39 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 * |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 public class DefaultQueryExceutor extends QueryExecutorBase{ |
885
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
541
diff
changeset
|
43 |
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
541
diff
changeset
|
44 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
45 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 * the logger, used to log exceptions and additonaly information |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 private static Logger log = Logger.getLogger(DefaultQueryExceutor.class); |
885
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
541
diff
changeset
|
49 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 * The ConnectionID identifing the Connection to use executing the Query. |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 private String connectionID = "N/N"; |
885
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
541
diff
changeset
|
54 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
55 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 * Constructor |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 public DefaultQueryExceutor() { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 super(); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 /** |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 * @see de.intevation.gnv.geobackend.base.query.QueryExecutor#executeQuery(java.lang.String, java.lang.String[]) |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 */ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 public Collection<Result> executeQuery(String queryID, String[] filter) throws QueryException { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 Collection<Result> returnValue = null; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 try { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 String queryString = QueryContainerFactory.getInstance().getQueryContainer().getQuery(queryID); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 if (queryString != null){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 if (filter != null && filter.length > 0){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 //Insert the Filtervalues into the QueryString |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 queryString = super.setFilterValues(queryString, filter); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 } |
885
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
541
diff
changeset
|
74 |
541
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
75 if (log.isDebugEnabled()) { |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
76 log.debug("############ QUERY ##################"); |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
77 log.debug(queryString); |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
78 log.debug("#######################################"); |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
79 } |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
80 |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
81 returnValue = cachedResults(queryString); |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
82 |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
83 if (returnValue != null) { |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
84 return returnValue; |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
85 } |
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
86 |
1123
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
87 boolean cacheable = true; |
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
88 Connection connection = null; |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool(); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 try { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 // Submit the Query |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 connection = connectionPool.getConnection(this.connectionID); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
93 if (connection != null){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
94 Statement stmt = connection.createStatement(); |
1120
d387a97807a3
Added an INFO log statement displaying the execution time of a database query.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
887
diff
changeset
|
95 Date start = new Date(); |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
96 ResultSet rs = stmt.executeQuery(queryString); |
1120
d387a97807a3
Added an INFO log statement displaying the execution time of a database query.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
887
diff
changeset
|
97 Date end = new Date(); |
d387a97807a3
Added an INFO log statement displaying the execution time of a database query.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
887
diff
changeset
|
98 log.info("-> Database query took " + |
d387a97807a3
Added an INFO log statement displaying the execution time of a database query.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
887
diff
changeset
|
99 (end.getTime() - start.getTime()) + " ms."); |
1123
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
100 |
1128
81f0a5e66d71
Add module for FLYS artifacts
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1127
diff
changeset
|
101 cacheable = !(rs instanceof Uncacheable); |
1123
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
102 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 returnValue = super.createResultCollection(rs); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 }else{ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 log.error("Could not establish Databaseconnection."); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 throw new QueryException("Could not establish Databaseconnection."); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 } |
541
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
108 |
1123
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
109 if (cacheable) { |
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
110 log.debug("Elements are cacheable."); |
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
111 cacheResults(queryString, returnValue); |
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
112 } |
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
113 else { |
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
114 log.debug("Elements are NOT cacheable."); |
f76541120bcb
Raster elements returned from ArcSDE are put into an UncacheableSDEResultSet container that is NOT cached.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1120
diff
changeset
|
115 } |
885
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
541
diff
changeset
|
116 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
117 } catch (ConnectionException e) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
118 log.error(e,e); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
119 throw new QueryException("Could not establish Databaseconnection.",e); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 } catch (SQLException e) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
121 log.error(e,e); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 throw new QueryException(e); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 }finally{ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 if (connection != null){ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 try { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 connectionPool.closeConnection(connection); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 } catch (ConnectionException e) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
128 log.error("Connection could not be returned to ConnectionPool."); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 log.error(e,e); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
130 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
133 }else{ |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
134 log.error("No QueryString defined for "+queryID); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
135 throw new QueryException("Cannot get the Querystring"); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
136 } |
885
1c3efbd2fc5a
Removes trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
541
diff
changeset
|
137 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
138 } catch (QueryContainerException e) { |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
139 log.error(e,e); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
140 throw new QueryException("Cannot get the Querystring",e); |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
141 } |
541
3cbf11c67fdc
Experimental caching of SQL results via Ehache
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
139
diff
changeset
|
142 |
132
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
143 return returnValue; |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
144 } |
5a583cff97ea
Implementation of the Datainfrastructure for fetching Data from different DataStores.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
145 } |