diff --git a/compose/catalog-pgconfig.yml b/compose/catalog-pgconfig.yml index cae8dd239..de497ae54 100644 --- a/compose/catalog-pgconfig.yml +++ b/compose/catalog-pgconfig.yml @@ -1,5 +1,5 @@ volumes: - pgconfigdb_data: # volume for postgresql data, used to store the geoserver config through pgsqlconfig backend + pgconfigdb_data: # volume for postgresql data, used to store the geoserver config through pgconfig backend # # Configures all geoserver services to use the postgresql database server with pgconfig as catalog backend. diff --git a/config b/config index a6b7262cf..e629ac2cd 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit a6b7262cf913eb145cf37982af4cf8866214a305 +Subproject commit e629ac2cd268c4d556aa5f3ca48dad669e72853d diff --git a/docs/deploy/docker-compose/stable/pgconfig/compose.yml b/docs/deploy/docker-compose/stable/pgconfig/compose.yml index 3767fa09e..21cb6b15a 100644 --- a/docs/deploy/docker-compose/stable/pgconfig/compose.yml +++ b/docs/deploy/docker-compose/stable/pgconfig/compose.yml @@ -3,7 +3,7 @@ version: "3.8" volumes: rabbitmq_data: # volume for rabbitmq data, so it doesn't create an anonymous one on each container geowebcache_data: - pgconfigdb_data: # volume for postgresql data, used to store the geoserver config through pgsqlconfig backend + pgconfigdb_data: # volume for postgresql data, used to store the geoserver config through pgconfig backend services: pgconfigdb: diff --git a/src/catalog/README.md b/src/catalog/README.md index 4ec02a2fd..65b19886a 100644 --- a/src/catalog/README.md +++ b/src/catalog/README.md @@ -35,7 +35,7 @@ Provides spring atuo-configuration for several catalog back-ends. Namely: tradit * gs-cloud-catalog-cache * gs-cloud-catalog-backend-datadir * gs-cloud-catalog-backend-jdbcconfig - * gs-cloud-catalog-backend-pgsql + * gs-cloud-catalog-backend-pgconfig ## catalog-cache diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/ConditionalOnPgsqlBackendEnabled.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/ConditionalOnPgconfigBackendEnabled.java similarity index 93% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/ConditionalOnPgsqlBackendEnabled.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/ConditionalOnPgconfigBackendEnabled.java index 86b443109..3b8740d0b 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/ConditionalOnPgsqlBackendEnabled.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/ConditionalOnPgconfigBackendEnabled.java @@ -23,4 +23,4 @@ name = "enabled", havingValue = "true", matchIfMissing = false) -public @interface ConditionalOnPgsqlBackendEnabled {} +public @interface ConditionalOnPgconfigBackendEnabled {} diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlBackendAutoConfiguration.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigBackendAutoConfiguration.java similarity index 67% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlBackendAutoConfiguration.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigBackendAutoConfiguration.java index 327aa32f7..c408da85f 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlBackendAutoConfiguration.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigBackendAutoConfiguration.java @@ -5,7 +5,7 @@ package org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig; import org.geoserver.cloud.config.catalog.backend.core.CatalogProperties; -import org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlBackendConfiguration; +import org.geoserver.cloud.config.catalog.backend.pgconfig.PgconfigBackendConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Import; @@ -13,8 +13,8 @@ /** * @since 1.4 */ -@AutoConfiguration(after = PgsqlMigrationAutoConfiguration.class) -@ConditionalOnPgsqlBackendEnabled +@AutoConfiguration(after = PgconfigMigrationAutoConfiguration.class) +@ConditionalOnPgconfigBackendEnabled @EnableConfigurationProperties(CatalogProperties.class) -@Import(PgsqlBackendConfiguration.class) -public class PgsqlBackendAutoConfiguration {} +@Import(PgconfigBackendConfiguration.class) +public class PgconfigBackendAutoConfiguration {} diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlDataSourceAutoConfiguration.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigDataSourceAutoConfiguration.java similarity index 70% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlDataSourceAutoConfiguration.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigDataSourceAutoConfiguration.java index 2636d7c9f..ed923ce93 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlDataSourceAutoConfiguration.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigDataSourceAutoConfiguration.java @@ -4,7 +4,7 @@ */ package org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig; -import org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlDataSourceConfiguration; +import org.geoserver.cloud.config.catalog.backend.pgconfig.PconfigDataSourceConfiguration; import org.geoserver.cloud.config.jndidatasource.JNDIDataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.context.annotation.Import; @@ -13,6 +13,6 @@ * @since 1.4 */ @AutoConfiguration(after = JNDIDataSourceAutoConfiguration.class) -@ConditionalOnPgsqlBackendEnabled -@Import(PgsqlDataSourceConfiguration.class) -public class PgsqlDataSourceAutoConfiguration {} +@ConditionalOnPgconfigBackendEnabled +@Import(PconfigDataSourceConfiguration.class) +public class PgconfigDataSourceAutoConfiguration {} diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlMigrationAutoConfiguration.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigMigrationAutoConfiguration.java similarity index 76% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlMigrationAutoConfiguration.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigMigrationAutoConfiguration.java index fa2359174..959c23fbc 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlMigrationAutoConfiguration.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigMigrationAutoConfiguration.java @@ -11,7 +11,7 @@ /** * @since 1.4 */ -@AutoConfiguration(after = PgsqlDataSourceAutoConfiguration.class) -@ConditionalOnPgsqlBackendEnabled +@AutoConfiguration(after = PgconfigDataSourceAutoConfiguration.class) +@ConditionalOnPgconfigBackendEnabled @Import(DatabaseMigrationConfiguration.class) -public class PgsqlMigrationAutoConfiguration {} +public class PgconfigMigrationAutoConfiguration {} diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigTransactionManagerAutoConfiguration.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigTransactionManagerAutoConfiguration.java new file mode 100644 index 000000000..534c26b0f --- /dev/null +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigTransactionManagerAutoConfiguration.java @@ -0,0 +1,25 @@ +/* + * (c) 2024 Open Source Geospatial Foundation - all rights reserved This code is licensed under the + * GPL 2.0 license, available at the root application directory. + */ +package org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.sql.DataSource; + +@AutoConfiguration(after = PgconfigDataSourceAutoConfiguration.class) +@ConditionalOnPgconfigBackendEnabled +@EnableTransactionManagement +public class PgconfigTransactionManagerAutoConfiguration { + + @Bean + DataSourceTransactionManager pgconfigTransactionManager( + @Qualifier("pgconfigDataSource") DataSource dataSource) { + return new DataSourceTransactionManager(dataSource); + } +} diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/PgsqlBackendBuilder.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/PgconfigBackendBuilder.java similarity index 74% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/PgsqlBackendBuilder.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/PgconfigBackendBuilder.java index 847872530..d99676941 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/PgsqlBackendBuilder.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/PgconfigBackendBuilder.java @@ -11,8 +11,8 @@ import org.geoserver.catalog.impl.CatalogImpl; import org.geoserver.catalog.plugin.CatalogPlugin; import org.geoserver.catalog.plugin.ExtendedCatalogFacade; -import org.geoserver.cloud.backend.pgconfig.catalog.PgsqlCatalogFacade; -import org.geoserver.cloud.backend.pgconfig.config.PgsqlGeoServerFacade; +import org.geoserver.cloud.backend.pgconfig.catalog.PgconfigCatalogFacade; +import org.geoserver.cloud.backend.pgconfig.config.PgconfigGeoServerFacade; import org.geoserver.config.plugin.GeoServerImpl; import org.springframework.jdbc.core.JdbcTemplate; @@ -22,7 +22,7 @@ * @since 1.4 */ @RequiredArgsConstructor -public class PgsqlBackendBuilder { +public class PgconfigBackendBuilder { private final @NonNull DataSource dataSource; @@ -31,19 +31,19 @@ public CatalogPlugin createCatalog() { } public GeoServerImpl createGeoServer(Catalog catalog) { - PgsqlGeoServerFacade facade = createGeoServerFacade(); + PgconfigGeoServerFacade facade = createGeoServerFacade(); GeoServerImpl gs = new GeoServerImpl(facade); gs.setCatalog(catalog); return gs; } - public PgsqlGeoServerFacade createGeoServerFacade() { - return new PgsqlGeoServerFacade(new JdbcTemplate(dataSource)); + public PgconfigGeoServerFacade createGeoServerFacade() { + return new PgconfigGeoServerFacade(new JdbcTemplate(dataSource)); } public ExtendedCatalogFacade createCatalogFacade() { JdbcTemplate template = new JdbcTemplate(dataSource); - return new PgsqlCatalogFacade(template); + return new PgconfigCatalogFacade(template); } public C initCatalog(C catalog) { diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/PgsqlCatalogFacade.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/PgconfigCatalogFacade.java similarity index 69% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/PgsqlCatalogFacade.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/PgconfigCatalogFacade.java index 0073857a9..d90cea2f7 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/PgsqlCatalogFacade.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/PgconfigCatalogFacade.java @@ -12,14 +12,14 @@ import org.geoserver.catalog.plugin.resolving.CatalogPropertyResolver; import org.geoserver.catalog.plugin.resolving.CollectionPropertiesInitializer; import org.geoserver.catalog.plugin.resolving.ResolvingProxyResolver; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlCatalogInfoRepository; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlLayerGroupRepository; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlLayerRepository; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlNamespaceRepository; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlResourceRepository; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlStoreRepository; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlStyleRepository; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlWorkspaceRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigCatalogInfoRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigLayerGroupRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigLayerRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigNamespaceRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigResourceRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigStoreRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigStyleRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigWorkspaceRepository; import org.springframework.jdbc.core.JdbcTemplate; import java.util.function.Supplier; @@ -28,17 +28,17 @@ /** * @since 1.4 */ -public class PgsqlCatalogFacade extends RepositoryCatalogFacadeImpl { +public class PgconfigCatalogFacade extends RepositoryCatalogFacadeImpl { - public PgsqlCatalogFacade(@NonNull JdbcTemplate template) { - PgsqlNamespaceRepository namespaces = new PgsqlNamespaceRepository(template); - PgsqlWorkspaceRepository workspaces = new PgsqlWorkspaceRepository(template); - PgsqlStyleRepository styles = new PgsqlStyleRepository(template); + public PgconfigCatalogFacade(@NonNull JdbcTemplate template) { + PgconfigNamespaceRepository namespaces = new PgconfigNamespaceRepository(template); + PgconfigWorkspaceRepository workspaces = new PgconfigWorkspaceRepository(template); + PgconfigStyleRepository styles = new PgconfigStyleRepository(template); - PgsqlStoreRepository stores = new PgsqlStoreRepository(template); - PgsqlLayerRepository layers = new PgsqlLayerRepository(template, styles); - PgsqlResourceRepository resources = new PgsqlResourceRepository(template, layers); - PgsqlLayerGroupRepository layerGroups = new PgsqlLayerGroupRepository(template); + PgconfigStoreRepository stores = new PgconfigStoreRepository(template); + PgconfigLayerRepository layers = new PgconfigLayerRepository(template, styles); + PgconfigResourceRepository resources = new PgconfigResourceRepository(template, layers); + PgconfigLayerGroupRepository layerGroups = new PgconfigLayerGroupRepository(template); super.setNamespaceRepository(namespaces); super.setWorkspaceRepository(workspaces); @@ -60,7 +60,7 @@ private void setOutboundResolver() { UnaryOperator resolvingFunction = resolvingFunction(this::getCatalog); super.repositories.all().stream() - .map(PgsqlCatalogInfoRepository.class::cast) + .map(PgconfigCatalogInfoRepository.class::cast) .forEach(repo -> repo.setOutboundResolver(resolvingFunction)); } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlCatalogFilterSplitter.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigCatalogFilterSplitter.java similarity index 79% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlCatalogFilterSplitter.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigCatalogFilterSplitter.java index 760c0c6ec..f28be896b 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlCatalogFilterSplitter.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigCatalogFilterSplitter.java @@ -18,18 +18,18 @@ * * @since 1.4 */ -class PgsqlCatalogFilterSplitter extends PostPreProcessFilterSplittingVisitor { +class PgconfigCatalogFilterSplitter extends PostPreProcessFilterSplittingVisitor { private Set supportedPropertyNames; - public PgsqlCatalogFilterSplitter(@NonNull Set supportedPropertyNames) { - super(PgsqlFilterCapabilities.capabilities(), null, null); + public PgconfigCatalogFilterSplitter(@NonNull Set supportedPropertyNames) { + super(PgconfigFilterCapabilities.capabilities(), null, null); this.supportedPropertyNames = supportedPropertyNames; } - public static PgsqlCatalogFilterSplitter split( + public static PgconfigCatalogFilterSplitter split( Filter filter, Set supportedPropertyNames) { - var splitter = new PgsqlCatalogFilterSplitter(supportedPropertyNames); + var splitter = new PgconfigCatalogFilterSplitter(supportedPropertyNames); filter.accept(splitter, null); return splitter; } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlFilterCapabilities.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigFilterCapabilities.java similarity index 99% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlFilterCapabilities.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigFilterCapabilities.java index a7dafa092..bcd9a1a00 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlFilterCapabilities.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigFilterCapabilities.java @@ -49,7 +49,7 @@ * @since 1.4 */ @UtilityClass -class PgsqlFilterCapabilities { +class PgconfigFilterCapabilities { private static final FilterCapabilities INSTANCE = createFilterCapabilities(); diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlFilterToSQL.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigFilterToSQL.java similarity index 98% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlFilterToSQL.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigFilterToSQL.java index 984f79de7..56e7b9ade 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlFilterToSQL.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigFilterToSQL.java @@ -52,7 +52,7 @@ /** * @since 1.4 */ -class PgsqlFilterToSQL extends PreparedFilterToSQL { +class PgconfigFilterToSQL extends PreparedFilterToSQL { public static @Value class Result { String whereClause; @@ -65,15 +65,15 @@ class PgsqlFilterToSQL extends PreparedFilterToSQL { /** * @param dialect */ - public PgsqlFilterToSQL(Writer out) { + public PgconfigFilterToSQL(Writer out) { super(out); setSqlNameEscape("\""); - super.setCapabilities(PgsqlFilterCapabilities.capabilities()); + super.setCapabilities(PgconfigFilterCapabilities.capabilities()); } public static Result evaluate(Filter filter) { StringWriter out = new StringWriter(); - var filterToPreparedStatement = new PgsqlFilterToSQL(out); + var filterToPreparedStatement = new PgconfigFilterToSQL(out); filterToPreparedStatement.setSqlNameEscape("\""); filter.accept(filterToPreparedStatement, null); out.flush(); diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlQueryBuilder.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigQueryBuilder.java similarity index 87% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlQueryBuilder.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigQueryBuilder.java index e65adc437..2b13602c7 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgsqlQueryBuilder.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/filter/PgconfigQueryBuilder.java @@ -5,12 +5,12 @@ package org.geoserver.cloud.backend.pgconfig.catalog.filter; import static org.geoserver.cloud.backend.pgconfig.catalog.filter.CatalogInfoLiteralAdaptor.replaceCatalogInfoLiterals; -import static org.geoserver.cloud.backend.pgconfig.catalog.filter.PgsqlCatalogFilterSplitter.split; +import static org.geoserver.cloud.backend.pgconfig.catalog.filter.PgconfigCatalogFilterSplitter.split; import lombok.Getter; import lombok.RequiredArgsConstructor; -import org.geoserver.cloud.backend.pgconfig.catalog.filter.PgsqlFilterToSQL.Result; +import org.geoserver.cloud.backend.pgconfig.catalog.filter.PgconfigFilterToSQL.Result; import org.geotools.api.filter.Filter; import org.geotools.filter.visitor.SimplifyingFilterVisitor; @@ -21,7 +21,7 @@ * @since 1.4 */ @RequiredArgsConstructor -public class PgsqlQueryBuilder { +public class PgconfigQueryBuilder { private final Filter origFilter; private final Set supportedPropertyNames; @@ -35,7 +35,7 @@ public class PgsqlQueryBuilder { @SuppressWarnings("rawtypes") private @Getter List literalTypes; - public PgsqlQueryBuilder build() { + public PgconfigQueryBuilder build() { if (Filter.INCLUDE.equals(origFilter)) { return this; } @@ -49,7 +49,7 @@ public PgsqlQueryBuilder build() { unsupportedFilter = simplify(splitter.getFilterPost()); - Result encodeResult = PgsqlFilterToSQL.evaluate(supportedFilter); + Result encodeResult = PgconfigFilterToSQL.evaluate(supportedFilter); whereClause = encodeResult.getWhereClause(); literalValues = encodeResult.getLiteralValues(); literalTypes = encodeResult.getLiteralTypes(); diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/CatalogInfoRowMapper.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/CatalogInfoRowMapper.java index 16d9fac98..a04582e11 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/CatalogInfoRowMapper.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/CatalogInfoRowMapper.java @@ -42,7 +42,7 @@ @Slf4j(topic = "org.geoserver.cloud.backend.pgconfig.catalog.repository") public final class CatalogInfoRowMapper { - protected static final ObjectMapper objectMapper = PgsqlObjectMapper.newObjectMapper(); + protected static final ObjectMapper objectMapper = PgconfigObjectMapper.newObjectMapper(); /** Lazily created by {@link #cache()} */ private Map, Map> cache; diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlCatalogInfoRepository.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigCatalogInfoRepository.java similarity index 95% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlCatalogInfoRepository.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigCatalogInfoRepository.java index ba37262fd..d80d132ff 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlCatalogInfoRepository.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigCatalogInfoRepository.java @@ -19,7 +19,7 @@ import org.geoserver.catalog.plugin.Query; import org.geoserver.catalog.plugin.resolving.ResolvingCatalogInfoRepository; import org.geoserver.catalog.plugin.resolving.ResolvingFacade; -import org.geoserver.cloud.backend.pgconfig.catalog.filter.PgsqlQueryBuilder; +import org.geoserver.cloud.backend.pgconfig.catalog.filter.PgconfigQueryBuilder; import org.geotools.api.filter.Filter; import org.geotools.api.filter.FilterFactory; import org.geotools.api.filter.sort.SortBy; @@ -46,11 +46,11 @@ * @since 1.4 */ @Slf4j(topic = "org.geoserver.cloud.backend.pgconfig.catalog.repository") -public abstract class PgsqlCatalogInfoRepository +public abstract class PgconfigCatalogInfoRepository extends ResolvingCatalogInfoRepository implements CatalogInfoRepository, ResolvingFacade { - protected static final ObjectMapper infoMapper = PgsqlObjectMapper.newObjectMapper(); + protected static final ObjectMapper infoMapper = PgconfigObjectMapper.newObjectMapper(); protected static final FilterFactory FILTER_FACTORY = CommonFactoryFinder.getFilterFactory(); @@ -61,11 +61,11 @@ public abstract class PgsqlCatalogInfoRepository /** * @param template */ - protected PgsqlCatalogInfoRepository(@NonNull JdbcTemplate template) { + protected PgconfigCatalogInfoRepository(@NonNull JdbcTemplate template) { this(new LoggingTemplate(template)); } - protected PgsqlCatalogInfoRepository(@NonNull LoggingTemplate template) { + protected PgconfigCatalogInfoRepository(@NonNull LoggingTemplate template) { super(); this.template = template; } @@ -159,7 +159,8 @@ public Stream findAll(Query query) { final Filter filter = applyTypeFilter(query.getFilter(), query.getType()); final Class type = query.getType(); - final PgsqlQueryBuilder qb = new PgsqlQueryBuilder(filter, sortableProperties()).build(); + final PgconfigQueryBuilder qb = + new PgconfigQueryBuilder(filter, sortableProperties()).build(); final Filter supportedFilter = qb.getSupportedFilter(); final Filter unsupportedFilter = qb.getUnsupportedFilter(); final String whereClause = qb.getWhereClause(); @@ -263,7 +264,8 @@ protected void checkCanSortBy(String property) { @Override public long count(Class of, Filter filter) { filter = applyTypeFilter(filter, of); - final PgsqlQueryBuilder qb = new PgsqlQueryBuilder(filter, sortableProperties()).build(); + final PgconfigQueryBuilder qb = + new PgconfigQueryBuilder(filter, sortableProperties()).build(); final Filter supportedFilter = qb.getSupportedFilter(); final Filter unsupportedFilter = qb.getUnsupportedFilter(); final String whereClause = qb.getWhereClause(); @@ -294,7 +296,7 @@ public long count(Class of, Filter filter) { } @SuppressWarnings("java:S1168") - private Object[] prepareParams(PgsqlQueryBuilder qb) { + private Object[] prepareParams(PgconfigQueryBuilder qb) { List literalValues = qb.getLiteralValues(); if (literalValues.isEmpty()) return null; return literalValues.stream().map(this::asPreparedValue).toArray(); diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlLayerGroupRepository.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigLayerGroupRepository.java similarity index 90% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlLayerGroupRepository.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigLayerGroupRepository.java index f065afcd4..cd7525a7d 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlLayerGroupRepository.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigLayerGroupRepository.java @@ -18,13 +18,13 @@ /** * @since 1.4 */ -public class PgsqlLayerGroupRepository extends PgsqlCatalogInfoRepository +public class PgconfigLayerGroupRepository extends PgconfigCatalogInfoRepository implements LayerGroupRepository { /** * @param template */ - public PgsqlLayerGroupRepository(@NonNull JdbcTemplate template) { + public PgconfigLayerGroupRepository(@NonNull JdbcTemplate template) { super(template); } @@ -86,7 +86,7 @@ public Stream findAllByWorkspace(WorkspaceInfo workspace) { @Override protected RowMapper newRowMapper() { - PgsqlStyleRepository styleLoader = new PgsqlStyleRepository(template); + PgconfigStyleRepository styleLoader = new PgconfigStyleRepository(template); return CatalogInfoRowMapper.layerGroup(styleLoader::findById); } } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlLayerRepository.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigLayerRepository.java similarity index 91% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlLayerRepository.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigLayerRepository.java index 31eb889f6..4ad52c50a 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlLayerRepository.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigLayerRepository.java @@ -21,16 +21,16 @@ /** * @since 1.4 */ -public class PgsqlLayerRepository extends PgsqlCatalogInfoRepository +public class PgconfigLayerRepository extends PgconfigCatalogInfoRepository implements LayerRepository { - private final PgsqlStyleRepository styleLoader; + private final PgconfigStyleRepository styleLoader; /** * @param template */ - public PgsqlLayerRepository( - @NonNull JdbcTemplate template, @NonNull PgsqlStyleRepository styleLoader) { + public PgconfigLayerRepository( + @NonNull JdbcTemplate template, @NonNull PgconfigStyleRepository styleLoader) { super(template); this.styleLoader = styleLoader; } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlNamespaceRepository.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigNamespaceRepository.java similarity index 93% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlNamespaceRepository.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigNamespaceRepository.java index 7be92c50e..f11a9fc3b 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlNamespaceRepository.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigNamespaceRepository.java @@ -17,13 +17,13 @@ /** * @since 1.4 */ -public class PgsqlNamespaceRepository extends PgsqlCatalogInfoRepository +public class PgconfigNamespaceRepository extends PgconfigCatalogInfoRepository implements NamespaceRepository { /** * @param template */ - public PgsqlNamespaceRepository(@NonNull JdbcTemplate template) { + public PgconfigNamespaceRepository(@NonNull JdbcTemplate template) { super(template); } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlObjectMapper.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigObjectMapper.java similarity index 93% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlObjectMapper.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigObjectMapper.java index dfe2096d4..82f5a0b81 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlObjectMapper.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigObjectMapper.java @@ -12,7 +12,7 @@ import org.geotools.jackson.databind.util.ObjectMapperUtil; @UtilityClass -public class PgsqlObjectMapper { +public class PgconfigObjectMapper { /** * Creates a Jackson {@link ObjectMapper} configured for the PostgreSQL JSONB encoding of @@ -31,7 +31,7 @@ public class PgsqlObjectMapper { * catalog and config info objects. * @see ObjectMapperUtil#newObjectMapper() * @see {@code populate_table_columns_from_jsonb()} in {@literal - * src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_0__Catalog_Tables.sql} + * src/main/resources/db/pgconfig/migration/postgresql/V1_0__Catalog_Tables.sql} */ public static ObjectMapper newObjectMapper() { ObjectMapper mapper = ObjectMapperUtil.newObjectMapper(); diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlResourceRepository.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigResourceRepository.java similarity index 95% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlResourceRepository.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigResourceRepository.java index 686c3a4dd..75f8178da 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlResourceRepository.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigResourceRepository.java @@ -22,17 +22,17 @@ /** * @since 1.4 */ -public class PgsqlResourceRepository extends PgsqlCatalogInfoRepository +public class PgconfigResourceRepository extends PgconfigCatalogInfoRepository implements ResourceRepository { private static final String AND_TYPE_INFOTYPE = " AND \"@type\" = ?::infotype"; - private final PgsqlLayerRepository layerrepo; + private final PgconfigLayerRepository layerrepo; /** * @param template */ - public PgsqlResourceRepository( - @NonNull JdbcTemplate template, @NonNull PgsqlLayerRepository layerrepo) { + public PgconfigResourceRepository( + @NonNull JdbcTemplate template, @NonNull PgconfigLayerRepository layerrepo) { super(template); this.layerrepo = layerrepo; } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlStoreRepository.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigStoreRepository.java similarity index 96% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlStoreRepository.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigStoreRepository.java index 8d7bfe15e..785abf540 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlStoreRepository.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigStoreRepository.java @@ -19,13 +19,13 @@ /** * @since 1.4 */ -public class PgsqlStoreRepository extends PgsqlCatalogInfoRepository +public class PgconfigStoreRepository extends PgconfigCatalogInfoRepository implements StoreRepository { /** * @param template */ - public PgsqlStoreRepository(@NonNull JdbcTemplate template) { + public PgconfigStoreRepository(@NonNull JdbcTemplate template) { super(template); } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlStyleRepository.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigStyleRepository.java similarity index 91% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlStyleRepository.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigStyleRepository.java index 98e6420fc..186a76bb0 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlStyleRepository.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigStyleRepository.java @@ -18,17 +18,17 @@ /** * @since 1.4 */ -public class PgsqlStyleRepository extends PgsqlCatalogInfoRepository +public class PgconfigStyleRepository extends PgconfigCatalogInfoRepository implements StyleRepository { /** * @param template */ - public PgsqlStyleRepository(@NonNull JdbcTemplate template) { + public PgconfigStyleRepository(@NonNull JdbcTemplate template) { super(template); } - public PgsqlStyleRepository(@NonNull LoggingTemplate template) { + public PgconfigStyleRepository(@NonNull LoggingTemplate template) { super(template); } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlWorkspaceRepository.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigWorkspaceRepository.java similarity index 92% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlWorkspaceRepository.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigWorkspaceRepository.java index c9f3f2b90..4c545fd02 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlWorkspaceRepository.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigWorkspaceRepository.java @@ -17,7 +17,7 @@ /** * @since 1.4 */ -public class PgsqlWorkspaceRepository extends PgsqlCatalogInfoRepository +public class PgconfigWorkspaceRepository extends PgconfigCatalogInfoRepository implements WorkspaceRepository { private static final String UNSET_DEFAULT_WORKSPACE = @@ -28,7 +28,7 @@ public class PgsqlWorkspaceRepository extends PgsqlCatalogInfoRepository GeoServerInfoRowMapper = (rs, rn) -> decode(rs.getString("info"), GeoServerInfo.class); diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlGeoServerFacade.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigGeoServerFacade.java similarity index 60% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlGeoServerFacade.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigGeoServerFacade.java index ac6376cc2..c5e550b9f 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlGeoServerFacade.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigGeoServerFacade.java @@ -12,13 +12,13 @@ /** * @since 1.4 */ -public class PgsqlGeoServerFacade extends RepositoryGeoServerFacadeImpl { +public class PgconfigGeoServerFacade extends RepositoryGeoServerFacadeImpl { - public PgsqlGeoServerFacade(@NonNull JdbcTemplate template) { - super(new PgsqlConfigRepository(template)); + public PgconfigGeoServerFacade(@NonNull JdbcTemplate template) { + super(new PgconfigConfigRepository(template)); } - public PgsqlGeoServerFacade(@NonNull PgsqlConfigRepository repo) { + public PgconfigGeoServerFacade(@NonNull PgconfigConfigRepository repo) { super(repo); } } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlUpdateSequence.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigUpdateSequence.java similarity index 94% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlUpdateSequence.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigUpdateSequence.java index 227e019a2..cda86dbc3 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlUpdateSequence.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigUpdateSequence.java @@ -22,7 +22,7 @@ * @since 1.4 */ @RequiredArgsConstructor -public class PgsqlUpdateSequence implements UpdateSequence { +public class PgconfigUpdateSequence implements UpdateSequence { private static final String SEQUENCE_NAME = "gs_update_sequence"; @@ -34,7 +34,7 @@ public class PgsqlUpdateSequence implements UpdateSequence { "SELECT NEXTVAL('%s')".formatted(SEQUENCE_NAME); private final @NonNull DataSource dataSource; - private final @NonNull PgsqlGeoServerFacade geoServer; + private final @NonNull PgconfigGeoServerFacade geoServer; @Override public long currValue() { diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/FileSystemResourceStoreCache.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/FileSystemResourceStoreCache.java index ca21632fc..0d354c00f 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/FileSystemResourceStoreCache.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/FileSystemResourceStoreCache.java @@ -46,7 +46,7 @@ private FileSystemResourceStoreCache(@NonNull Path cacheDirectory, boolean dispo @SneakyThrows public static @NonNull FileSystemResourceStoreCache newTempDirInstance() { boolean disposable = true; - Path tempDirectory = Files.createTempDirectory("pgsql_resourcestore_cache"); + Path tempDirectory = Files.createTempDirectory("pgconfig_resourcestore_cache"); return new FileSystemResourceStoreCache(tempDirectory, disposable); } @@ -69,7 +69,7 @@ public void destroy() { } @SneakyThrows - public File getFile(PgsqlResource resource) { + public File getFile(PgconfigResource resource) { final Path path = ensureFileExists(resource); final long fileMtime = getLastmodified(path); final long resourceMtime = resource.lastmodified(); @@ -84,7 +84,7 @@ private long getLastmodified(final Path path) throws IOException { return attr.lastModifiedTime().toMillis(); } - public Path ensureFileExists(PgsqlResource resource) throws IOException { + public Path ensureFileExists(PgconfigResource resource) throws IOException { Preconditions.checkArgument(resource.isFile()); Path path = toPath(resource); if (!Files.exists(path)) { @@ -95,12 +95,12 @@ public Path ensureFileExists(PgsqlResource resource) throws IOException { } @SneakyThrows - public File getDirectory(PgsqlResource resource) { + public File getDirectory(PgconfigResource resource) { return ensureDirectory(resource).toFile(); } @SneakyThrows - public Path ensureDirectory(PgsqlResource resource) { + public Path ensureDirectory(PgconfigResource resource) { Preconditions.checkArgument(resource.isDirectory()); Path path = toPath(resource); return ensureDirectoryExists(path); @@ -114,14 +114,14 @@ private Path ensureDirectoryExists(Path path) throws IOException { } @SneakyThrows - private Path dump(PgsqlResource resource) { + private Path dump(PgconfigResource resource) { try (InputStream in = resource.in()) { return dump(resource, in); } } @SneakyThrows - public Path dump(PgsqlResource resource, InputStream in) { + public Path dump(PgconfigResource resource, InputStream in) { Path file = ensureFileExists(resource); Files.copy(in, file, StandardCopyOption.REPLACE_EXISTING); Files.setLastModifiedTime(file, FileTime.fromMillis(resource.lastmodified())); @@ -130,22 +130,22 @@ public Path dump(PgsqlResource resource, InputStream in) { public void updateAll(List list) { list.stream() - .map(PgsqlResource.class::cast) - .filter(PgsqlResource::isDirectory) + .map(PgconfigResource.class::cast) + .filter(PgconfigResource::isDirectory) .forEach(this::ensureDirectory); list.stream() - .map(PgsqlResource.class::cast) - .filter(PgsqlResource::isFile) + .map(PgconfigResource.class::cast) + .filter(PgconfigResource::isFile) .forEach(this::dump); } - private Path toPath(PgsqlResource resource) { + private Path toPath(PgconfigResource resource) { return base.resolve(resource.path()); } @SneakyThrows - public void moved(@NonNull PgsqlResource source, @NonNull PgsqlResource target) { + public void moved(@NonNull PgconfigResource source, @NonNull PgconfigResource target) { Path sourcePath = toPath(source); if (Files.exists(sourcePath)) { Path targetPath = toPath(target); diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlLockProvider.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigLockProvider.java similarity index 92% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlLockProvider.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigLockProvider.java index afabc532f..657bb837b 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlLockProvider.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigLockProvider.java @@ -23,11 +23,11 @@ * @since 1.4 */ @Slf4j -public class PgsqlLockProvider implements LockProvider { +public class PgconfigLockProvider implements LockProvider { private LockRegistry registry; - public PgsqlLockProvider(LockRegistry registry) { + public PgconfigLockProvider(LockRegistry registry) { Objects.requireNonNull(registry); this.registry = registry; } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResource.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResource.java similarity index 84% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResource.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResource.java index d8ccf87a4..0470c89b3 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResource.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResource.java @@ -22,16 +22,16 @@ * @since 1.4 */ @EqualsAndHashCode(exclude = {"store"}) -class PgsqlResource implements Resource { +class PgconfigResource implements Resource { @Getter long id; @Getter long parentId; Resource.Type type; String path; long lastmodified; - private PgsqlResourceStore store; + private PgconfigResourceStore store; - PgsqlResource( - @NonNull PgsqlResourceStore store, + PgconfigResource( + @NonNull PgconfigResourceStore store, long id, long parentId, @NonNull Resource.Type type, @@ -46,17 +46,17 @@ class PgsqlResource implements Resource { } /** Undefined type factory method */ - static PgsqlResource undefined(@NonNull PgsqlResourceStore store, @NonNull String path) { - return new PgsqlResource( + static PgconfigResource undefined(@NonNull PgconfigResourceStore store, @NonNull String path) { + return new PgconfigResource( store, - PgsqlResourceStore.UNDEFINED_ID, - PgsqlResourceStore.UNDEFINED_ID, + PgconfigResourceStore.UNDEFINED_ID, + PgconfigResourceStore.UNDEFINED_ID, Type.UNDEFINED, path, 0L); } - void copy(PgsqlResource other) { + void copy(PgconfigResource other) { this.id = other.id; this.parentId = other.parentId; this.type = other.type; @@ -106,7 +106,7 @@ public long lastmodified() { } @Override - public PgsqlResource parent() { + public PgconfigResource parent() { return store.getParent(this); } @@ -136,7 +136,7 @@ public boolean delete() { @Override public boolean renameTo(@NonNull Resource dest) { - return store.move(this, ((PgsqlResource) dest)); + return store.move(this, ((PgconfigResource) dest)); } @Override @@ -158,12 +158,12 @@ public String toString() { return path; } - public PgsqlResource mkdirs() { + public PgconfigResource mkdirs() { return store.mkdirs(this); } public boolean exists() { - return id != PgsqlResourceStore.UNDEFINED_ID; + return id != PgconfigResourceStore.UNDEFINED_ID; } public boolean isFile() { diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceRowMapper.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceRowMapper.java similarity index 71% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceRowMapper.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceRowMapper.java index e86ee19c3..c861a27d2 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceRowMapper.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceRowMapper.java @@ -17,9 +17,9 @@ * @since 1.4 */ @RequiredArgsConstructor -public class PgsqlResourceRowMapper implements RowMapper { +public class PgconfigResourceRowMapper implements RowMapper { - private final @NonNull PgsqlResourceStore store; + private final @NonNull PgconfigResourceStore store; /** * Expects the following columns: @@ -33,16 +33,16 @@ public class PgsqlResourceRowMapper implements RowMapper { * } */ @Override - public PgsqlResource mapRow(ResultSet rs, int rowNum) throws SQLException { + public PgconfigResource mapRow(ResultSet rs, int rowNum) throws SQLException { long id = rs.getLong("id"); long parentId = rs.getLong("parentid"); Resource.Type type = Resource.Type.valueOf(rs.getString("type")); String path = rs.getString("path"); long mtime = rs.getTimestamp("mtime").getTime(); - return new PgsqlResource(store, id, parentId, type, path, mtime); + return new PgconfigResource(store, id, parentId, type, path, mtime); } - public PgsqlResource undefined(String path) { - return PgsqlResource.undefined(store, path); + public PgconfigResource undefined(String path) { + return PgconfigResource.undefined(store, path); } } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceStore.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceStore.java similarity index 82% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceStore.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceStore.java index 6c9ae000d..af7ab63c2 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceStore.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceStore.java @@ -44,7 +44,7 @@ */ @Slf4j @Transactional(transactionManager = "pgconfigTransactionManager", propagation = SUPPORTS) -public class PgsqlResourceStore implements ResourceStore { +public class PgconfigResourceStore implements ResourceStore { static final long ROOT_ID = 0L; static final long UNDEFINED_ID = -1L; @@ -53,14 +53,14 @@ public class PgsqlResourceStore implements ResourceStore { private @NonNull @Getter @Setter LockProvider lockProvider; - private final PgsqlResourceRowMapper queryMapper; + private final PgconfigResourceRowMapper queryMapper; private final Predicate fileSystemOnlyPathMatcher; - public PgsqlResourceStore( + public PgconfigResourceStore( @NonNull Path cacheDirectory, @NonNull JdbcTemplate template, - @NonNull PgsqlLockProvider lockProvider, + @NonNull PgconfigLockProvider lockProvider, @NonNull Predicate fileSystemOnlyPathMatcher) { this( FileSystemResourceStoreCache.of(cacheDirectory), @@ -69,14 +69,14 @@ public PgsqlResourceStore( fileSystemOnlyPathMatcher); } - public PgsqlResourceStore( + public PgconfigResourceStore( @NonNull FileSystemResourceStoreCache cache, @NonNull JdbcTemplate template, - @NonNull PgsqlLockProvider lockProvider, + @NonNull PgconfigLockProvider lockProvider, @NonNull Predicate fileSystemOnlyPathMatcher) { this.template = template; this.lockProvider = lockProvider; - this.queryMapper = new PgsqlResourceRowMapper(this); + this.queryMapper = new PgconfigResourceRowMapper(this); this.cache = cache; final String root = ""; Predicate notRoot = path -> !root.equals(path); @@ -84,7 +84,8 @@ public PgsqlResourceStore( } public static Predicate defaultIgnoredDirs() { - return PgsqlResourceStore.simplePathMatcher("temp", "tmp", "legendsamples", "data", "logs"); + return PgconfigResourceStore.simplePathMatcher( + "temp", "tmp", "legendsamples", "data", "logs"); } public static Predicate simplePathMatcher(String... paths) { @@ -111,7 +112,7 @@ public Resource get(@NonNull String path) { @RequiredArgsConstructor static class FileSystemResourceAdaptor implements Resource { @Delegate @NonNull private final Resource delegate; - private final @NonNull PgsqlResourceStore store; + private final @NonNull PgconfigResourceStore store; @Override public Resource parent() { @@ -139,7 +140,7 @@ public boolean remove(@NonNull String path) { if (fileSystemOnlyPathMatcher.test(validPath)) { return cache.getLocalOnlyStore().remove(validPath); } - return findByPath(validPath).map(PgsqlResource::delete).orElse(false); + return findByPath(validPath).map(PgconfigResource::delete).orElse(false); } @Override @@ -147,15 +148,15 @@ public boolean remove(@NonNull String path) { public boolean move(@NonNull String path, @NonNull String target) { Resource from = get(path); Resource to = get(target); - if (from instanceof PgsqlResource pgFrom && to instanceof PgsqlResource pgTo) { - return PgsqlResourceStore.this.move(pgFrom, pgTo); + if (from instanceof PgconfigResource pgFrom && to instanceof PgconfigResource pgTo) { + return PgconfigResourceStore.this.move(pgFrom, pgTo); } - if (from instanceof PgsqlResource) { + if (from instanceof PgconfigResource) { throw new UnsupportedOperationException( "source resource targets database but target resource matches the ignored resources predicate. Source: %s, target: %s" .formatted(path, target)); } - if (to instanceof PgsqlResource) { + if (to instanceof PgconfigResource) { throw new UnsupportedOperationException( "target resource targets database but source resource matches the ignored resources predicate. Source: %s, target: %s" .formatted(path, target)); @@ -174,7 +175,7 @@ private static String normalize(String path) { return path; } - private Optional findByPath(@NonNull String path) { + private Optional findByPath(@NonNull String path) { path = Paths.valid(path); Preconditions.checkArgument( !path.startsWith("/"), "Absolute paths not supported: %s", path); @@ -194,10 +195,10 @@ private Optional findByPath(@NonNull String path) { /** * Creates the resource if it doesn't exist, updates it if it does * - * @throws IllegalArgumentException if {@link PgsqlResource#isUndefined()} + * @throws IllegalArgumentException if {@link PgconfigResource#isUndefined()} */ @Transactional(transactionManager = "pgconfigTransactionManager", propagation = REQUIRED) - public void save(@NonNull PgsqlResource resource) { + public void save(@NonNull PgconfigResource resource) { if (resource.isUndefined()) throw new IllegalArgumentException( "Attempting to save a resource of undefined type: %s".formatted(resource)); @@ -214,7 +215,7 @@ public void save(@NonNull PgsqlResource resource) { String path = resource.path(); template.update(sql, parentId, type, path, id); } else { - PgsqlResource parent = resource.parent().mkdirs(); + PgconfigResource parent = resource.parent().mkdirs(); String sql = """ INSERT INTO resourcestore (parentid, "type", path, content) @@ -226,7 +227,7 @@ INSERT INTO resourcestore (parentid, "type", path, content) byte[] contents = resource.getType() == Type.DIRECTORY ? null : new byte[0]; template.update(sql, parentId, type, path, contents); } - PgsqlResource updated = (PgsqlResource) get(resource.path); + PgconfigResource updated = (PgconfigResource) get(resource.path); resource.id = updated.getId(); resource.lastmodified = updated.lastmodified(); resource.parentId = updated.getParentId(); @@ -237,11 +238,11 @@ INSERT INTO resourcestore (parentid, "type", path, content) * * @return the new resource lastupdated timestamp * @throws IllegalArgumentException if - * {@link PgsqlResource#isDirectory() resource.isDirectory()} || !{@link - * PgsqlResource#exists() resource.exists()} + * {@link PgconfigResource#isDirectory() resource.isDirectory()} || !{@link + * PgconfigResource#exists() resource.exists()} */ @Transactional(transactionManager = "pgconfigTransactionManager", propagation = REQUIRED) - public long save(@NonNull PgsqlResource resource, byte[] contents) { + public long save(@NonNull PgconfigResource resource, byte[] contents) { if (!resource.exists()) throw new IllegalArgumentException( "Resource does not exist: %s".formatted(resource.path())); @@ -270,7 +271,8 @@ public long getLastmodified(long resourceId) { } @Transactional(transactionManager = "pgconfigTransactionManager", propagation = REQUIRED) - public boolean move(@NonNull final PgsqlResource source, @NonNull final PgsqlResource target) { + public boolean move( + @NonNull final PgconfigResource source, @NonNull final PgconfigResource target) { if (source.isUndefined()) return true; if (!source.exists()) { return false; @@ -290,17 +292,17 @@ public boolean move(@NonNull final PgsqlResource source, @NonNull final PgsqlRes target.path()); return false; } - final List allChildren = findAllChildren(source); - PgsqlResource parent = target.parent().mkdirs(); - PgsqlResource save = - new PgsqlResource( + final List allChildren = findAllChildren(source); + PgconfigResource parent = target.parent().mkdirs(); + PgconfigResource save = + new PgconfigResource( this, source.getId(), parent.getId(), source.getType(), target.path(), source.lastmodified()); - PgsqlResourceStore.this.save(save); + PgconfigResourceStore.this.save(save); target.copy(save); source.type = Type.UNDEFINED; @@ -318,7 +320,7 @@ public boolean move(@NonNull final PgsqlResource source, @NonNull final PgsqlRes return true; } - List findAllChildren(PgsqlResource resource) { + List findAllChildren(PgconfigResource resource) { if (!resource.exists() || !resource.isDirectory()) return List.of(); String sql = """ @@ -326,7 +328,7 @@ List findAllChildren(PgsqlResource resource) { """; String likeQuery = resource.path() + "/%"; - try (Stream s = template.queryForStream(sql, queryMapper, likeQuery)) { + try (Stream s = template.queryForStream(sql, queryMapper, likeQuery)) { return s.toList(); } } @@ -341,7 +343,7 @@ public ResourceNotificationDispatcher getResourceNotificationDispatcher() { /** * @return */ - public byte[] contents(PgsqlResource resource) { + public byte[] contents(PgconfigResource resource) { if (!resource.exists() || resource.isUndefined()) throw new IllegalStateException("File not found %s".formatted(resource.path())); if (resource.isDirectory()) @@ -354,7 +356,7 @@ public byte[] contents(PgsqlResource resource) { """, byte[].class, id); } - public boolean delete(PgsqlResource resource) { + public boolean delete(PgconfigResource resource) { String sql = """ DELETE FROM resourcestore WHERE id = ? """; @@ -368,7 +370,7 @@ public boolean delete(PgsqlResource resource) { /** * @return direct children of resource iif resource is a directory, empty list otherwise */ - public List list(PgsqlResource resource) { + public List list(PgconfigResource resource) { if (!resource.exists() || !resource.isDirectory()) return List.of(); String sql = @@ -377,7 +379,7 @@ public List list(PgsqlResource resource) { """; List list; - try (Stream s = + try (Stream s = template.queryForStream(sql, queryMapper, resource.getId())) { // for pre 1.8.1 backwards compatibility, ignore resources that are only to be stored in // the filesystem (e.g. tmp/, temp/, etc) @@ -391,10 +393,10 @@ public List list(PgsqlResource resource) { /** * @return */ - public File asFile(PgsqlResource resource) { + public File asFile(PgconfigResource resource) { if (!resource.exists()) { resource.type = Type.RESOURCE; - PgsqlResourceStore.this.save(resource); + PgconfigResourceStore.this.save(resource); } return cache.getFile(resource); } @@ -403,16 +405,16 @@ public File asFile(PgsqlResource resource) { * @param resource * @return */ - public File asDir(PgsqlResource resource) { + public File asDir(PgconfigResource resource) { if (!resource.exists()) { resource.type = Type.DIRECTORY; - PgsqlResourceStore.this.save(resource); + PgconfigResourceStore.this.save(resource); } return cache.getDirectory(resource); } @Transactional(transactionManager = "pgconfigTransactionManager", propagation = REQUIRED) - public PgsqlResource mkdirs(PgsqlResource resource) { + public PgconfigResource mkdirs(PgconfigResource resource) { if (resource.exists() && resource.isDirectory()) { return resource; } @@ -420,20 +422,20 @@ public PgsqlResource mkdirs(PgsqlResource resource) { throw new IllegalStateException( "mkdirs() can only be called on DIRECTORY or UNDEFINED resources"); - PgsqlResource parent = getParent(resource); + PgconfigResource parent = getParent(resource); if (null == parent) return resource; if (!parent.exists()) { - parent = (PgsqlResource) parent.mkdirs(); + parent = (PgconfigResource) parent.mkdirs(); } resource.parentId = parent.getId(); resource.type = Type.DIRECTORY; - PgsqlResourceStore.this.save(resource); - PgsqlResource saved = (PgsqlResource) get(resource.path()); + PgconfigResourceStore.this.save(resource); + PgconfigResource saved = (PgconfigResource) get(resource.path()); resource.copy(saved); return resource; } - public OutputStream out(PgsqlResource res) { + public OutputStream out(PgconfigResource res) { if (res.isDirectory()) { throw new IllegalStateException("%s is a directory".formatted(res.path())); } @@ -445,21 +447,21 @@ public OutputStream out(PgsqlResource res) { public void close() { if (!res.exists()) { String path = res.path(); - PgsqlResourceStore.this.save(res); - PgsqlResource saved = findByPath(path).orElseThrow(); + PgconfigResourceStore.this.save(res); + PgconfigResource saved = findByPath(path).orElseThrow(); res.copy(saved); } byte[] contents = this.toByteArray(); - long mtime = PgsqlResourceStore.this.save(res, contents); + long mtime = PgconfigResourceStore.this.save(res, contents); res.lastmodified = mtime; cache.dump(res, new ByteArrayInputStream(contents)); } }; } - public PgsqlResource getParent(PgsqlResource resource) { + public PgconfigResource getParent(PgconfigResource resource) { if (ROOT_ID == resource.getId()) return null; String parentPath = resource.parentPath(); - return (PgsqlResource) get(parentPath); + return (PgconfigResource) get(parentPath); } } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/DatabaseMigrationConfiguration.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/DatabaseMigrationConfiguration.java index 06cf9d8a9..a7d82597e 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/DatabaseMigrationConfiguration.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/DatabaseMigrationConfiguration.java @@ -18,13 +18,13 @@ * @since 1.4 */ @Configuration -@EnableConfigurationProperties(PgsqlBackendProperties.class) +@EnableConfigurationProperties(PgconfigBackendProperties.class) public class DatabaseMigrationConfiguration { @Bean - Migrations pgsqlMigrations( - PgsqlBackendProperties config, - @Qualifier("pgsqlConfigDatasource") DataSource dataSource) { + Migrations pgconfigMigrations( + PgconfigBackendProperties config, + @Qualifier("pgconfigDataSource") DataSource dataSource) { return new Migrations(config, dataSource); } @@ -32,14 +32,14 @@ Migrations pgsqlMigrations( @RequiredArgsConstructor public static class Migrations implements InitializingBean { - private final PgsqlBackendProperties config; + private final PgconfigBackendProperties config; private final DataSource dataSource; - private PgsqlDatabaseMigrations databaseMigrations; + private PgconfigDatabaseMigrations databaseMigrations; @Override public void afterPropertiesSet() throws Exception { databaseMigrations = - new PgsqlDatabaseMigrations() + new PgconfigDatabaseMigrations() .setInitialize(config.isInitialize()) .setDataSource(dataSource) .setSchema(config.schema()) @@ -49,7 +49,7 @@ public void afterPropertiesSet() throws Exception { @Override public String toString() { - PgsqlDatabaseMigrations m = databaseMigrations; + PgconfigDatabaseMigrations m = databaseMigrations; return m == null ? "" : m.toString(); } } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlDataSourceConfiguration.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PconfigDataSourceConfiguration.java similarity index 65% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlDataSourceConfiguration.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PconfigDataSourceConfiguration.java index 8be5adb93..bdafb3b40 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlDataSourceConfiguration.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PconfigDataSourceConfiguration.java @@ -8,16 +8,13 @@ import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup; -import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.util.StringUtils; @@ -26,35 +23,32 @@ /** * @since 1.4 */ -@Configuration +@Configuration(proxyBeanMethods = true) @EnableTransactionManagement -@EnableConfigurationProperties(PgsqlBackendProperties.class) +@EnableConfigurationProperties(PgconfigBackendProperties.class) @Slf4j -public class PgsqlDataSourceConfiguration { +public class PconfigDataSourceConfiguration { @Bean @DependsOn("jndiInitializer") - DataSource pgsqlConfigDatasource(PgsqlBackendProperties configprops) { + DataSource pgconfigDataSource(PgconfigBackendProperties configprops) { DataSourceProperties config = configprops.getDatasource(); String jndiName = config.getJndiName(); if (StringUtils.hasText(jndiName)) { - log.info("Creating pgsqlConfigDataSource from JNDI reference {}", jndiName); + log.info("Creating pgconfigDataSource from JNDI reference {}", jndiName); return new JndiDataSourceLookup().getDataSource(jndiName); } return config.initializeDataSourceBuilder().type(HikariDataSource.class).build(); } - @Bean - PlatformTransactionManager pgconfigTransactionManager( - @Qualifier("pgsqlConfigDatasource") DataSource dataSource) { - return new DataSourceTransactionManager(dataSource); - } - @Bean(name = "jndiInitializer") @ConditionalOnMissingBean(name = "jndiInitializer") Object jndiInitializerFallback() { log.warn( - "jndiInitializer is not provided, beware a JNDI datasource definition for the pgsql catalog backend won't work."); + """ + jndiInitializer is not provided, beware a JNDI datasource \ + definition for the pgconfig catalog backend won't work. + """); return new Object(); } } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlBackendConfiguration.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigBackendConfiguration.java similarity index 62% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlBackendConfiguration.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigBackendConfiguration.java index b8c82bb8c..73f1f6122 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlBackendConfiguration.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigBackendConfiguration.java @@ -9,13 +9,13 @@ import org.geoserver.GeoServerConfigurationLock; import org.geoserver.catalog.plugin.ExtendedCatalogFacade; import org.geoserver.catalog.plugin.locking.LockProviderGeoServerConfigurationLock; -import org.geoserver.cloud.backend.pgconfig.PgsqlBackendBuilder; -import org.geoserver.cloud.backend.pgconfig.config.PgsqlConfigRepository; -import org.geoserver.cloud.backend.pgconfig.config.PgsqlGeoServerFacade; -import org.geoserver.cloud.backend.pgconfig.config.PgsqlUpdateSequence; +import org.geoserver.cloud.backend.pgconfig.PgconfigBackendBuilder; +import org.geoserver.cloud.backend.pgconfig.config.PgconfigConfigRepository; +import org.geoserver.cloud.backend.pgconfig.config.PgconfigGeoServerFacade; +import org.geoserver.cloud.backend.pgconfig.config.PgconfigUpdateSequence; import org.geoserver.cloud.backend.pgconfig.resource.FileSystemResourceStoreCache; -import org.geoserver.cloud.backend.pgconfig.resource.PgsqlLockProvider; -import org.geoserver.cloud.backend.pgconfig.resource.PgsqlResourceStore; +import org.geoserver.cloud.backend.pgconfig.resource.PgconfigLockProvider; +import org.geoserver.cloud.backend.pgconfig.resource.PgconfigResourceStore; import org.geoserver.cloud.config.catalog.backend.core.GeoServerBackendConfigurer; import org.geoserver.cloud.config.catalog.backend.pgconfig.DatabaseMigrationConfiguration.Migrations; import org.geoserver.config.GeoServerLoader; @@ -42,38 +42,38 @@ */ @Configuration(proxyBeanMethods = true) @Slf4j(topic = "org.geoserver.cloud.config.catalog.backend.pgconfig") -public class PgsqlBackendConfiguration extends GeoServerBackendConfigurer { +public class PgconfigBackendConfiguration extends GeoServerBackendConfigurer { private String instanceId; private DataSource dataSource; /** - * @param instanceId used as client-id for the {@link #pgsqlLockRepository() LockRepository} - * @param dataSource DataSource for {@link #template()}, {@link #pgsqlLockRepository()}, and + * @param instanceId used as client-id for the {@link #pgconfigLockRepository() LockRepository} + * @param dataSource DataSource for {@link #template()}, {@link #pgconfigLockRepository()}, and * {@link #updateSequence()} * @param catalogProperties properties for {@link #rawCatalog()} * @param migrations required to make sure the migrations ran before this configuration takes * place */ - PgsqlBackendConfiguration( + PgconfigBackendConfiguration( @Value("${info.instance-id:}") String instanceId, - @Qualifier("pgsqlConfigDatasource") DataSource dataSource, + @Qualifier("pgconfigDataSource") DataSource dataSource, Migrations migrations) { this.instanceId = instanceId; this.dataSource = dataSource; log.info( "Loading geoserver config backend with {}. {}", - PgsqlBackendConfiguration.class.getSimpleName(), + PgconfigBackendConfiguration.class.getSimpleName(), migrations); } @Bean @Override protected ExtendedCatalogFacade catalogFacade() { - return new PgsqlBackendBuilder(dataSource).createCatalogFacade(); + return new PgconfigBackendBuilder(dataSource).createCatalogFacade(); } - @Bean(name = "pgsqlCongigJdbcTemplate") + @Bean(name = "pcconfigJdbcTemplate") JdbcTemplate template() { return new JdbcTemplate(dataSource); } @@ -81,47 +81,47 @@ JdbcTemplate template() { @Bean @Override protected GeoServerConfigurationLock configurationLock() { - LockProvider lockProvider = pgsqlLockProvider(); + LockProvider lockProvider = pgconfigLockProvider(); return new LockProviderGeoServerConfigurationLock(lockProvider); } @Bean @Override - protected PgsqlUpdateSequence updateSequence() { - return new PgsqlUpdateSequence(dataSource, geoserverFacade()); + protected PgconfigUpdateSequence updateSequence() { + return new PgconfigUpdateSequence(dataSource, geoserverFacade()); } @Bean @Override protected GeoServerLoader geoServerLoaderImpl() { - log.debug("Creating GeoServerLoader {}", PgsqlGeoServerLoader.class.getSimpleName()); - return new PgsqlGeoServerLoader(resourceLoader(), configurationLock()); + log.debug("Creating GeoServerLoader {}", PgconfigGeoServerLoader.class.getSimpleName()); + return new PgconfigGeoServerLoader(resourceLoader(), configurationLock()); } @Bean - PgsqlConfigRepository configRepository() { - return new PgsqlConfigRepository(template()); + PgconfigConfigRepository configRepository() { + return new PgconfigConfigRepository(template()); } @Bean @Override - protected PgsqlGeoServerFacade geoserverFacade() { - return new PgsqlGeoServerFacade(configRepository()); + protected PgconfigGeoServerFacade geoserverFacade() { + return new PgconfigGeoServerFacade(configRepository()); } @Bean @Override protected ResourceStore resourceStoreImpl() { - log.debug("Creating ResourceStore {}", PgsqlResourceStore.class.getSimpleName()); - FileSystemResourceStoreCache resourceStoreCache = pgsqlFileSystemResourceStoreCache(); + log.debug("Creating ResourceStore {}", PgconfigResourceStore.class.getSimpleName()); + FileSystemResourceStoreCache resourceStoreCache = pgconfigFileSystemResourceStoreCache(); JdbcTemplate template = template(); - PgsqlLockProvider lockProvider = pgsqlLockProvider(); - Predicate ignoreDirs = PgsqlResourceStore.defaultIgnoredDirs(); - return new PgsqlResourceStore(resourceStoreCache, template, lockProvider, ignoreDirs); + PgconfigLockProvider lockProvider = pgconfigLockProvider(); + Predicate ignoreDirs = PgconfigResourceStore.defaultIgnoredDirs(); + return new PgconfigResourceStore(resourceStoreCache, template, lockProvider, ignoreDirs); } @Bean - FileSystemResourceStoreCache pgsqlFileSystemResourceStoreCache() { + FileSystemResourceStoreCache pgconfigFileSystemResourceStoreCache() { return FileSystemResourceStoreCache.newTempDirInstance(); } @@ -130,27 +130,27 @@ FileSystemResourceStoreCache pgsqlFileSystemResourceStoreCache() { protected GeoServerResourceLoader resourceLoader() { log.debug( "Creating GeoServerResourceLoader {}", - PgsqlGeoServerResourceLoader.class.getSimpleName()); + PgconfigGeoServerResourceLoader.class.getSimpleName()); ResourceStore resourceStore = resourceStoreImpl(); - return new PgsqlGeoServerResourceLoader(resourceStore); + return new PgconfigGeoServerResourceLoader(resourceStore); } @Bean - PgsqlLockProvider pgsqlLockProvider() { - log.debug("Creating {}", PgsqlLockProvider.class.getSimpleName()); - return new PgsqlLockProvider(pgsqlLockRegistry()); + PgconfigLockProvider pgconfigLockProvider() { + log.debug("Creating {}", PgconfigLockProvider.class.getSimpleName()); + return new PgconfigLockProvider(pgconfigLockRegistry()); } /** * @return */ - private LockRegistry pgsqlLockRegistry() { + private LockRegistry pgconfigLockRegistry() { log.debug("Creating {}", LockRegistry.class.getSimpleName()); - return new JdbcLockRegistry(pgsqlLockRepository()); + return new JdbcLockRegistry(pgconfigLockRepository()); } @Bean - LockRepository pgsqlLockRepository() { + LockRepository pgconfigLockRepository() { log.debug( "Creating {} for instance {}", LockRepository.class.getSimpleName(), diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlBackendProperties.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigBackendProperties.java similarity index 95% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlBackendProperties.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigBackendProperties.java index 6d77d7def..c4e81be3d 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlBackendProperties.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigBackendProperties.java @@ -15,7 +15,7 @@ */ @Data @ConfigurationProperties("geoserver.backend.pgconfig") -public class PgsqlBackendProperties { +public class PgconfigBackendProperties { private DataSourceProperties datasource; diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlCatalogResourcesSynchronizer.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigCatalogResourcesSynchronizer.java similarity index 97% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlCatalogResourcesSynchronizer.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigCatalogResourcesSynchronizer.java index f278e69ac..8c2aa031e 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlCatalogResourcesSynchronizer.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigCatalogResourcesSynchronizer.java @@ -35,12 +35,12 @@ * @since 1.8.1 */ @Slf4j(topic = "org.geoserver.cloud.config.catalog.backend.pgconfig") -public class PgsqlCatalogResourcesSynchronizer implements CatalogListener, ExtensionPriority { +public class PgconfigCatalogResourcesSynchronizer implements CatalogListener, ExtensionPriority { private GeoServerResourceLoader rl; private GeoServerDataDirectory dd; - public PgsqlCatalogResourcesSynchronizer(GeoServerResourceLoader rl) { + public PgconfigCatalogResourcesSynchronizer(GeoServerResourceLoader rl) { this.rl = rl; this.dd = new GeoServerDataDirectory(rl); } diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlDatabaseMigrations.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigDatabaseMigrations.java similarity index 78% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlDatabaseMigrations.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigDatabaseMigrations.java index 35aecbbfc..4bcd09e2c 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlDatabaseMigrations.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigDatabaseMigrations.java @@ -19,7 +19,7 @@ @Slf4j(topic = "org.geoserver.cloud.config.catalog.backend.pgconfig") @Data @Accessors(chain = true) -public class PgsqlDatabaseMigrations { +public class PgconfigDatabaseMigrations { private DataSource dataSource; private boolean initialize = true; @@ -30,14 +30,14 @@ public class PgsqlDatabaseMigrations { public void migrate() throws Exception { if (!isInitialize()) { - log.warn("Not initializing pgsql backend database as defined in configuration"); + log.warn("Not initializing pgconfig backend database as defined in configuration"); return; } - log.info("Running pgsql backend database migrations..."); + log.info("Running pgconfig backend database migrations..."); Flyway flyway = buildFlyway(); result = flyway.migrate(); log.debug( - "pgsql backend database migration: success: {}, flyway version: {}, database: {}, schema:{}, migrations: {}", + "pgconfig backend database migration: success: {}, flyway version: {}, database: {}, schema:{}, migrations: {}", result.success, result.flywayVersion, result.database, @@ -62,7 +62,7 @@ protected Flyway buildFlyway() { .schemas(schema) .createSchemas(createSchema) .cleanDisabled(cleanDisabled) - .locations("db/pgsqlcatalog/migration") + .locations("db/pgconfig/migration") .load(); } @@ -70,9 +70,9 @@ protected Flyway buildFlyway() { public String toString() { MigrateResult r = this.result; if (null == r) { - return "pgsql backend database migration: not run"; + return "pgconfig backend database migration: not run"; } - return "pgsql backend database migration: success: %s, flyway version: %s, database: %s, schema: %s, migrations: %s" + return "pgconfig backend database migration: success: %s, flyway version: %s, database: %s, schema: %s, migrations: %s" .formatted( r.success, r.flywayVersion, diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlGeoServerLoader.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigGeoServerLoader.java similarity index 96% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlGeoServerLoader.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigGeoServerLoader.java index 2a2985004..9497aa9a1 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlGeoServerLoader.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigGeoServerLoader.java @@ -43,7 +43,7 @@ * @since 1.4 */ @Slf4j -public class PgsqlGeoServerLoader extends GeoServerLoader { +public class PgconfigGeoServerLoader extends GeoServerLoader { private @NonNull GeoServerConfigurationLock configLock; @@ -52,7 +52,7 @@ public class PgsqlGeoServerLoader extends GeoServerLoader { * @param knownServiceTypes know {@link ServiceInfo} types used to initialize a default service * config when starting off an empty config */ - public PgsqlGeoServerLoader( + public PgconfigGeoServerLoader( @NonNull GeoServerResourceLoader resourceLoader, @NonNull GeoServerConfigurationLock configLock) { super(resourceLoader); @@ -69,12 +69,12 @@ public PgsqlGeoServerLoader( @Override protected void loadCatalog(Catalog catalog, XStreamPersister xp) throws Exception { - log.info("Loading catalog with pgsql loader..."); + log.info("Loading catalog with pgconfig loader..."); catalog.removeListeners(GeoServerConfigPersister.class); catalog.removeListeners(GeoServerResourcePersister.class); final boolean backupSldFiles = false; catalog.addListener(new CatalogPluginStyleResourcePersister(catalog, backupSldFiles)); - catalog.addListener(new PgsqlCatalogResourcesSynchronizer(resourceLoader)); + catalog.addListener(new PgconfigCatalogResourcesSynchronizer(resourceLoader)); } /** @@ -110,7 +110,7 @@ private boolean anyStyleMissing(Catalog catalog, String... defaultStyleNames) { @Override protected void loadGeoServer(GeoServer geoServer, XStreamPersister xp) throws Exception { - log.info("loading geoserver config with pgsql loader"); + log.info("loading geoserver config with pgconfig loader"); // to ensure we have a service configuration for every service we know about var missingServices = findMissingServices(geoServer); diff --git a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlGeoServerResourceLoader.java b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigGeoServerResourceLoader.java similarity index 78% rename from src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlGeoServerResourceLoader.java rename to src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigGeoServerResourceLoader.java index 20c0c12f3..c93d539ea 100644 --- a/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgsqlGeoServerResourceLoader.java +++ b/src/catalog/backends/pgconfig/src/main/java/org/geoserver/cloud/config/catalog/backend/pgconfig/PgconfigGeoServerResourceLoader.java @@ -14,12 +14,12 @@ /** * @since 1.4 */ -public class PgsqlGeoServerResourceLoader extends GeoServerResourceLoader { +public class PgconfigGeoServerResourceLoader extends GeoServerResourceLoader { /** * @param resourceStore */ - public PgsqlGeoServerResourceLoader(@NonNull ResourceStore resourceStore) { + public PgconfigGeoServerResourceLoader(@NonNull ResourceStore resourceStore) { super(resourceStore); File baseDirectory = resourceStore.get("").dir(); setBaseDirectory(baseDirectory); diff --git a/src/catalog/backends/pgconfig/src/main/resources/META-INF/spring.factories b/src/catalog/backends/pgconfig/src/main/resources/META-INF/spring.factories index a76016964..f9705be4f 100644 --- a/src/catalog/backends/pgconfig/src/main/resources/META-INF/spring.factories +++ b/src/catalog/backends/pgconfig/src/main/resources/META-INF/spring.factories @@ -1,5 +1,6 @@ # Auto Configure org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgsqlDataSourceAutoConfiguration,\ -org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgsqlMigrationAutoConfiguration,\ -org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgsqlBackendAutoConfiguration \ No newline at end of file +org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigDataSourceAutoConfiguration,\ +org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigTransactionManagerAutoConfiguration,\ +org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigMigrationAutoConfiguration,\ +org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigBackendAutoConfiguration \ No newline at end of file diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_0__Catalog_Tables.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_0__Catalog_Tables.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_0__Catalog_Tables.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_0__Catalog_Tables.sql diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_1__Catalog_Query_Tables.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_1__Catalog_Query_Tables.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_1__Catalog_Query_Tables.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_1__Catalog_Query_Tables.sql diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_2__Catalog_Full_Text_Search.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_2__Catalog_Full_Text_Search.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_2__Catalog_Full_Text_Search.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_2__Catalog_Full_Text_Search.sql diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_3__Config_Tables.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_3__Config_Tables.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_3__Config_Tables.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_3__Config_Tables.sql diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_4_1__Fix_StoreInfosView.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_4_1__Fix_StoreInfosView.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_4_1__Fix_StoreInfosView.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_4_1__Fix_StoreInfosView.sql diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_4__ResourceStore_Tables.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_4__ResourceStore_Tables.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_4__ResourceStore_Tables.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_4__ResourceStore_Tables.sql diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_5__TileLayer_Tables.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_5__TileLayer_Tables.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_5__TileLayer_Tables.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_5__TileLayer_Tables.sql diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_6__ResourceStore_NoCTE.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_6__ResourceStore_NoCTE.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_6__ResourceStore_NoCTE.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_6__ResourceStore_NoCTE.sql diff --git a/src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_7__PublishedInfo_Multivalued_Id_Queryables.sql b/src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_7__PublishedInfo_Multivalued_Id_Queryables.sql similarity index 100% rename from src/catalog/backends/pgconfig/src/main/resources/db/pgsqlcatalog/migration/postgresql/V1_7__PublishedInfo_Multivalued_Id_Queryables.sql rename to src/catalog/backends/pgconfig/src/main/resources/db/pgconfig/migration/postgresql/V1_7__PublishedInfo_Multivalued_Id_Queryables.sql diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlBackendAutoConfigurationTest.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigBackendAutoConfigurationTest.java similarity index 55% rename from src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlBackendAutoConfigurationTest.java rename to src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigBackendAutoConfigurationTest.java index 072059130..103d90c14 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlBackendAutoConfigurationTest.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigBackendAutoConfigurationTest.java @@ -8,14 +8,14 @@ import org.geoserver.GeoServerConfigurationLock; import org.geoserver.catalog.plugin.ExtendedCatalogFacade; -import org.geoserver.cloud.backend.pgconfig.catalog.PgsqlCatalogFacade; -import org.geoserver.cloud.backend.pgconfig.config.PgsqlConfigRepository; -import org.geoserver.cloud.backend.pgconfig.config.PgsqlGeoServerFacade; -import org.geoserver.cloud.backend.pgconfig.config.PgsqlUpdateSequence; -import org.geoserver.cloud.backend.pgconfig.resource.PgsqlLockProvider; +import org.geoserver.cloud.backend.pgconfig.catalog.PgconfigCatalogFacade; +import org.geoserver.cloud.backend.pgconfig.config.PgconfigConfigRepository; +import org.geoserver.cloud.backend.pgconfig.config.PgconfigGeoServerFacade; +import org.geoserver.cloud.backend.pgconfig.config.PgconfigUpdateSequence; +import org.geoserver.cloud.backend.pgconfig.resource.PgconfigLockProvider; import org.geoserver.cloud.backend.pgconfig.support.PgConfigTestContainer; -import org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlGeoServerLoader; -import org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlGeoServerResourceLoader; +import org.geoserver.cloud.config.catalog.backend.pgconfig.PgconfigGeoServerLoader; +import org.geoserver.cloud.config.catalog.backend.pgconfig.PgconfigGeoServerResourceLoader; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -25,12 +25,12 @@ import org.testcontainers.junit.jupiter.Testcontainers; /** - * Test suite for {@link PgsqlBackendAutoConfiguration} + * Test suite for {@link PgconfigBackendAutoConfiguration} * * @since 1.4 */ @Testcontainers(disabledWithoutDocker = true) -class PgsqlBackendAutoConfigurationTest { +class PgconfigBackendAutoConfigurationTest { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); @@ -38,9 +38,10 @@ class PgsqlBackendAutoConfigurationTest { new ApplicationContextRunner() .withConfiguration( AutoConfigurations.of( - PgsqlDataSourceAutoConfiguration.class, - PgsqlMigrationAutoConfiguration.class, - PgsqlBackendAutoConfiguration.class)); + PgconfigDataSourceAutoConfiguration.class, + PgconfigTransactionManagerAutoConfiguration.class, + PgconfigMigrationAutoConfiguration.class, + PgconfigBackendAutoConfiguration.class)); @BeforeEach void setUp() throws Exception { @@ -56,18 +57,18 @@ void testCatalogAndConfigBeans() { .hasBean("pgconfigTransactionManager") .hasSingleBean(JdbcTemplate.class) .hasSingleBean(GeoServerConfigurationLock.class) - .hasSingleBean(PgsqlUpdateSequence.class) - .hasSingleBean(PgsqlCatalogFacade.class) - .hasSingleBean(PgsqlGeoServerLoader.class) - .hasSingleBean(PgsqlConfigRepository.class) - .hasSingleBean(PgsqlGeoServerFacade.class) + .hasSingleBean(PgconfigUpdateSequence.class) + .hasSingleBean(PgconfigCatalogFacade.class) + .hasSingleBean(PgconfigGeoServerLoader.class) + .hasSingleBean(PgconfigConfigRepository.class) + .hasSingleBean(PgconfigGeoServerFacade.class) .hasBean("resourceStoreImpl") - .hasSingleBean(PgsqlGeoServerResourceLoader.class) - .hasSingleBean(PgsqlLockProvider.class); + .hasSingleBean(PgconfigGeoServerResourceLoader.class) + .hasSingleBean(PgconfigLockProvider.class); ExtendedCatalogFacade catalogFacade = context.getBean("catalogFacade", ExtendedCatalogFacade.class); - assertThat(catalogFacade).isInstanceOf(PgsqlCatalogFacade.class); + assertThat(catalogFacade).isInstanceOf(PgconfigCatalogFacade.class); }); } } diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlDataSourceAutoConfigurationTest.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigDataSourceAutoConfigurationTest.java similarity index 77% rename from src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlDataSourceAutoConfigurationTest.java rename to src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigDataSourceAutoConfigurationTest.java index 3ed5d93c5..77056befe 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlDataSourceAutoConfigurationTest.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigDataSourceAutoConfigurationTest.java @@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.geoserver.cloud.backend.pgconfig.support.PgConfigTestContainer; -import org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlDataSourceConfiguration; +import org.geoserver.cloud.config.catalog.backend.pgconfig.PconfigDataSourceConfiguration; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.BeansException; @@ -27,20 +27,20 @@ import javax.sql.DataSource; /** - * Tests for {@link PgsqlDataSourceConfiguration} + * Tests for {@link PconfigDataSourceConfiguration} * * @since 1.4 */ @Testcontainers(disabledWithoutDocker = true) @Slf4j -class PgsqlDataSourceAutoConfigurationTest { +class PgconfigDataSourceAutoConfigurationTest { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); private ApplicationContextRunner runner = new ApplicationContextRunner() .withConfiguration( - AutoConfigurations.of(PgsqlDataSourceAutoConfiguration.class)); + AutoConfigurations.of(PgconfigDataSourceAutoConfiguration.class)); String url; String username; @@ -55,7 +55,7 @@ void setUp() throws Exception { /** * Test method for {@link - * org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlDataSourceConfiguration#dataSource()}. + * org.geoserver.cloud.config.catalog.backend.pgconfig.PconfigDataSourceConfiguration#dataSource()}. */ @Test void testDataSource() { @@ -65,8 +65,8 @@ void testDataSource() { context -> { assertThat(context) .hasNotFailed() - .hasBean("pgsqlConfigDatasource") - .getBean("pgsqlConfigDatasource") + .hasBean("pgconfigDataSource") + .getBean("pgconfigDataSource") .isInstanceOf(DataSource.class); assertIsPostgresql(context); @@ -75,7 +75,7 @@ void testDataSource() { /** * Test method for {@link - * org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlDataSourceConfiguration#jndiDataSource()}. + * org.geoserver.cloud.config.catalog.backend.pgconfig.PconfigDataSourceConfiguration#jndiDataSource()}. */ @Test void testJndiDataSource() { @@ -85,8 +85,8 @@ void testJndiDataSource() { context -> { assertThat(context) .hasNotFailed() - .hasBean("pgsqlConfigDatasource") - .getBean("pgsqlConfigDatasource") + .hasBean("pgconfigDataSource") + .getBean("pgconfigDataSource") .isInstanceOf(DataSource.class); assertIsPostgresql(context); }); @@ -95,7 +95,7 @@ void testJndiDataSource() { private void assertIsPostgresql(AssertableApplicationContext context) throws BeansException, SQLException { try (Connection c = - context.getBean("pgsqlConfigDatasource", DataSource.class).getConnection()) { + context.getBean("pgconfigDataSource", DataSource.class).getConnection()) { assertThat(c.isValid(2)).isTrue(); try (Statement st = c.createStatement(); diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlMigrationAutoConfigurationTest.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigMigrationAutoConfigurationTest.java similarity index 85% rename from src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlMigrationAutoConfigurationTest.java rename to src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigMigrationAutoConfigurationTest.java index b97cd0200..e7bca1141 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgsqlMigrationAutoConfigurationTest.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/pgconfig/PgconfigMigrationAutoConfigurationTest.java @@ -7,7 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat; import org.geoserver.cloud.backend.pgconfig.support.PgConfigTestContainer; -import org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlBackendProperties; +import org.geoserver.cloud.config.catalog.backend.pgconfig.PgconfigBackendProperties; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; @@ -30,7 +30,7 @@ * @since 1.4 */ @Testcontainers(disabledWithoutDocker = true) -class PgsqlMigrationAutoConfigurationTest { +class PgconfigMigrationAutoConfigurationTest { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); @@ -38,8 +38,8 @@ class PgsqlMigrationAutoConfigurationTest { new ApplicationContextRunner() .withConfiguration( AutoConfigurations.of( - PgsqlDataSourceAutoConfiguration.class, - PgsqlMigrationAutoConfiguration.class)); + PgconfigDataSourceAutoConfiguration.class, + PgconfigMigrationAutoConfiguration.class)); @Test void testMigration_enabledByDefault() { @@ -49,18 +49,18 @@ void testMigration_enabledByDefault() { context -> { assertThat(context) .hasNotFailed() - .hasSingleBean(PgsqlBackendProperties.class) - .hasBean("pgsqlConfigDatasource"); + .hasSingleBean(PgconfigBackendProperties.class) + .hasBean("pgconfigDataSource"); - PgsqlBackendProperties config = - context.getBean(PgsqlBackendProperties.class); - DataSource ds = - context.getBean("pgsqlConfigDatasource", DataSource.class); + PgconfigBackendProperties config = + context.getBean(PgconfigBackendProperties.class); + DataSource ds = context.getBean("pgconfigDataSource", DataSource.class); assertDbSchema(ds, config); }); } - private void assertDbSchema(DataSource ds, PgsqlBackendProperties config) throws SQLException { + private void assertDbSchema(DataSource ds, PgconfigBackendProperties config) + throws SQLException { String schema = config.schema(); Map expected = buildExpected(schema); Map actual = findTables(ds, schema); diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/PgsqlCatalogBackendConformanceTest.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/PgconfigCatalogBackendConformanceTest.java similarity index 76% rename from src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/PgsqlCatalogBackendConformanceTest.java rename to src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/PgconfigCatalogBackendConformanceTest.java index 333ecbbfb..d199aadb0 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/PgsqlCatalogBackendConformanceTest.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/PgconfigCatalogBackendConformanceTest.java @@ -8,11 +8,11 @@ import org.geoserver.catalog.plugin.CatalogConformanceTest; import org.geoserver.catalog.plugin.CatalogPlugin; import org.geoserver.catalog.plugin.CatalogPluginStyleResourcePersister; -import org.geoserver.cloud.backend.pgconfig.PgsqlBackendBuilder; -import org.geoserver.cloud.backend.pgconfig.resource.PgsqlLockProvider; -import org.geoserver.cloud.backend.pgconfig.resource.PgsqlResourceStore; +import org.geoserver.cloud.backend.pgconfig.PgconfigBackendBuilder; +import org.geoserver.cloud.backend.pgconfig.resource.PgconfigLockProvider; +import org.geoserver.cloud.backend.pgconfig.resource.PgconfigResourceStore; import org.geoserver.cloud.backend.pgconfig.support.PgConfigTestContainer; -import org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlGeoServerResourceLoader; +import org.geoserver.cloud.config.catalog.backend.pgconfig.PgconfigGeoServerResourceLoader; import org.geotools.util.logging.Logging; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -34,7 +34,7 @@ * @since 1.4 */ @Testcontainers(disabledWithoutDocker = true) -class PgsqlCatalogBackendConformanceTest extends CatalogConformanceTest { +class PgconfigCatalogBackendConformanceTest extends CatalogConformanceTest { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); @@ -53,29 +53,30 @@ void cleanDb() throws Exception { @Override protected CatalogImpl createCatalog(File tmpFolder) { JdbcTemplate template = container.getTemplate(); - PgsqlLockProvider lockProvider = new PgsqlLockProvider(pgsqlLockRegistry()); + PgconfigLockProvider lockProvider = new PgconfigLockProvider(pgconfigLockRegistry()); File cacheDirectory = tmpFolder; - PgsqlResourceStore resourceStore = - new PgsqlResourceStore( + PgconfigResourceStore resourceStore = + new PgconfigResourceStore( cacheDirectory.toPath(), template, lockProvider, - PgsqlResourceStore.defaultIgnoredDirs()); + PgconfigResourceStore.defaultIgnoredDirs()); - var resourceLoader = new PgsqlGeoServerResourceLoader(resourceStore); - CatalogPlugin catalog = new PgsqlBackendBuilder(container.getDataSource()).createCatalog(); + var resourceLoader = new PgconfigGeoServerResourceLoader(resourceStore); + CatalogPlugin catalog = + new PgconfigBackendBuilder(container.getDataSource()).createCatalog(); catalog.setResourceLoader(resourceLoader); final boolean backupSldFiles = false; catalog.addListener(new CatalogPluginStyleResourcePersister(catalog, backupSldFiles)); return catalog; } - private LockRegistry pgsqlLockRegistry() { - return new JdbcLockRegistry(pgsqlLockRepository()); + private LockRegistry pgconfigLockRegistry() { + return new JdbcLockRegistry(pgconfigLockRepository()); } - LockRepository pgsqlLockRepository() { + LockRepository pgconfigLockRepository() { DataSource dataSource = container.getDataSource(); DefaultLockRepository lockRepository = new DefaultLockRepository(dataSource, "test-instance"); diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlWorkspaceRepositoryTest.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigWorkspaceRepositoryTest.java similarity index 89% rename from src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlWorkspaceRepositoryTest.java rename to src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigWorkspaceRepositoryTest.java index 51615216d..4d3fbc524 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgsqlWorkspaceRepositoryTest.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/catalog/repository/PgconfigWorkspaceRepositoryTest.java @@ -21,16 +21,16 @@ * @since 1.4 */ @Testcontainers(disabledWithoutDocker = true) -class PgsqlWorkspaceRepositoryTest { +class PgconfigWorkspaceRepositoryTest { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); - PgsqlWorkspaceRepository repo; + PgconfigWorkspaceRepository repo; @BeforeEach void setUp() { container.setUp(); - repo = new PgsqlWorkspaceRepository(container.getTemplate()); + repo = new PgconfigWorkspaceRepository(container.getTemplate()); } @AfterEach diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlConfigRepositoryConformanceTest.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigConfigRepositoryConformanceTest.java similarity index 83% rename from src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlConfigRepositoryConformanceTest.java rename to src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigConfigRepositoryConformanceTest.java index 8230445f3..a94c31dfc 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlConfigRepositoryConformanceTest.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigConfigRepositoryConformanceTest.java @@ -5,7 +5,7 @@ package org.geoserver.cloud.backend.pgconfig.config; import org.geoserver.catalog.Catalog; -import org.geoserver.cloud.backend.pgconfig.PgsqlBackendBuilder; +import org.geoserver.cloud.backend.pgconfig.PgconfigBackendBuilder; import org.geoserver.cloud.backend.pgconfig.support.PgConfigTestContainer; import org.geoserver.config.GeoServer; import org.geoserver.config.GeoServerConfigConformanceTest; @@ -19,7 +19,7 @@ * @since 1.4 */ @Testcontainers(disabledWithoutDocker = true) -class PgsqlConfigRepositoryConformanceTest extends GeoServerConfigConformanceTest { +class PgconfigConfigRepositoryConformanceTest extends GeoServerConfigConformanceTest { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); @@ -36,7 +36,7 @@ void cleanDb() throws Exception { } protected @Override GeoServer createGeoServer() { - PgsqlBackendBuilder builder = new PgsqlBackendBuilder(container.getDataSource()); + PgconfigBackendBuilder builder = new PgconfigBackendBuilder(container.getDataSource()); Catalog catalog = builder.createCatalog(); GeoServerImpl gs = builder.createGeoServer(catalog); return gs; diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlUpdateSequenceTest.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigUpdateSequenceTest.java similarity index 83% rename from src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlUpdateSequenceTest.java rename to src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigUpdateSequenceTest.java index e92633b3f..4274a9a0b 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgsqlUpdateSequenceTest.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/config/PgconfigUpdateSequenceTest.java @@ -18,20 +18,20 @@ * @since 1.4 */ @Testcontainers(disabledWithoutDocker = true) -class PgsqlUpdateSequenceTest implements UpdateSequenceConformanceTest { +class PgconfigUpdateSequenceTest implements UpdateSequenceConformanceTest { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); private UpdateSequence sequence; - private PgsqlGeoServerFacade facade; + private PgconfigGeoServerFacade facade; private GeoServer geoserver; @BeforeEach public void init() throws Exception { container.setUp(); - facade = new PgsqlGeoServerFacade(container.getTemplate()); + facade = new PgconfigGeoServerFacade(container.getTemplate()); geoserver = new GeoServerImpl(facade); - sequence = new PgsqlUpdateSequence(container.getDataSource(), facade); + sequence = new PgconfigUpdateSequence(container.getDataSource(), facade); } @AfterEach diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceTest.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceTest.java similarity index 90% rename from src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceTest.java rename to src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceTest.java index 48525a2bf..e2e3153f3 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/resource/PgsqlResourceTest.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/resource/PgconfigResourceTest.java @@ -62,12 +62,12 @@ */ @Slf4j @RunWith(Theories.class) -public class PgsqlResourceTest extends ResourceTheoryTest { +public class PgconfigResourceTest extends ResourceTheoryTest { public @ClassRule static PgConfigTestContainer container = new PgConfigTestContainer<>(); public @Rule TemporaryFolder tmpDir = new TemporaryFolder(); - private PgsqlResourceStore store; + private PgconfigResourceStore store; private File cacheDirectory; @DataPoints @@ -102,14 +102,14 @@ public static void oneTimeTeardown() { @Before public void setUp() throws Exception { JdbcTemplate template = container.getTemplate(); - PgsqlLockProvider lockProvider = new PgsqlLockProvider(pgsqlLockRegistry()); + PgconfigLockProvider lockProvider = new PgconfigLockProvider(pgconfigLockRegistry()); cacheDirectory = tmpDir.newFolder(); store = - new PgsqlResourceStore( + new PgconfigResourceStore( cacheDirectory.toPath(), template, lockProvider, - PgsqlResourceStore.defaultIgnoredDirs()); + PgconfigResourceStore.defaultIgnoredDirs()); setupTestData(template); } @@ -152,11 +152,11 @@ INSERT INTO resourcestore (parentid, path, "type", content) /** * @return */ - private LockRegistry pgsqlLockRegistry() { - return new JdbcLockRegistry(pgsqlLockRepository()); + private LockRegistry pgconfigLockRegistry() { + return new JdbcLockRegistry(pgconfigLockRepository()); } - LockRepository pgsqlLockRepository() { + LockRepository pgconfigLockRepository() { DataSource dataSource = container.getDataSource(); DefaultLockRepository lockRepository = new DefaultLockRepository(dataSource, "test-instance"); @@ -173,8 +173,8 @@ protected Resource getDirectory() { return Arrays.stream(testPaths()) .filter(path -> Paths.name(path).contains("Dir")) .map(store::get) - .map(PgsqlResource.class::cast) - .filter(PgsqlResource::isDirectory) + .map(PgconfigResource.class::cast) + .filter(PgconfigResource::isDirectory) .findFirst() .orElseThrow(); } @@ -184,8 +184,8 @@ protected Resource getResource() { return Arrays.stream(testPaths()) .filter(path -> Paths.name(path).contains("File")) .map(store::get) - .map(PgsqlResource.class::cast) - .filter(PgsqlResource::isFile) + .map(PgconfigResource.class::cast) + .filter(PgconfigResource::isFile) .findFirst() .orElseThrow(); } @@ -195,8 +195,8 @@ protected Resource getUndefined() { return Arrays.stream(testPaths()) .filter(path -> Paths.name(path).contains("UndefF")) .map(store::get) - .map(PgsqlResource.class::cast) - .filter(PgsqlResource::isUndefined) + .map(PgconfigResource.class::cast) + .filter(PgconfigResource::isUndefined) .findFirst() .orElseThrow(); } @@ -276,8 +276,8 @@ public void testRemoveIgnoredFiles() { private void assertFileSystemFile(String path) { Resource resource = getResource(path); assertFileSystemDir(resource.parent().path()); - assertFalse(resource instanceof PgsqlResource); - assertTrue(resource instanceof PgsqlResourceStore.FileSystemResourceAdaptor); + assertFalse(resource instanceof PgconfigResource); + assertTrue(resource instanceof PgconfigResourceStore.FileSystemResourceAdaptor); assertTrue( resource.file() .getAbsolutePath() @@ -286,8 +286,8 @@ private void assertFileSystemFile(String path) { private void assertFileSystemDir(String path) { Resource resource = getResource(path); - assertFalse(resource instanceof PgsqlResource); - assertTrue(resource instanceof PgsqlResourceStore.FileSystemResourceAdaptor); + assertFalse(resource instanceof PgconfigResource); + assertTrue(resource instanceof PgconfigResourceStore.FileSystemResourceAdaptor); assertTrue( resource.dir().getAbsolutePath().startsWith(this.cacheDirectory.getAbsolutePath())); } @@ -317,16 +317,16 @@ private void testRootResourceFilesystem(String dirname) { assertEquals(UNDEFINED, dir.getType()); assertEquals(UNDEFINED, file.getType()); - assertTrue(root instanceof PgsqlResource); - assertFalse(dir instanceof PgsqlResource); - assertFalse(file instanceof PgsqlResource); - assertFalse(dir.get(file.name()) instanceof PgsqlResource); + assertTrue(root instanceof PgconfigResource); + assertFalse(dir instanceof PgconfigResource); + assertFalse(file instanceof PgconfigResource); + assertFalse(dir.get(file.name()) instanceof PgconfigResource); Resource parent = file.parent(); assertEquals(dir, parent); assertEquals(root, dir.parent()); - assertTrue(dir.parent().get("workspaces") instanceof PgsqlResource); + assertTrue(dir.parent().get("workspaces") instanceof PgconfigResource); } private void testRemoveFilesystemOnlyFile(String path) { @@ -344,7 +344,7 @@ public void trestRemovePathInDatabase() { store.get("workspaces/ws1").dir(); store.get("workspaces/ws1/workspace.xml").file(); - assertTrue(store.get("workspaces/ws1/workspace.xml") instanceof PgsqlResource); + assertTrue(store.get("workspaces/ws1/workspace.xml") instanceof PgconfigResource); assertEquals(RESOURCE, store.get("workspaces/ws1/workspace.xml").getType()); assertTrue(store.remove("workspaces/ws1/workspace.xml")); @@ -358,7 +358,7 @@ public void trestMovePathInDatabase() { store.move("workspaces/ws1", "workspaces/ws2"); assertEquals(DIRECTORY, store.get("workspaces/ws2").getType()); assertEquals(UNDEFINED, store.get("workspaces/ws1").getType()); - assertTrue(store.get("workspaces/ws2") instanceof PgsqlResource); + assertTrue(store.get("workspaces/ws2") instanceof PgconfigResource); } /** @@ -376,7 +376,7 @@ public void trestMoveSameTarget() { assertEquals(DIRECTORY, store.get("workspaces/ws1").getType()); assertEquals(RESOURCE, store.get("workspaces/ws1/workspace.xml").getType()); - assertTrue(store.get("workspaces/ws2") instanceof PgsqlResource); + assertTrue(store.get("workspaces/ws2") instanceof PgconfigResource); } @Test @@ -388,7 +388,7 @@ public void trestMovePathFilesystemOnly() { store.move("legendsamples/sample.png", "legendsamples/sample2.png"); assertEquals(UNDEFINED, store.get("legendsamples/sample.png").getType()); assertEquals(RESOURCE, store.get("legendsamples/sample2.png").getType()); - assertFalse(store.get("legendsamples/sample2.png") instanceof PgsqlResource); + assertFalse(store.get("legendsamples/sample2.png") instanceof PgconfigResource); } @Test @@ -424,7 +424,7 @@ INSERT INTO resourcestore (parentid, "type", path, content) st.setObject(4, null); st.executeUpdate(); } - PgsqlResource root = (PgsqlResource) store.get(""); + PgconfigResource root = (PgconfigResource) store.get(""); List children = store.list(root); assertThat( children.stream() diff --git a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/support/PgConfigTestContainer.java b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/support/PgConfigTestContainer.java index 8a04a3afa..f53085ccb 100644 --- a/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/support/PgConfigTestContainer.java +++ b/src/catalog/backends/pgconfig/src/test/java/org/geoserver/cloud/backend/pgconfig/support/PgConfigTestContainer.java @@ -10,7 +10,7 @@ import lombok.Getter; import lombok.SneakyThrows; -import org.geoserver.cloud.config.catalog.backend.pgconfig.PgsqlDatabaseMigrations; +import org.geoserver.cloud.config.catalog.backend.pgconfig.PgconfigDatabaseMigrations; import org.geoserver.cloud.config.jndi.SimpleJNDIStaticContextInitializer; import org.geoserver.cloud.config.jndidatasource.JNDIDataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -24,7 +24,8 @@ /** * A {@link Testcontainers test container} based on {@link PostgreSQLContainer} using PostgreSQL 15 * to aid in setting up the {@code DataSource}, {@code JdbcTemplate}, and {@link - * PgsqlDatabaseMigrations Flyway} database migrations for the {@literal pgconfig} catalog backend. + * PgconfigDatabaseMigrations Flyway} database migrations for the {@literal pgconfig} catalog + * backend. * * @since 1.6 */ @@ -34,7 +35,7 @@ public class PgConfigTestContainer> private @Getter DataSource dataSource; private @Getter JdbcTemplate template; private @Getter String schema = "pgconfigtest"; - private @Getter PgsqlDatabaseMigrations databaseMigrations; + private @Getter PgconfigDatabaseMigrations databaseMigrations; public PgConfigTestContainer() { super("postgres:15"); @@ -56,7 +57,7 @@ public PgConfigTestContainer setUp() { dataSource = new HikariDataSource(hikariConfig); template = new JdbcTemplate(dataSource); databaseMigrations = - new PgsqlDatabaseMigrations() + new PgconfigDatabaseMigrations() .setSchema(schema) .setDataSource(dataSource) .setCleanDisabled(false); @@ -101,7 +102,7 @@ public void tearDown() { "jndi.datasources.testdb.url: " + url, "jndi.datasources.testdb.username: " + username, // "jndi.datasources.testdb.password: " + password, // - // pgsql backend datasource config using jndi + // pgconfig backend datasource config using jndi "geoserver.backend.pgconfig.datasource.jndi-name: java:comp/env/jdbc/testdb"); } } diff --git a/src/catalog/backends/pgconfig/src/test/resources/application-test.yml b/src/catalog/backends/pgconfig/src/test/resources/application-test.yml index 402894936..3223e6250 100644 --- a/src/catalog/backends/pgconfig/src/test/resources/application-test.yml +++ b/src/catalog/backends/pgconfig/src/test/resources/application-test.yml @@ -2,7 +2,7 @@ geoserver: backend: - pgsql: + pgconfig: initialize: true schema: gscatalog create-schema: true diff --git a/src/catalog/backends/pgconfig/src/test/resources/logback-test.xml b/src/catalog/backends/pgconfig/src/test/resources/logback-test.xml index 7de37c2df..239a22e04 100644 --- a/src/catalog/backends/pgconfig/src/test/resources/logback-test.xml +++ b/src/catalog/backends/pgconfig/src/test/resources/logback-test.xml @@ -14,8 +14,7 @@ - - + diff --git a/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/DefaultTileLayerCatalogAutoConfiguration.java b/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/DefaultTileLayerCatalogAutoConfiguration.java index 9c17d8509..c8fddc9c9 100644 --- a/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/DefaultTileLayerCatalogAutoConfiguration.java +++ b/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/DefaultTileLayerCatalogAutoConfiguration.java @@ -25,7 +25,7 @@ * @see ConditionalOnGeoWebCacheEnabled * @since 1.0 */ -@AutoConfiguration(after = PgsqlTileLayerCatalogAutoConfiguration.class) +@AutoConfiguration(after = PgconfigTileLayerCatalogAutoConfiguration.class) @ConditionalOnGeoWebCacheEnabled @ConditionalOnMissingBean(GeoServerTileLayerConfiguration.class) @Import(DefaultTileLayerCatalogConfiguration.class) diff --git a/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlGwcInitializer.java b/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigGwcInitializer.java similarity index 96% rename from src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlGwcInitializer.java rename to src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigGwcInitializer.java index c7b0b3208..871de8ea8 100644 --- a/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlGwcInitializer.java +++ b/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigGwcInitializer.java @@ -13,7 +13,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.geoserver.cloud.gwc.backend.pgconfig.PgsqlTileLayerCatalog; +import org.geoserver.cloud.gwc.backend.pgconfig.PgconfigTileLayerCatalog; import org.geoserver.cloud.gwc.event.TileLayerEvent; import org.geoserver.cloud.gwc.repository.GeoServerTileLayerConfiguration; import org.geoserver.config.GeoServer; @@ -41,9 +41,9 @@ /** * Replacement for {@link GWCInitializer} when using the "pgconfig" storage. * - *

This is required because {@link PgsqlTileLayerCatalogAutoConfiguration} does not set up a + *

This is required because {@link PgconfigTileLayerCatalogAutoConfiguration} does not set up a * {@link TileLayerCatalog}, which {@link GWCInitializer} requires, but a {@link - * PgsqlTileLayerCatalog} instead, which directly implements {@link TileLayerConfiguration} to be + * PgconfigTileLayerCatalog} instead, which directly implements {@link TileLayerConfiguration} to be * contributed to {@link TileLayerDispatcher}. * *

This {@link GeoServerReinitializer} is hence in charge of notifying {@link @@ -59,7 +59,7 @@ */ @RequiredArgsConstructor @Slf4j(topic = "org.geoserver.cloud.autoconfigure.gwc.backend") -class PgsqlGwcInitializer implements GeoServerReinitializer { +class PgconfigGwcInitializer implements GeoServerReinitializer { private final @NonNull GWCConfigPersister configPersister; private final @NonNull ConfigurableBlobStore blobStore; diff --git a/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlTileLayerCatalogAutoConfiguration.java b/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigTileLayerCatalogAutoConfiguration.java similarity index 79% rename from src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlTileLayerCatalogAutoConfiguration.java rename to src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigTileLayerCatalogAutoConfiguration.java index 8351b1974..a4ef5ef65 100644 --- a/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlTileLayerCatalogAutoConfiguration.java +++ b/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigTileLayerCatalogAutoConfiguration.java @@ -8,11 +8,12 @@ import lombok.extern.slf4j.Slf4j; import org.geoserver.catalog.Catalog; -import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.ConditionalOnPgsqlBackendEnabled; +import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.ConditionalOnPgconfigBackendEnabled; +import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigDataSourceAutoConfiguration; import org.geoserver.cloud.autoconfigure.gwc.ConditionalOnGeoWebCacheEnabled; import org.geoserver.cloud.gwc.backend.pgconfig.CachingTileLayerInfoRepository; -import org.geoserver.cloud.gwc.backend.pgconfig.PgsqlTileLayerCatalog; -import org.geoserver.cloud.gwc.backend.pgconfig.PgsqlTileLayerInfoRepository; +import org.geoserver.cloud.gwc.backend.pgconfig.PgconfigTileLayerCatalog; +import org.geoserver.cloud.gwc.backend.pgconfig.PgconfigTileLayerInfoRepository; import org.geoserver.cloud.gwc.backend.pgconfig.TileLayerInfoRepository; import org.geoserver.cloud.gwc.event.TileLayerEvent; import org.geoserver.cloud.gwc.repository.GeoServerTileLayerConfiguration; @@ -44,12 +45,12 @@ * * @since 1.7 */ -@AutoConfiguration -@ConditionalOnClass(PgsqlTileLayerCatalog.class) +@AutoConfiguration(after = PgconfigDataSourceAutoConfiguration.class) +@ConditionalOnClass(PgconfigTileLayerCatalog.class) @ConditionalOnGeoWebCacheEnabled -@ConditionalOnPgsqlBackendEnabled +@ConditionalOnPgconfigBackendEnabled @Slf4j(topic = "org.geoserver.cloud.autoconfigure.gwc.backend") -public class PgsqlTileLayerCatalogAutoConfiguration { +public class PgconfigTileLayerCatalogAutoConfiguration { @PostConstruct void log() { @@ -58,31 +59,31 @@ void log() { /** Replacement for {@link GWCInitializer} when using {@link GeoServerTileLayerConfiguration} */ @Bean - PgsqlGwcInitializer gwcInitializer( + PgconfigGwcInitializer gwcInitializer( GWCConfigPersister configPersister, ConfigurableBlobStore blobStore, GeoServerTileLayerConfiguration tileLayerCatalog) { - return new PgsqlGwcInitializer(configPersister, blobStore, tileLayerCatalog); + return new PgconfigGwcInitializer(configPersister, blobStore, tileLayerCatalog); } @Bean(name = "gwcCatalogConfiguration") - GeoServerTileLayerConfiguration pgsqlTileLayerCatalog( + GeoServerTileLayerConfiguration pgconfigTileLayerCatalog( GridSetBroker gridsetBroker, TileLayerInfoRepository repository, ApplicationEventPublisher eventPublisher, @Qualifier("rawCatalog") Catalog catalog) { - var config = new PgsqlTileLayerCatalog(repository, gridsetBroker, () -> catalog); + var config = new PgconfigTileLayerCatalog(repository, gridsetBroker, () -> catalog); Consumer gwcEventPublisher = eventPublisher::publishEvent; return new GeoServerTileLayerConfiguration(config, gwcEventPublisher); } @Bean - TileLayerInfoRepository pgsqlTileLayerRepository( - @Qualifier("pgsqlConfigDatasource") DataSource dataSource, + TileLayerInfoRepository pgconfigTileLayerRepository( + @Qualifier("pgconfigDataSource") DataSource dataSource, Optional cacheManager) { - var pgrepo = new PgsqlTileLayerInfoRepository(new JdbcTemplate(dataSource)); + var pgrepo = new PgconfigTileLayerInfoRepository(new JdbcTemplate(dataSource)); return cacheManager.map(cm -> cachingTileLayerCatalog(pgrepo, cm)).orElse(pgrepo); } diff --git a/src/gwc/autoconfigure/src/main/resources/META-INF/spring.factories b/src/gwc/autoconfigure/src/main/resources/META-INF/spring.factories index 15c46d734..dc0c9f5a7 100644 --- a/src/gwc/autoconfigure/src/main/resources/META-INF/spring.factories +++ b/src/gwc/autoconfigure/src/main/resources/META-INF/spring.factories @@ -1,6 +1,6 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.geoserver.cloud.autoconfigure.gwc.core.GeoWebCacheAutoConfiguration,\ -org.geoserver.cloud.autoconfigure.gwc.backend.PgsqlTileLayerCatalogAutoConfiguration,\ +org.geoserver.cloud.autoconfigure.gwc.backend.PgconfigTileLayerCatalogAutoConfiguration,\ org.geoserver.cloud.autoconfigure.gwc.backend.DefaultTileLayerCatalogAutoConfiguration,\ org.geoserver.cloud.autoconfigure.gwc.core.CacheSeedingWebMapServiceAutoConfiguration,\ org.geoserver.cloud.autoconfigure.gwc.integration.GeoWebCacheRemoteEventsAutoConfiguration,\ diff --git a/src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlTileLayerCatalogAutoConfigurationTest.java b/src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigTileLayerCatalogAutoConfigurationTest.java similarity index 77% rename from src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlTileLayerCatalogAutoConfigurationTest.java rename to src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigTileLayerCatalogAutoConfigurationTest.java index 1a9749056..6740cc22c 100644 --- a/src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgsqlTileLayerCatalogAutoConfigurationTest.java +++ b/src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/backend/PgconfigTileLayerCatalogAutoConfigurationTest.java @@ -2,14 +2,15 @@ import static org.assertj.core.api.Assertions.assertThat; -import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.ConditionalOnPgsqlBackendEnabled; -import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgsqlBackendAutoConfiguration; -import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgsqlDataSourceAutoConfiguration; -import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgsqlMigrationAutoConfiguration; +import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.ConditionalOnPgconfigBackendEnabled; +import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigBackendAutoConfiguration; +import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigDataSourceAutoConfiguration; +import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigMigrationAutoConfiguration; +import org.geoserver.cloud.autoconfigure.catalog.backend.pgconfig.PgconfigTransactionManagerAutoConfiguration; import org.geoserver.cloud.autoconfigure.gwc.ConditionalOnGeoWebCacheEnabled; import org.geoserver.cloud.autoconfigure.gwc.GeoWebCacheContextRunner; import org.geoserver.cloud.backend.pgconfig.support.PgConfigTestContainer; -import org.geoserver.cloud.gwc.backend.pgconfig.PgsqlTileLayerCatalog; +import org.geoserver.cloud.gwc.backend.pgconfig.PgconfigTileLayerCatalog; import org.geoserver.cloud.gwc.repository.CachingTileLayerCatalog; import org.geoserver.cloud.gwc.repository.CloudCatalogConfiguration; import org.geoserver.cloud.gwc.repository.CloudDefaultStorageFinder; @@ -37,9 +38,9 @@ import java.io.File; -/** GWC integration test for {@link PgsqlTileLayerCatalogAutoConfiguration} */ +/** GWC integration test for {@link PgconfigTileLayerCatalogAutoConfiguration} */ @Testcontainers(disabledWithoutDocker = true) -class PgsqlTileLayerCatalogAutoConfigurationTest { +class PgconfigTileLayerCatalogAutoConfigurationTest { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); @@ -61,10 +62,11 @@ void setUp() throws Exception { GeoWebCacheContextRunner.newMinimalGeoWebCacheContextRunner(cacheDir) .withConfiguration( AutoConfigurations.of( - PgsqlTileLayerCatalogAutoConfiguration.class, - PgsqlBackendAutoConfiguration.class, - PgsqlDataSourceAutoConfiguration.class, - PgsqlMigrationAutoConfiguration.class)); + PgconfigTileLayerCatalogAutoConfiguration.class, + PgconfigBackendAutoConfiguration.class, + PgconfigDataSourceAutoConfiguration.class, + PgconfigTransactionManagerAutoConfiguration.class, + PgconfigMigrationAutoConfiguration.class)); runner = container.setUp().withJdbcUrlConfig(runner); } @@ -74,18 +76,18 @@ void tearDown() throws Exception { } /** - * {@link TileLayerConfiguration} implementation should be {@link PgsqlTileLayerCatalog}, and + * {@link TileLayerConfiguration} implementation should be {@link PgconfigTileLayerCatalog}, and * none of the beans from {@link DefaultTileLayerCatalogAutoConfiguration} should be present. * *

"pgconfig" is enabled already by {@link PgConfigTestContainer#withJdbcUrlConfig()} */ @Test - void testPgsqlTileLayerCatalogReplacesDefaultTileLayerCatalogAutoConfiguration() { + void testPgconfigTileLayerCatalogReplacesDefaultTileLayerCatalogAutoConfiguration() { runner.run( context -> { assertThat(context) .doesNotHaveBean(GWCInitializer.class) - .hasSingleBean(PgsqlGwcInitializer.class); + .hasSingleBean(PgconfigGwcInitializer.class); assertThat(context) .hasNotFailed() @@ -98,7 +100,7 @@ void testPgsqlTileLayerCatalogReplacesDefaultTileLayerCatalogAutoConfiguration() "gwcCatalogConfiguration", GeoServerTileLayerConfiguration.class) .getSubject()) - .isInstanceOf(PgsqlTileLayerCatalog.class); + .isInstanceOf(PgconfigTileLayerCatalog.class); assertThat(context) .getBean("gwcXmlConfig", XMLConfiguration.class) @@ -119,23 +121,23 @@ void testPgsqlTileLayerCatalogReplacesDefaultTileLayerCatalogAutoConfiguration() } /** - * {@link PgsqlTileLayerCatalogAutoConfiguration}'s - * {@code @ConditionalOnClass(PgsqlTileLayerCatalog.class)} + * {@link PgconfigTileLayerCatalogAutoConfiguration}'s + * {@code @ConditionalOnClass(PgconfigTileLayerCatalog.class)} */ @Test - void conditionalOnClass_PgsqlTileLayerCatalog() { - runner.withClassLoader(new FilteredClassLoader(PgsqlTileLayerCatalog.class)) + void conditionalOnClass_PgconfigTileLayerCatalog() { + runner.withClassLoader(new FilteredClassLoader(PgconfigTileLayerCatalog.class)) .run( context -> { assertThat(context) .hasNotFailed() - .doesNotHaveBean(PgsqlTileLayerCatalog.class); + .doesNotHaveBean(PgconfigTileLayerCatalog.class); assertDefaultTileLayerCatalogConfigurationPresent(context); }); } /** - * {@link PgsqlTileLayerCatalogAutoConfiguration}'s {@link + * {@link PgconfigTileLayerCatalogAutoConfiguration}'s {@link * ConditionalOnGeoWebCacheEnabled @ConditionalOnGeoWebCacheEnabled} shall not have the pqsl nor * the default {@link TileLayerConfiguration} */ @@ -146,24 +148,24 @@ void conditionalOnGeoWebCacheEnabled() { context -> { assertThat(context) .hasNotFailed() - .doesNotHaveBean(PgsqlTileLayerCatalog.class); + .doesNotHaveBean(PgconfigTileLayerCatalog.class); assertDefaultTileLayerCatalogConfigurationAbsent(context); }); } /** - * {@link PgsqlTileLayerCatalogAutoConfiguration}'s {@link - * ConditionalOnPgsqlBackendEnabled @ConditionalOnPgsqlBackendEnabled} shall step back and leave - * {@link DefaultTileLayerCatalogAutoConfiguration} be + * {@link PgconfigTileLayerCatalogAutoConfiguration}'s {@link + * ConditionalOnPgconfigBackendEnabled @ConditionalOnPgconfigBackendEnabled} shall step back and + * leave {@link DefaultTileLayerCatalogAutoConfiguration} be */ @Test - void conditionalOnPgsqlBackendEnabled() { + void conditionalOnPgconfigBackendEnabled() { runner.withPropertyValues("geoserver.backend.pgconfig.enabled: false") .run( context -> { assertThat(context) .hasNotFailed() - .doesNotHaveBean(PgsqlTileLayerCatalog.class); + .doesNotHaveBean(PgconfigTileLayerCatalog.class); assertDefaultTileLayerCatalogConfigurationPresent(context); }); } diff --git a/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalog.java b/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalog.java similarity index 93% rename from src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalog.java rename to src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalog.java index 06fa5bcf0..7a737c3f8 100644 --- a/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalog.java +++ b/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalog.java @@ -14,7 +14,7 @@ import org.geoserver.catalog.impl.LayerGroupInfoImpl; import org.geoserver.catalog.impl.LayerInfoImpl; import org.geoserver.catalog.plugin.resolving.ModificationProxyDecorator; -import org.geoserver.cloud.backend.pgconfig.catalog.PgsqlCatalogFacade; +import org.geoserver.cloud.backend.pgconfig.catalog.PgconfigCatalogFacade; import org.geoserver.gwc.layer.GeoServerTileLayer; import org.geoserver.gwc.layer.GeoServerTileLayerInfo; import org.geoserver.ows.LocalWorkspace; @@ -37,14 +37,14 @@ /** * A {@link TileLayerConfiguration} is like the GeoServer {@link Catalog} for {@link TileLayer}; - * this one runs against the PostgreSQL database set up for {@link PgsqlCatalogFacade}, and returns - * {@link GeoServerTileLayer}. + * this one runs against the PostgreSQL database set up for {@link PgconfigCatalogFacade}, and + * returns {@link GeoServerTileLayer}. * * @see TileLayerInfoRepository - * @see PgsqlTileLayerInfoRepository + * @see PgconfigTileLayerInfoRepository * @since 1.7 */ -public class PgsqlTileLayerCatalog implements TileLayerConfiguration { +public class PgconfigTileLayerCatalog implements TileLayerConfiguration { final @NonNull TileLayerInfoRepository repository; final @NonNull GridSetBroker gridsetBroker; @@ -53,7 +53,7 @@ public class PgsqlTileLayerCatalog implements TileLayerConfiguration { final GeoServerTileLayerInfoMapper infoMapper = Mappers.getMapper(GeoServerTileLayerInfoMapper.class); - public PgsqlTileLayerCatalog( + public PgconfigTileLayerCatalog( @NonNull TileLayerInfoRepository repository, @NonNull GridSetBroker gridsetBroker, @NonNull Supplier catalog) { @@ -61,16 +61,16 @@ public PgsqlTileLayerCatalog( this.repository = repository; this.gridsetBroker = gridsetBroker; - UnaryOperator resolve = PgsqlCatalogFacade.resolvingFunction(catalog); + UnaryOperator resolve = PgconfigCatalogFacade.resolvingFunction(catalog); UnaryOperator proxify = ModificationProxyDecorator::wrap; this.publishedResolver = resolve.andThen(proxify)::apply; } @VisibleForTesting - PgsqlTileLayerCatalog( + PgconfigTileLayerCatalog( DataSource dataSource, GridSetBroker gridsets, Supplier catalog) { - this(new PgsqlTileLayerInfoRepository(new JdbcTemplate(dataSource)), gridsets, catalog); + this(new PgconfigTileLayerInfoRepository(new JdbcTemplate(dataSource)), gridsets, catalog); } @Override diff --git a/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerInfoRepository.java b/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerInfoRepository.java similarity index 91% rename from src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerInfoRepository.java rename to src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerInfoRepository.java index e6bcf3ed4..989c5d00b 100644 --- a/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerInfoRepository.java +++ b/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerInfoRepository.java @@ -33,11 +33,11 @@ * @since 1.7 */ @Slf4j -public class PgsqlTileLayerInfoRepository implements TileLayerInfoRepository { +public class PgconfigTileLayerInfoRepository implements TileLayerInfoRepository { private final LoggingTemplate template; - public PgsqlTileLayerInfoRepository(@NonNull JdbcTemplate template) { + public PgconfigTileLayerInfoRepository(@NonNull JdbcTemplate template) { this.template = new LoggingTemplate(template); } @@ -53,10 +53,10 @@ public boolean save(@NonNull TileLayerInfo tli) throws DataAccessException { } private boolean save(TileLayerInfo tli, final PublishedInfo published) { - Objects.requireNonNull(published, "PgsqlTileLayerInfo.published is null"); - Objects.requireNonNull(published.getId(), "PgsqlTileLayerInfo.published.id is null"); + Objects.requireNonNull(published, "TileLayerInfo.published is null"); + Objects.requireNonNull(published.getId(), "TileLayerInfo.published.id is null"); - final String encoded = PgsqlTileLayerInfoRowMapper.encode(tli); + final String encoded = PgconfigTileLayerInfoRowMapper.encode(tli); log.debug("Saving TileLayer {}: {}", published.prefixedName(), encoded); int updated = template.update( @@ -158,7 +158,7 @@ SELECT exists(SELECT 1 FROM tilelayers WHERE "workspace.name" = ? AND "published return exists != null && exists.booleanValue(); } - private PgsqlTileLayerInfoRowMapper mapper() { - return PgsqlTileLayerInfoRowMapper.newInstance(template.getJdbcTemplate()); + private PgconfigTileLayerInfoRowMapper mapper() { + return PgconfigTileLayerInfoRowMapper.newInstance(template.getJdbcTemplate()); } } diff --git a/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerInfoRowMapper.java b/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerInfoRowMapper.java similarity index 81% rename from src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerInfoRowMapper.java rename to src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerInfoRowMapper.java index 25f8f4877..8ccf722c6 100644 --- a/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerInfoRowMapper.java +++ b/src/gwc/backends/pgconfig/src/main/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerInfoRowMapper.java @@ -12,8 +12,8 @@ import org.geoserver.catalog.PublishedInfo; import org.geoserver.cloud.backend.pgconfig.catalog.repository.CatalogInfoRowMapper; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlObjectMapper; -import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgsqlStyleRepository; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigObjectMapper; +import org.geoserver.cloud.backend.pgconfig.catalog.repository.PgconfigStyleRepository; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; @@ -24,21 +24,21 @@ /** * @since 1.7 */ -class PgsqlTileLayerInfoRowMapper implements RowMapper { +class PgconfigTileLayerInfoRowMapper implements RowMapper { - protected static final ObjectMapper objectMapper = PgsqlObjectMapper.newObjectMapper(); + protected static final ObjectMapper objectMapper = PgconfigObjectMapper.newObjectMapper(); private final RowMapper publishedMapper; - private PgsqlTileLayerInfoRowMapper(RowMapper publishedMapper) { + private PgconfigTileLayerInfoRowMapper(RowMapper publishedMapper) { this.publishedMapper = publishedMapper; } - public static PgsqlTileLayerInfoRowMapper newInstance(@NonNull JdbcTemplate template) { - PgsqlStyleRepository styleLoader = new PgsqlStyleRepository(template); + public static PgconfigTileLayerInfoRowMapper newInstance(@NonNull JdbcTemplate template) { + PgconfigStyleRepository styleLoader = new PgconfigStyleRepository(template); RowMapper publishedMapper = CatalogInfoRowMapper.published(styleLoader::findById); - return new PgsqlTileLayerInfoRowMapper(publishedMapper); + return new PgconfigTileLayerInfoRowMapper(publishedMapper); } /** diff --git a/src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalogIT.java b/src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalogIT.java similarity index 94% rename from src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalogIT.java rename to src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalogIT.java index 9533644cb..ebec8ca43 100644 --- a/src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalogIT.java +++ b/src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalogIT.java @@ -16,7 +16,7 @@ import org.geoserver.catalog.WorkspaceInfo; import org.geoserver.catalog.faker.CatalogFaker; import org.geoserver.catalog.plugin.CatalogPlugin; -import org.geoserver.cloud.backend.pgconfig.PgsqlBackendBuilder; +import org.geoserver.cloud.backend.pgconfig.PgconfigBackendBuilder; import org.geoserver.cloud.backend.pgconfig.support.PgConfigTestContainer; import org.geoserver.config.plugin.GeoServerImpl; import org.geoserver.gwc.layer.GeoServerTileLayer; @@ -39,23 +39,25 @@ * @since 1.7 */ @Testcontainers(disabledWithoutDocker = true) -class PgsqlTileLayerCatalogIT { +class PgconfigTileLayerCatalogIT { @Container static PgConfigTestContainer container = new PgConfigTestContainer<>(); private TileLayerMocking support; - private PgsqlTileLayerCatalog tlCatalog; + private PgconfigTileLayerCatalog tlCatalog; @BeforeEach void setUp() throws Exception { container.setUp(); - PgsqlBackendBuilder backendBuilder = new PgsqlBackendBuilder(container.getDataSource()); + PgconfigBackendBuilder backendBuilder = + new PgconfigBackendBuilder(container.getDataSource()); CatalogPlugin catalog = backendBuilder.createCatalog(); GeoServerImpl geoServer = backendBuilder.createGeoServer(catalog); support = new TileLayerMocking(catalog, geoServer); GridSetBroker gridsets = support.getGridsets(); - tlCatalog = new PgsqlTileLayerCatalog(container.getDataSource(), gridsets, () -> catalog); + tlCatalog = + new PgconfigTileLayerCatalog(container.getDataSource(), gridsets, () -> catalog); } @AfterEach diff --git a/src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalogTest.java b/src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalogTest.java similarity index 94% rename from src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalogTest.java rename to src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalogTest.java index 7b845cbca..3bf8113cb 100644 --- a/src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgsqlTileLayerCatalogTest.java +++ b/src/gwc/backends/pgconfig/src/test/java/org/geoserver/cloud/gwc/backend/pgconfig/PgconfigTileLayerCatalogTest.java @@ -41,18 +41,19 @@ /** * @since 1.7 */ -class PgsqlTileLayerCatalogTest { +class PgconfigTileLayerCatalogTest { - private PgsqlTileLayerInfoRepository repository; - private PgsqlTileLayerCatalog tlCatalog; + private PgconfigTileLayerInfoRepository repository; + private PgconfigTileLayerCatalog tlCatalog; private TileLayerMocking support; @BeforeEach void setUp() { support = new TileLayerMocking(new CatalogPlugin(), new GeoServerImpl()); - repository = mock(PgsqlTileLayerInfoRepository.class); - tlCatalog = new PgsqlTileLayerCatalog(repository, support.getGridsets(), support.catalog()); + repository = mock(PgconfigTileLayerInfoRepository.class); + tlCatalog = + new PgconfigTileLayerCatalog(repository, support.getGridsets(), support.catalog()); } @Test @@ -66,10 +67,10 @@ void testConstructor() { assertThrows( npe, () -> - new PgsqlTileLayerCatalog( - (PgsqlTileLayerInfoRepository) null, gridsets, catalog)); - assertThrows(npe, () -> new PgsqlTileLayerCatalog(repository, null, catalog)); - assertThrows(npe, () -> new PgsqlTileLayerCatalog(repository, gridsets, null)); + new PgconfigTileLayerCatalog( + (PgconfigTileLayerInfoRepository) null, gridsets, catalog)); + assertThrows(npe, () -> new PgconfigTileLayerCatalog(repository, null, catalog)); + assertThrows(npe, () -> new PgconfigTileLayerCatalog(repository, gridsets, null)); } @Test diff --git a/src/gwc/backends/pgconfig/src/test/resources/logback-test.xml b/src/gwc/backends/pgconfig/src/test/resources/logback-test.xml index 45f3d8253..b45d8eefc 100644 --- a/src/gwc/backends/pgconfig/src/test/resources/logback-test.xml +++ b/src/gwc/backends/pgconfig/src/test/resources/logback-test.xml @@ -14,9 +14,9 @@ - - + + - \ No newline at end of file +