We have created an HBase Datastore in Geoserver using the GeoWave plugin. We then make requests using the WFS service in Geoserver to this Datastore. Inside of this Datastore we have ingested a number of SimpleFeatures with row visibility set. In addition, we have our own implementation of AuthorizationSPI that we use to filter results.
Expected Behavior
We expect the WFS numOfFeatures attribute to reflect the number of features returned with the current response.
Actual Behavior
The WFS numOfFeatures attribute reflects the total number of features within the Datastore regardless of the authorizations provided. However, the features returned in the resulting featurecollection are correct in terms of the authorizations provided.
Workaround
The problem seems to stem from two places within the code that prefer a cached count over the actual count. As a workaround to the issue, we have removed the code below.
|
if (query.getFilter().equals( |
|
Filter.INCLUDE)) { |
|
// GEOWAVE-60 optimization |
|
final Map<ByteArrayId, DataStatistics<SimpleFeature>> statsMap = reader |
|
.getTransaction() |
|
.getDataStatistics(); |
|
if (statsMap.containsKey(CountDataStatistics.STATS_TYPE)) { |
|
final CountDataStatistics stats = (CountDataStatistics) statsMap.get(CountDataStatistics.STATS_TYPE); |
|
if ((stats != null) && stats.isSet()) { |
|
return (int) stats.getCount(); |
|
} |
|
} |
|
} |
|
else if (query.getFilter().equals( |
|
Filter.EXCLUDE)) { |
|
return 0; |
|
} |
|
final Map<ByteArrayId, DataStatistics<SimpleFeature>> stats = new GeoWaveEmptyTransaction( |
|
components).getDataStatistics(); |
|
final DataStatistics<SimpleFeature> countStats = stats.get(CountDataStatistics.STATS_TYPE); |
|
if ((countStats != null) && query.getFilter().equals( |
|
Filter.INCLUDE)) { |
|
return (int) ((CountDataStatistics) countStats).getCount(); |
|
} |
After removing the code we are now receiving the proper count on our queries. Of course, sacrificing some efficiency.
Specifications
We have created an HBase Datastore in Geoserver using the GeoWave plugin. We then make requests using the WFS service in Geoserver to this Datastore. Inside of this Datastore we have ingested a number of SimpleFeatures with row visibility set. In addition, we have our own implementation of AuthorizationSPI that we use to filter results.
Expected Behavior
We expect the WFS numOfFeatures attribute to reflect the number of features returned with the current response.
Actual Behavior
The WFS numOfFeatures attribute reflects the total number of features within the Datastore regardless of the authorizations provided. However, the features returned in the resulting featurecollection are correct in terms of the authorizations provided.
Workaround
The problem seems to stem from two places within the code that prefer a cached count over the actual count. As a workaround to the issue, we have removed the code below.
geowave/extensions/adapters/vector/src/main/java/mil/nga/giat/geowave/adapter/vector/plugin/GeoWaveFeatureCollection.java
Lines 71 to 87 in e9d9966
geowave/extensions/adapters/vector/src/main/java/mil/nga/giat/geowave/adapter/vector/plugin/GeoWaveFeatureSource.java
Lines 120 to 126 in e9d9966
After removing the code we are now receiving the proper count on our queries. Of course, sacrificing some efficiency.
Specifications