You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2021/09/03 16:52:32 UTC
[sis] 05/05: Rename `isLowPriority` as `yieldPriority`.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit d89277bb9bf360499c4d925d0648d4c0eeb42f45
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Sep 3 18:45:31 2021 +0200
Rename `isLowPriority` as `yieldPriority`.
---
.../java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java | 9 ++++++++-
.../main/java/org/apache/sis/internal/storage/StoreMetadata.java | 4 ++--
.../apache/sis/internal/storage/folder/FolderStoreProvider.java | 2 +-
.../src/main/java/org/apache/sis/storage/DataStoreRegistry.java | 8 ++++----
4 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
index 50e97a9..6da72f9 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
@@ -75,7 +75,14 @@ import org.apache.sis.util.Version;
fileSuffixes = "nc",
capabilities = Capability.READ,
resourceTypes = {Aggregate.class, FeatureSet.class, GridCoverageResource.class},
- isLowPriority = true)
+ yieldPriority = true)
+/*
+ * Note: we set "low priority" to this provider because the UCAR library supports many file formats,
+ * including GeoTIFF. We want the Apache SIS GeoTIFF data store to be tested before the UCAR library.
+ * Even in the case of real netCDF files, the netCDF format is so generic that we sometime need to
+ * create specialized readers for specific data set, in which case we want the providers of those
+ * specialized readers to be tested before this generic netCDF reader.
+ */
public class NetcdfStoreProvider extends DataStoreProvider {
/**
* The format name.
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java
index 7be37c6..deab99f 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreMetadata.java
@@ -99,9 +99,9 @@ public @interface StoreMetadata {
* open a wide variety of files, in order to allow specialized data stores to be tested before generic
* data stores.
*
- * <p>If many data stores have low priority, the ordering between them is unspecified.</p>
+ * <p>If many data stores yield priority, the ordering between them is unspecified.</p>
*
* @return {@code true} if this data store should be tested after all "normal priority" data stores.
*/
- boolean isLowPriority() default false;
+ boolean yieldPriority() default false;
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java
index 7ae0ade..f85f93e 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/FolderStoreProvider.java
@@ -65,7 +65,7 @@ import org.apache.sis.setup.OptionKey;
@StoreMetadata(formatName = FolderStoreProvider.NAME,
capabilities = {Capability.READ, Capability.WRITE},
resourceTypes = {Aggregate.class, FeatureSet.class, GridCoverageResource.class},
- isLowPriority = true)
+ yieldPriority = true)
public final class FolderStoreProvider extends DataStoreProvider {
/**
* A short name or abbreviation for the data format.
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
index e2c8383..29e031a 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreRegistry.java
@@ -160,12 +160,12 @@ final class DataStoreRegistry {
final boolean useSuffix;
/** Whether this category is for providers to test last. */
- final boolean isLowPriority;
+ final boolean yieldPriority;
/** Creates a new enumeration value. */
- private Category(final boolean useSuffix, final boolean isLowPriority) {
+ private Category(final boolean useSuffix, final boolean yieldPriority) {
this.useSuffix = useSuffix;
- this.isLowPriority = isLowPriority;
+ this.yieldPriority = yieldPriority;
}
/** Returns the categories, optionally ignoring file suffix. */
@@ -230,7 +230,7 @@ search: for (int ci=0; ci < categories.length; ci++) {
if (md == null) {
accept = (ci == 0); // If no metadata, test only in first iteration.
} else {
- accept = (md.isLowPriority() == category.isLowPriority);
+ accept = (md.yieldPriority() == category.yieldPriority);
if (accept & useSuffix) {
accept = ArraysExt.containsIgnoreCase(md.fileSuffixes(), extension) == category.useSuffix;
}