diff --git a/documentation/en/user/source/concepts/stores.rst b/documentation/en/user/source/concepts/stores.rst
index b30cabc207..fab2a65513 100644
--- a/documentation/en/user/source/concepts/stores.rst
+++ b/documentation/en/user/source/concepts/stores.rst
@@ -7,8 +7,6 @@ GeoWebCache historically used to have three storage components, responsible for
The **blobstore** is a storage mechanism for tiles, whose default implementation is file system based.
-The **metastore** was an optional H2 based storage mechanism for meta-information about tiles, such as tile creation time, size and usage of request parameters.
-
The **disk quota** mechanism uses a nosql embedded database to track the tiles disk usage and expire tiles based on user set policies.
Since GeoWebCache 1.4.0 the metastore was replaced with a full filesystem based solution, making the blobstore responsible for the information previously tracked by the metastore.
diff --git a/documentation/en/user/source/configuration/diskquotas.rst b/documentation/en/user/source/configuration/diskquotas.rst
index f5540f11cd..bbb412a4d9 100644
--- a/documentation/en/user/source/configuration/diskquotas.rst
+++ b/documentation/en/user/source/configuration/diskquotas.rst
@@ -153,18 +153,14 @@ It is possible to set the amount of threads to use when processing the disk quot
Disk quota storage
------------------
-The disk quota subystem defaults to use an embedded Berkeley DB whose storage is located in the cache directory, there is however also the possibility of using either an embedded H2 database, against storing information in the cache directory, or a standard Oracle or PostgreSQL database.
-
-In order to switch from the Berkeley DB to the embedded H2 storage the :file:`geowebcache-diskquota.xml` must contain the ``quotaStore`` element set to ``H2``:
-
+The disk quota subystem defaults to use an embedded Berkeley DB whose storage is located in the cache directory, there is however also the possibility of using either an embedded HSQL database, against storing information in the cache directory, or a standard Oracle or PostgreSQL database.
+In order to switch from the Berkeley DB to the embedded HSQL storage the :file:`geowebcache-diskquota.xml` must contain the ``quotaStore`` element set to ``HSQL``:
.. code-block:: xml
-
false
- H2
+ HSQL
...
-
@@ -180,7 +176,7 @@ In order to switch from the Berkeley DB to the freeform JDBC sources the :file:`
-In this case a separate file, :file:`geowebcache-diskquota-jdbc.xml` will contain the configuration for the chosen database containing the chosen DBMS dialect, at the time of writing the possible values are ``HSQL``, ``H2``, ``Oracle``, ``PostgreSQL``.
+In this case a separate file, :file:`geowebcache-diskquota-jdbc.xml` will contain the configuration for the chosen database containing the chosen DBMS dialect, at the time of writing the possible values are ``HSQL``, ``Oracle``, ``PostgreSQL``.
The connection pool can be either provided locally, in such case a DBCP based connection pool will be instantiated, or provided via JNDI.
The JDNI configuration is as simple as follows:
@@ -213,8 +209,7 @@ The local connection pool can instead be configured by specifying the following:
.. note::
-
- The `validationQuery` parameter is optional. Any supplied value is restricted based on dialect: `H2` requires ``SELECT 1``, and `Oracle` uses ``SELECT 1 FROM DUAL``. Remaining dialects are recommendation to use ``SELECT 1``.
+The `validationQuery` parameter is optional. Any supplied value is restricted based on dialect: HSQL uses SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS, Oracle uses SELECT 1 FROM DUAL, and most other dialects can use plain SELECT 1.
Disk quota schema
-----------------
diff --git a/geowebcache/core/pom.xml b/geowebcache/core/pom.xml
index 02036630ea..f846c23572 100644
--- a/geowebcache/core/pom.xml
+++ b/geowebcache/core/pom.xml
@@ -43,11 +43,6 @@
commons-codec
commons-codec
-
- com.h2database
- h2
- true
-
diff --git a/geowebcache/core/src/main/java/org/geowebcache/storage/MetastoreRemover.java b/geowebcache/core/src/main/java/org/geowebcache/storage/MetastoreRemover.java
deleted file mode 100644
index 265e2a8cfa..0000000000
--- a/geowebcache/core/src/main/java/org/geowebcache/storage/MetastoreRemover.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/**
- * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
- * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
- *
- *
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- *
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see
- * .
- *
- *
Copyright 2019
- */
-package org.geowebcache.storage;
-
-import static org.geowebcache.storage.blobstore.file.FilePathUtils.appendFiltered;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.commons.io.FileUtils;
-import org.geotools.util.logging.Logging;
-import org.geowebcache.GeoWebCacheException;
-import org.geowebcache.filter.parameters.ParametersUtils;
-import org.geowebcache.mime.MimeException;
-import org.geowebcache.mime.MimeType;
-import org.geowebcache.storage.blobstore.file.DefaultFilePathGenerator;
-import org.geowebcache.storage.blobstore.file.FilePathGenerator;
-import org.geowebcache.storage.blobstore.file.FilePathUtils;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowCallbackHandler;
-import org.springframework.jdbc.datasource.SingleConnectionDataSource;
-
-/**
- * Upgrades a 1.3.x GWC cache directory to the 1.4.x metastore-less style.
- *
- * @author Andrea Aime - GeoSolutions
- */
-public class MetastoreRemover {
-
- private static Logger log = Logging.getLogger(MetastoreRemover.class.getName());
-
- private DefaultStorageFinder storageFinder;
-
- private boolean defaultLocation;
-
- public MetastoreRemover(DefaultStorageFinder finder) throws Exception {
- this.storageFinder = finder;
- File root = new File(storageFinder.getDefaultPath());
- try (Connection conn = getMetaStoreConnection(root)) {
- if (conn != null) {
- log.info("Migrating the old metastore to filesystem storage");
- @SuppressWarnings("PMD.CloseResource")
- SingleConnectionDataSource ds = new SingleConnectionDataSource(conn, false);
- JdbcTemplate template = new JdbcTemplate(ds);
-
- // maybe we should make this optional?
- boolean migrateCreationDates = Boolean.getBoolean("MIGRATE_CREATION_DATES");
- if (migrateCreationDates) {
- migrateTileDates(template, new DefaultFilePathGenerator(root.getPath()));
- }
- migrateParameters(template, root);
- // remove all the tiles from storage to avoid further migration attempts
- // in the future, but only if the old metastore was external to the data dir
- if (!defaultLocation) {
- removeTiles(template);
- }
- }
- }
-
- // wipe out the entire database if the db location is the default one
- if (defaultLocation) {
- File dbFile = getDefaultH2Path(root).getParentFile();
- if (dbFile.exists()) {
- log.info("Cleaning up the old H2 database");
- FileUtils.deleteDirectory(dbFile);
- }
- }
-
- // remove disk quota if necessary (this we have to do regardless as we changed the
- // structure of the params from int to string)
- String path = root.getPath() + File.separator + "diskquota_page_store";
- File quotaRoot = new File(path);
- if (quotaRoot.exists()) {
- File version = new File(quotaRoot, "version.txt");
- if (!version.exists()) {
- log.warning("Old style DiskQuota database found, removing it.");
- FileUtils.deleteDirectory(quotaRoot);
- }
- }
- }
-
- /** Drop all the tiles to prevent a future migration */
- private void removeTiles(JdbcTemplate template) {
- template.execute("delete from tiles");
- }
-
- private void migrateParameters(JdbcTemplate template, final File root) {
- // find all possible combinations of layer, zoom level, gridset and parameter id
- String query =
- """
- select layers.value as layer, gridsets.value as gridset, tiles.z, parameters.value as parameters, parameters_id
- from tiles join layers on layers.id = tiles.layer_id\s
- join gridsets on gridsets.id = tiles.gridset_id
- join parameters on parameters.id = tiles.parameters_id
- group by layer, gridset, z, parameters, parameters_id""";
-
- final long total = Optional.ofNullable(
- template.queryForObject("select count(*) from (" + query + ")", Long.class))
- .orElse(0l);
- log.info("Migrating " + total + " parameters from the metastore to the file system");
- template.query(query, new RowCallbackHandler() {
-
- long count = 0;
-
- @Override
- public void processRow(ResultSet rs) throws SQLException {
- String layer = rs.getString(1);
- String gridset = rs.getString(2);
- int z = rs.getInt(3);
- String paramsKvp = rs.getString(4);
- String paramsId = rs.getString(5);
-
- String sha = getParamsSha1(paramsKvp);
-
- // move the folders containing params
- File origin = new File(buildFolderPath(root, layer, gridset, z, paramsId));
- File destination = new File(buildFolderPath(root, layer, gridset, z, sha));
- org.geowebcache.util.FileUtils.renameFile(origin, destination);
-
- count++;
- if (count % 1000 == 0 || count >= total) {
- log.info("Migrated " + count + "/" + total + " parameters from the metastore to the file system");
- }
- }
-
- private String buildFolderPath(final File root, String layer, String gridset, int z, String paramsId) {
- // build the old path
- StringBuilder path = new StringBuilder();
- path.append(root.getPath());
- path.append(File.separatorChar);
- appendFiltered(layer, path);
- path.append(File.separatorChar);
- FilePathUtils.appendGridsetZoomLevelDir(gridset, z, path);
- path.append('_');
- path.append(paramsId);
- path.append(File.separatorChar);
-
- return path.toString();
- }
-
- private String getParamsSha1(String paramsKvp) {
- Map params = toMap(paramsKvp);
- return ParametersUtils.getId(params);
- }
-
- /**
- * Parses the param list stored in the db to a parameter list (since this is coming from the database the
- * assumption is that the contents are sane)
- */
- private Map toMap(String paramsKvp) {
- // TODO: wondering, shall we URL decode the values??
- Map result = new HashMap<>();
- String[] kvps = paramsKvp.split("&");
- for (String kvp : kvps) {
- if (kvp != null && !"".equals(kvp)) {
- String[] kv = kvp.split("=");
- result.put(kv[0], kv[1]);
- }
- }
-
- return result;
- }
- });
- }
-
- private void migrateTileDates(JdbcTemplate template, final FilePathGenerator generator) {
- String query =
- """
- select layers.value as layer, gridsets.value as gridset, \
- tiles.parameters_id, tiles.z, tiles.x, tiles.y, created, formats.value as format\s
- from tiles join layers on layers.id = tiles.layer_id\s
- join gridsets on gridsets.id = tiles.gridset_id\s
- join formats on formats.id = tiles.format_id\s
- order by layer_id, parameters_id, gridset, z, x, y""";
-
- final long total = Optional.ofNullable(
- template.queryForObject("select count(*) from (" + query + ")", Long.class))
- .orElse(0l);
- log.info("Migrating " + total + " tile creation dates from the metastore to the file system");
-
- template.query(query, new RowCallbackHandler() {
-
- int count = 0;
-
- @Override
- public void processRow(ResultSet rs) throws SQLException {
- // read the result set
- String layer = rs.getString(1);
- String gridset = rs.getString(2);
- String paramsId = rs.getString(3);
- long z = rs.getLong(4);
- long x = rs.getLong(5);
- long y = rs.getLong(6);
- long created = rs.getLong(7);
- String format = rs.getString(8);
-
- // create the tile and thus the tile path
- TileObject tile =
- TileObject.createCompleteTileObject(layer, new long[] {x, y, z}, gridset, format, null, null);
- tile.setParametersId(paramsId);
- try {
- File file = generator.tilePath(tile, MimeType.createFromFormat(format));
-
- // update the last modified according to the date
- if (file.exists()) {
- file.setLastModified(created);
- }
- } catch (MimeException e) {
- log.log(
- Level.SEVERE,
- "Failed to locate mime type for format '" + format + "', this should never happen!");
- } catch (GeoWebCacheException e) {
- log.log(Level.SEVERE, "Failed to compute tile path", e);
- }
-
- count++;
- if (count % 10000 == 0 || count >= total) {
- log.info("Migrated "
- + count
- + "/"
- + total
- + " tile creation dates from the metastore to the file system");
- }
- }
- });
- }
-
- private String getVariable(String variable, String defaultValue) {
- String value = storageFinder.findEnvVar(DefaultStorageFinder.GWC_METASTORE_USERNAME);
- if (value != null) {
- return value;
- } else {
- return defaultValue;
- }
- }
-
- private Connection getMetaStoreConnection(File root) throws ClassNotFoundException, SQLException {
- try {
- String username = getVariable(DefaultStorageFinder.GWC_METASTORE_USERNAME, "sa");
- String password = getVariable(DefaultStorageFinder.GWC_METASTORE_PASSWORD, "");
- String defaultJDBCURL = getDefaultJDBCURL(root);
- String jdbcString = getVariable(DefaultStorageFinder.GWC_METASTORE_JDBC_URL, defaultJDBCURL);
- String driver = getVariable(DefaultStorageFinder.GWC_METASTORE_DRIVER_CLASS, "org.h2.Driver");
-
- if (defaultJDBCURL.equals(jdbcString)) {
- defaultLocation = true;
- }
-
- // load the driver
- Class.forName(driver);
-
- // if we are going against a H2 metastore open it only if it exists,
- // otherwise the only way to know if the metastore is still there
- // is to actually try to open it
- if ("org.h2.Driver".equals(driver) && jdbcString.equals(defaultJDBCURL)) {
- File dbPath = getDefaultH2Path(root);
- if (!dbPath.exists()) {
- return null;
- }
- }
-
- // grab the connection
- return DriverManager.getConnection(jdbcString, username, password);
- } catch (ClassNotFoundException e) {
- Level logLevel = Level.WARNING;
- if (getVariable(DefaultStorageFinder.GWC_METASTORE_DRIVER_CLASS, null) == null) logLevel = Level.FINE;
- log.log(logLevel, "Could not find the metastore driver, skipping migration", e);
- return null;
- } catch (SQLException e) {
- log.log(Level.WARNING, "Failed to connect to the legacy metastore, skipping migration", e);
- return null;
- }
- }
-
- private File getDefaultH2Path(File root) {
- String path = root.getPath() + File.separator + "meta_jdbc_h2";
- File dbPath = new File(path + File.separator + "gwc_metastore.data.db");
- return dbPath;
- }
-
- private String getDefaultJDBCURL(File root) {
- String path = root.getPath() + File.separator + "meta_jdbc_h2";
- String jdbcString = "jdbc:h2:file:" + path + File.separator + "gwc_metastore" + ";TRACE_LEVEL_FILE=0";
- return jdbcString;
- }
-}
diff --git a/geowebcache/core/src/test/java/org/geowebcache/MetastoreRemoverTest.java b/geowebcache/core/src/test/java/org/geowebcache/MetastoreRemoverTest.java
deleted file mode 100644
index 2e7fef6768..0000000000
--- a/geowebcache/core/src/test/java/org/geowebcache/MetastoreRemoverTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.geowebcache;
-
-import java.io.File;
-import java.util.Iterator;
-import org.apache.commons.io.FileUtils;
-import org.geowebcache.config.ConfigurationException;
-import org.geowebcache.storage.DefaultStorageFinder;
-import org.geowebcache.storage.MetastoreRemover;
-import org.geowebcache.util.ApplicationContextProvider;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MetastoreRemoverTest {
-
- static final long FIXED_DATE = 1348596000000l;
-
- File root;
-
- @Before
- public void setUp() throws Exception {
- // copy over the data we'll use for the migration test
- root = new File("./target/migration");
- File origin = new File("./src/test/resources/org/geowebcache/ms_removal");
- FileUtils.deleteDirectory(root);
- FileUtils.copyDirectory(origin, root);
- // force all files to a specific date for testing sake
- Iterator it = FileUtils.iterateFiles(root, new String[] {"png8", "png", "jpeg"}, true);
- while (it.hasNext()) {
- File file = it.next();
- file.setLastModified(FIXED_DATE);
- }
- }
-
- @Test
- public void testMigrationNoDates() throws Exception {
- testMigration(false);
- }
-
- @Test
- public void testMigrationWithDates() throws Exception {
- testMigration(true);
- }
-
- protected void testMigration(boolean migrateCreationDates) throws Exception {
- System.setProperty("MIGRATE_CREATION_DATES", String.valueOf(migrateCreationDates));
- // the remover does the migration on instantiation
- new MetastoreRemover(new DefaultStorageFinder(new ApplicationContextProvider()) {
- @Override
- public synchronized String getDefaultPath() throws ConfigurationException {
- return root.toString();
- }
- });
-
- // the first param has been removed and replaced, the file last modified date has been
- // replaced
- File original1 = new File(root, "topp_states/EPSG_4326_03_1/0_1/02_05.png8");
- File transformed1 =
- new File(root, "topp_states/EPSG_4326_03_7510004a12f49fdd49a2ba366e9c4594be7e4358/0_1/02_05.png8");
- Assert.assertFalse(original1.exists());
- Assert.assertTrue(transformed1.exists());
- if (migrateCreationDates) {
- Assert.assertTrue(Math.abs(transformed1.lastModified() - 1348596068000d) < 1000);
- } else {
- Assert.assertEquals(FIXED_DATE, transformed1.lastModified());
- }
-
- // same goes for the second param
- File original2 = new File(root, "topp_states/EPSG_4326_03_2/0_1/02_05.png8");
- File transformed2 =
- new File(root, "topp_states/EPSG_4326_03_f0023dc7bc347fee7a3a04dc797f2223f74e3448/0_1/02_05.png8");
- Assert.assertFalse(original2.exists());
- Assert.assertTrue(transformed2.exists());
- if (migrateCreationDates) {
- Assert.assertTrue(Math.abs(transformed2.lastModified() - 1348595993000l) < 1000);
- } else {
- Assert.assertEquals(FIXED_DATE, transformed1.lastModified());
- }
-
- // let's also check a file that did not have the parameter transformed
- File untransformed = new File(root, "raster_test_layer/EPSG_900913_01/0_0/00_01.jpeg");
- if (migrateCreationDates) {
- Assert.assertTrue(Math.abs(untransformed.lastModified() - 1348595928000l) < 1000);
- } else {
- Assert.assertEquals(FIXED_DATE, transformed1.lastModified());
- }
- }
-}
diff --git a/geowebcache/diskquota/core/src/main/java/org/geowebcache/diskquota/QuotaStoreProvider.java b/geowebcache/diskquota/core/src/main/java/org/geowebcache/diskquota/QuotaStoreProvider.java
index f8b601c0dd..d7113074b0 100644
--- a/geowebcache/diskquota/core/src/main/java/org/geowebcache/diskquota/QuotaStoreProvider.java
+++ b/geowebcache/diskquota/core/src/main/java/org/geowebcache/diskquota/QuotaStoreProvider.java
@@ -51,19 +51,9 @@ public void destroy() throws Exception {
@Override
public void afterPropertiesSet() throws Exception {
- replaceH2WithHsql();
reloadQuotaStore();
}
- private void replaceH2WithHsql() throws IOException, ConfigurationException {
- // migrate existing H2 DB selection to HSQL DB
- DiskQuotaConfig config = loader.loadConfig();
- if (config.getQuotaStore() != null && config.getQuotaStore().equals("H2")) {
- config.setQuotaStore("HSQL");
- loader.saveConfig(config);
- }
- }
-
public void reloadQuotaStore() throws IOException, ConfigurationException {
DiskQuotaConfig config = loader.loadConfig();
String quotaStoreName = config.getQuotaStore();
diff --git a/geowebcache/diskquota/core/src/main/resources/org/geowebcache/config/geowebcache-diskquota.xsd b/geowebcache/diskquota/core/src/main/resources/org/geowebcache/config/geowebcache-diskquota.xsd
index 7b4b10c6f1..9961f3521d 100644
--- a/geowebcache/diskquota/core/src/main/resources/org/geowebcache/config/geowebcache-diskquota.xsd
+++ b/geowebcache/diskquota/core/src/main/resources/org/geowebcache/config/geowebcache-diskquota.xsd
@@ -18,7 +18,7 @@
- Name of the quota store to be used, at the time of writing the possible values are 'bdb', 'h2' or 'jdbc', defaults to 'bdb'
+ Name of the quota store to be used, at the time of writing the possible values are 'bdb' or 'jdbc', defaults to 'bdb'
diff --git a/geowebcache/diskquota/jdbc/pom.xml b/geowebcache/diskquota/jdbc/pom.xml
index b23a47dd23..8bfbd94e38 100644
--- a/geowebcache/diskquota/jdbc/pom.xml
+++ b/geowebcache/diskquota/jdbc/pom.xml
@@ -25,11 +25,6 @@
org.postgresql
postgresql
-
- com.h2database
- h2
- true
-
org.hsqldb
hsqldb
diff --git a/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/H2Dialect.java b/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/H2Dialect.java
deleted file mode 100644
index 0b47ffd44b..0000000000
--- a/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/H2Dialect.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
- * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- *
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see
- * .
- *
- * @author Andrea Aime - GeoSolutions Copyright 2012
- */
-package org.geowebcache.diskquota.jdbc;
-
-/**
- * H2 dialect for the quota store
- *
- * @author Andrea Aime - GeoSolutions
- */
-public class H2Dialect extends SQLDialect {}
diff --git a/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/JDBCConfiguration.java b/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/JDBCConfiguration.java
index ef8f2749d0..dac1aa0e7a 100644
--- a/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/JDBCConfiguration.java
+++ b/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/JDBCConfiguration.java
@@ -84,7 +84,7 @@ public static JDBCConfiguration load(InputStream is) throws ConfigurationExcepti
*
*
Checks required JDBC driver and jdbc URL parameters are present.
*
- *
Checks H2 and Oracle validation query if provided.
+ *
Checks Oracle validation query if provided.
*
* @param conf configuration
* @throws ConfigurationException for incomplete or inconsistent configuration.
@@ -92,12 +92,12 @@ public static JDBCConfiguration load(InputStream is) throws ConfigurationExcepti
public static void validateConfiguration(JDBCConfiguration conf) throws ConfigurationException {
if (conf.getDialect() == null) {
throw new ConfigurationException(
- "A dialect must be provided, possible values are H2, HSQL, Oracle, PostgresSQL");
+ "A dialect must be provided, possible values are HSQL, Oracle, PostgresSQL");
}
ConnectionPoolConfiguration cp = conf.getConnectionPool();
String dialect = conf.getDialect();
- if (conf.getJNDISource() == null && cp == null && !"H2".equals(dialect) && !"HSQL".equals(dialect)) {
+ if (conf.getJNDISource() == null && cp == null && !"HSQL".equals(dialect)) {
throw new ConfigurationException("No data source provided, either configure JNDISource or connectionPool");
}
@@ -111,11 +111,7 @@ public static void validateConfiguration(JDBCConfiguration conf) throws Configur
String vq = cp.getValidationQuery();
if (vq != null) {
- if ("H2".equalsIgnoreCase(dialect)) {
- if (!vq.equalsIgnoreCase("SELECT 1")) {
- throw new ConfigurationException("H2 validation query required to be: SELECT 1");
- }
- } else if ("Oracle".equalsIgnoreCase(dialect)) {
+ if ("Oracle".equalsIgnoreCase(dialect)) {
if (!vq.equalsIgnoreCase("SELECT 1 FROM DUAL")) {
throw new ConfigurationException("Oracle validation query required to be: SELECT 1 FROM DUAL");
}
diff --git a/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreFactory.java b/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreFactory.java
index 44e251cbf5..2d308d41a1 100644
--- a/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreFactory.java
+++ b/geowebcache/diskquota/jdbc/src/main/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreFactory.java
@@ -39,7 +39,7 @@
import org.springframework.context.ApplicationContextAware;
/**
- * Builds the quota store for the JDBC family (either H2, HSQL or JDBC)
+ * Builds the quota store for the JDBC family (either HSQL or JDBC)
*
* @author Andrea Aime - GeoSolutions
*/
@@ -49,8 +49,6 @@ public class JDBCQuotaStoreFactory implements QuotaStoreFactory, ApplicationCont
private static final String CONFIGURATION_FILE_NAME = "geowebcache-diskquota-jdbc.xml";
- public static final String H2_STORE = "H2";
-
public static final String HSQL_STORE = "HSQL";
public static final String JDBC_STORE = "JDBC";
@@ -74,13 +72,6 @@ public List getSupportedStoreNames() {
List supportedStores = new ArrayList<>();
supportedStores.add(HSQL_STORE);
supportedStores.add(JDBC_STORE);
- try {
- // check if H2 driver is in the classpath
- Class.forName("org.h2.Driver");
- supportedStores.add(H2_STORE);
- } catch (Exception e) {
- // don't add h2 when its driver is not there
- }
return supportedStores;
}
@@ -90,9 +81,7 @@ public QuotaStore getQuotaStore(ApplicationContext ctx, String quotaStoreName) t
DefaultStorageFinder cacheDirFinder = (DefaultStorageFinder) ctx.getBean("gwcDefaultStorageFinder");
TilePageCalculator tilePageCalculator = (TilePageCalculator) ctx.getBean("gwcTilePageCalculator");
- if (H2_STORE.equals(quotaStoreName)) {
- return initializeH2Store(cacheDirFinder, tilePageCalculator);
- } else if (HSQL_STORE.equals(quotaStoreName)) {
+ if (HSQL_STORE.equals(quotaStoreName)) {
return initializeHSQLStore(cacheDirFinder, tilePageCalculator);
} else if (JDBC_STORE.equals(quotaStoreName)) {
return getJDBCStore(cacheDirFinder, tilePageCalculator);
@@ -232,22 +221,6 @@ protected DataSource getDataSource(JDBCConfiguration config) throws Configuratio
}
}
- private QuotaStore initializeH2Store(DefaultStorageFinder cacheDirFinder, TilePageCalculator tilePageCalculator)
- throws ConfigurationException {
- // get a default data source located in the cache directory
- DataSource ds = getH2DataSource(cacheDirFinder);
-
- // build up the store
- JDBCQuotaStore store = new JDBCQuotaStore(cacheDirFinder, tilePageCalculator);
- store.setDataSource(ds);
- store.setDialect(new H2Dialect());
-
- // initialize it
- store.initialize();
-
- return store;
- }
-
private QuotaStore initializeHSQLStore(DefaultStorageFinder cacheDirFinder, TilePageCalculator tilePageCalculator)
throws ConfigurationException {
// get a default data source located in the cache directory
@@ -264,25 +237,6 @@ private QuotaStore initializeHSQLStore(DefaultStorageFinder cacheDirFinder, Tile
return store;
}
- /** Prepares a simple data source for the embedded H2 */
- private DataSource getH2DataSource(DefaultStorageFinder cacheDirFinder) throws ConfigurationException {
- File storeDirectory = new File(cacheDirFinder.getDefaultPath(), "diskquota_page_store_h2");
- storeDirectory.mkdirs();
-
- BasicDataSource dataSource = new BasicDataSource();
-
- dataSource.setDriverClassName("org.h2.Driver");
- String database = new File(storeDirectory, "diskquota").getAbsolutePath();
- dataSource.setUrl("jdbc:h2:" + database);
- dataSource.setUsername("sa");
- dataSource.setPoolPreparedStatements(true);
- dataSource.setAccessToUnderlyingConnectionAllowed(true);
- dataSource.setMinIdle(1);
- dataSource.setMaxActive(-1); // boundless
- dataSource.setMaxWait(5000);
- return dataSource;
- }
-
/** Prepares a simple data source for the embedded HSQL */
private DataSource getHSQLDataSource(DefaultStorageFinder cacheDirFinder) throws ConfigurationException {
File storeDirectory = new File(cacheDirFinder.getDefaultPath(), "diskquota_page_store_hsql");
diff --git a/geowebcache/diskquota/jdbc/src/main/resources/org/geowebcache/diskquota/jdbc/geowebcache-diskquota-jdbc.xsd b/geowebcache/diskquota/jdbc/src/main/resources/org/geowebcache/diskquota/jdbc/geowebcache-diskquota-jdbc.xsd
index 11cd7b27da..57d8341375 100644
--- a/geowebcache/diskquota/jdbc/src/main/resources/org/geowebcache/diskquota/jdbc/geowebcache-diskquota-jdbc.xsd
+++ b/geowebcache/diskquota/jdbc/src/main/resources/org/geowebcache/diskquota/jdbc/geowebcache-diskquota-jdbc.xsd
@@ -13,7 +13,7 @@
- The dialect used for the JDBC connection. Valid values at the time of writing: H2, Oracle, PostgreSQL
+ The dialect used for the JDBC connection. Valid values at the time of writing: Oracle, PostgreSQL
diff --git a/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/H2QuotaStoreTest.java b/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/H2QuotaStoreTest.java
deleted file mode 100644
index 989ed43ca8..0000000000
--- a/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/H2QuotaStoreTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.geowebcache.diskquota.jdbc;
-
-import java.util.Properties;
-import org.junit.Test;
-
-public class H2QuotaStoreTest extends JDBCQuotaStoreTest {
-
- @Override
- protected SQLDialect getDialect() {
- return new H2Dialect();
- }
-
- @Override
- protected JDBCFixtureRule makeFixtureRule() {
- return new JDBCFixtureRule(getFixtureId()) {
- @Override
- protected Properties createOfflineFixture() {
- Properties fixture = new Properties();
- fixture.put("driver", "org.h2.Driver");
- fixture.put("url", "jdbc:h2:./target/quota-h2");
- fixture.put("username", "sa");
- fixture.put("password", "");
- return fixture;
- }
- };
- }
-
- @Override
- protected String getFixtureId() {
- return "h2";
- }
-
- @Test
- public void checkConnectionTest() {}
-}
diff --git a/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCConfigurationTest.java b/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCConfigurationTest.java
index 612ad9c415..15d1da32eb 100644
--- a/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCConfigurationTest.java
+++ b/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCConfigurationTest.java
@@ -135,23 +135,8 @@ public void testRoundTripParametrizedConnectionPool() throws Exception {
public void testValidationQueryValidation() throws Exception {
JDBCConfiguration config = new JDBCConfiguration();
ConnectionPoolConfiguration cp = new ConnectionPoolConfiguration();
-
- // h2 testing
- config.setDialect("H2");
- cp.setDriver("org.h2.Driver");
- cp.setUrl("jdbc:h2:database");
config.setConnectionPool(cp);
- cp.setValidationQuery("select 1");
- JDBCConfiguration.validateConfiguration(config);
-
- cp.setValidationQuery("select 1 from DUO");
- try {
- JDBCConfiguration.validateConfiguration(config);
- Assert.fail("select 1 required");
- } catch (ConfigurationException expected) {
- }
-
// oracle testing
config.setDialect("Oracle");
cp.setDriver("oracle.jdbc.driver.OracleDriver");
diff --git a/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreTest.java b/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreTest.java
index fa3befd811..1edc1ed16a 100644
--- a/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreTest.java
+++ b/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreTest.java
@@ -156,8 +156,6 @@ protected void setUpInternal() throws Exception {
.collect(Collectors.toSet())));
tilePageCalculator = new TilePageCalculator(layerDispatcher, storageBroker);
-
- // prepare a connection pool for tests against a H2 database
dataSource = getDataSource();
SQLDialect dialect = getDialect();
diff --git a/geowebcache/web/src/main/webapp/WEB-INF/geowebcache-core-context.xml b/geowebcache/web/src/main/webapp/WEB-INF/geowebcache-core-context.xml
index d1845c40fc..b5cb905527 100644
--- a/geowebcache/web/src/main/webapp/WEB-INF/geowebcache-core-context.xml
+++ b/geowebcache/web/src/main/webapp/WEB-INF/geowebcache-core-context.xml
@@ -134,10 +134,7 @@
@@ -207,11 +204,6 @@
-
-
-
-
-
diff --git a/geowebcache/web/src/main/webapp/WEB-INF/geowebcache-diskquota-context.xml b/geowebcache/web/src/main/webapp/WEB-INF/geowebcache-diskquota-context.xml
index d35b023bbf..88e7c7562e 100644
--- a/geowebcache/web/src/main/webapp/WEB-INF/geowebcache-diskquota-context.xml
+++ b/geowebcache/web/src/main/webapp/WEB-INF/geowebcache-diskquota-context.xml
@@ -1,9 +1,7 @@
-
-
-
+
@@ -36,7 +34,6 @@
-