-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wfs-service: use a no-op LayerGroupContainmentCache
The wfs-service contributes a no-op `LayerGroupContainmentCache` to avoid the runtime overhead of building up the cache at startup, and the unnecessary memory footprint. `LayerGroupContainmentCache` is a securtity subsystem aid and WFS does not deal with `LayerGroupInfo` at all.
- Loading branch information
Showing
7 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...s/src/main/java/org/geoserver/cloud/wfs/config/WfsSecurityOverridesAutoconfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* (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.wfs.config; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import org.geoserver.cloud.autoconfigure.catalog.backend.core.GeoServerBackendAutoConfiguration; | ||
import org.geoserver.cloud.wfs.security.NoopLayerGroupContainmentCache; | ||
import org.geoserver.security.impl.LayerGroupContainmentCache; | ||
import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
/** | ||
* Runs before {@link GeoServerBackendAutoConfiguration} to provide a {@link | ||
* NoopLayerGroupContainmentCache} before {@link CoreBackendConfiguration's} {@code | ||
* layerGroupContainmentCache()} does. | ||
* | ||
* @since 1.8.2 | ||
*/ | ||
@AutoConfiguration(before = GeoServerBackendAutoConfiguration.class) | ||
@Slf4j(topic = "org.geoserver.cloud.wfs.config") | ||
public class WfsSecurityOverridesAutoconfiguration { | ||
|
||
@Bean | ||
LayerGroupContainmentCache layerGroupContainmentCache() { | ||
log.info("wfs-service is using a no-op LayerGroupContainmentCache"); | ||
return new NoopLayerGroupContainmentCache(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...er/wfs/src/main/java/org/geoserver/cloud/wfs/security/NoopLayerGroupContainmentCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* (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.wfs.security; | ||
|
||
import org.geoserver.catalog.LayerGroupInfo; | ||
import org.geoserver.catalog.impl.CatalogImpl; | ||
import org.geoserver.security.impl.LayerGroupContainmentCache; | ||
|
||
/** | ||
* A no-op {@link LayerGroupContainmentCache}, since the WFS service does not deal with {@link | ||
* LayerGroupInfo layer groups} at all, then avoid the starup overhead. | ||
* | ||
* @since 1.8.2 | ||
*/ | ||
public class NoopLayerGroupContainmentCache extends LayerGroupContainmentCache { | ||
|
||
/** | ||
* Since {@link LayerGroupContainmentCache} is a class and the initialization methods are | ||
* private, we give it an empty in-memory catalog and call it a day | ||
*/ | ||
public NoopLayerGroupContainmentCache() { | ||
super(new CatalogImpl()); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
src/apps/geoserver/wfs/src/main/resources/META-INF/spring.factories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ | ||
org.geoserver.cloud.wfs.config.WfsAutoConfiguration | ||
org.geoserver.cloud.wfs.config.WfsAutoConfiguration,\ | ||
org.geoserver.cloud.wfs.config.WfsSecurityOverridesAutoconfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters