Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgconfig: Refactor layer and group repos with PublishedInfo superclass #622

Merged

Conversation

groldan
Copy link
Member

@groldan groldan commented Feb 26, 2025

This commit introduces PgconfigPublishedInfoRepository as a common superclass for PgconfigLayerRepository and PgconfigLayerGroupRepository, improving code reuse and enabling optimized querying of PublishedInfo objects in the pgconfig backend. It enhances PgconfigCatalogFacade with a dedicated, read-only PgconfigPublishedInfoReadOnlyRepository for efficient PublishedInfo queries.

Key changes:

  • Added PgconfigPublishedInfoRepository as an abstract base for layer and layer group repositories, centralizing common logic.
  • Introduced PgconfigPublishedInfoReadOnlyRepository for read-only PublishedInfo access, integrated into PgconfigCatalogFacade for direct query and count operations, bypassing separate layer/group queries.
  • Updated CatalogInfoRowMapper to be generic and actually implement RowMapper, removing static factory methods using lambdas per cataloginfo type in favor of a configurable newInstance() approach.
  • Enhanced repository base class PgconfigCatalogInfoRepository with type safety and SQL generation utilities (e.g., select()).
  • Adjusted dependent repositories (Namespace, Store, Resource, Style, Workspace) to use the new generic row mapper and type-safe constructor.

Impact:

  • Reduces code duplication and improves maintainability for published info handling.
  • Boosts query performance by leveraging a unified PublishedInfo repository, avoiding merge-sort overhead in the default facade implementation.
  • Prepares the backend for future optimizations using materialized tables.

No database schema changes are included in this commit; it focuses on code structure and runtime efficiency.

@groldan groldan added the enhancement New feature or request label Feb 26, 2025
This commit introduces `PgconfigPublishedInfoRepository` as a common superclass
for `PgconfigLayerRepository` and `PgconfigLayerGroupRepository`, improving
code reuse and enabling optimized querying of `PublishedInfo` objects in the
`pgconfig` backend. It enhances `PgconfigCatalogFacade` with a dedicated,
read-only `PgconfigPublishedInfoReadOnlyRepository` for efficient
`PublishedInfo` queries.

Key changes:
- Added `PgconfigPublishedInfoRepository` as an abstract base for layer and
  layer group repositories, centralizing common logic.
- Introduced `PgconfigPublishedInfoReadOnlyRepository` for read-only
  `PublishedInfo` access, integrated into `PgconfigCatalogFacade` for direct
  query and count operations, bypassing separate layer/group queries.
- Updated `CatalogInfoRowMapper` to be generic and actually implement RowMapper,
  removing static factory methods using lambdas per cataloginfo type
  in favor of a configurable `newInstance()` approach.
- Enhanced repository base class `PgconfigCatalogInfoRepository` with type
  safety and SQL generation utilities (e.g., `select()`).
- Adjusted dependent repositories (`Namespace`, `Store`, `Resource`, `Style`,
  `Workspace`) to use the new generic row mapper and type-safe constructor.

Impact:
- Reduces code duplication and improves maintainability for published info
  handling.
- Boosts query performance by leveraging a unified `PublishedInfo` repository,
  avoiding merge-sort overhead in the default facade implementation.
- Prepares the backend for future optimizations using materialized tables.

No database schema changes are included in this commit; it focuses on code
structure and runtime efficiency.
@groldan groldan force-pushed the pgconfig/publishedinfo_repository_superclass branch from 80e29ee to 2854585 Compare February 26, 2025 01:05
@groldan groldan merged commit 767677b into geoserver:main Feb 26, 2025
2 of 3 checks passed
@groldan groldan deleted the pgconfig/publishedinfo_repository_superclass branch February 26, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant