This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 7be914eae213e3ca350aae1c8d62fb7727b148b4 Author: Martin Desruisseaux <[email protected]> AuthorDate: Wed May 6 17:57:42 2026 +0200 Move `OptionKey` to the storage module. Retrofit `DataOptionKey` into `OptionKey`. Old classes are deprecated for removal. https://issues.apache.org/jira/browse/SIS-633 --- .../main/org/apache/sis/console/CommandRunner.java | 4 +- .../apache/sis/console/FormattedOutputCommand.java | 2 +- .../org/apache/sis/console/TranslateCommand.java | 2 +- .../main/org/apache/sis/xml/XML.java | 4 +- .../main/org/apache/sis/io/wkt/WKTFormat.java | 4 +- .../main/org/apache/sis/storage/landsat/Band.java | 4 +- .../apache/sis/storage/landsat/LandsatStore.java | 2 +- .../storage/landsat/LandsatStoreProviderTest.java | 2 +- .../apache/sis/storage/geotiff/Compression.java | 2 +- .../apache/sis/storage/geotiff/FormatModifier.java | 2 +- .../apache/sis/storage/geotiff/GeoTiffStore.java | 2 +- .../org/apache/sis/storage/netcdf/NetcdfStore.java | 2 +- .../sis/storage/netcdf/NetcdfStoreProvider.java | 2 +- .../main/org/apache/sis/storage/sql/SQLStore.java | 2 +- .../sis/storage/sql/feature/SchemaModifier.java | 4 +- .../sis/storage/sql/postgis/PostgresTest.java | 2 +- .../main/org/apache/sis/storage/gpx/Store.java | 2 +- .../sis/storage/xml/stream/StaxDataStore.java | 2 +- .../org/apache/sis/storage/gpx/ReaderTest.java | 2 +- .../org/apache/sis/storage/gpx/UpdaterTest.java | 2 +- .../org/apache/sis/storage/gpx/WriterTest.java | 2 +- .../apache/sis/io/stream/InternalOptionKey.java | 2 +- .../main/org/apache/sis/storage/DataOptionKey.java | 83 +----- .../main/org/apache/sis/storage/DataStore.java | 3 +- .../org/apache/sis/storage/DataStoreRegistry.java | 2 +- .../main/org/apache/sis/storage/OptionKey.java | 285 +++++++++++++++++++++ .../org/apache/sis/storage/StorageConnector.java | 19 +- .../org/apache/sis/storage/base/PRJDataStore.java | 2 +- .../org/apache/sis/storage/base/URIDataStore.java | 11 +- .../sis/storage/base/URIDataStoreProvider.java | 2 +- .../main/org/apache/sis/storage/csv/Store.java | 7 +- .../org/apache/sis/storage/csv/StoreProvider.java | 6 +- .../org/apache/sis/storage/csv/package-info.java | 2 +- .../apache/sis/storage/esri/AsciiGridStore.java | 6 +- .../main/org/apache/sis/storage/folder/Store.java | 5 +- .../apache/sis/storage/folder/StoreProvider.java | 4 +- .../apache/sis/storage/folder/WritableStore.java | 2 +- .../apache/sis/storage/image/WorldFileStore.java | 2 +- .../apache/sis/storage/image/WritableStore.java | 2 +- .../sis/storage/modifier/CoverageModifier.java | 10 +- .../main/org/apache/sis/storage/wkt/Store.java | 2 +- .../main/org/apache/sis/storage/xml/Store.java | 2 +- .../org/apache/sis/storage/DataOptionKeyTest.java | 46 ---- .../org/apache/sis/storage}/OptionKeyTest.java | 23 +- .../apache/sis/storage/StorageConnectorTest.java | 1 - .../apache/sis/storage/csv/StoreProviderTest.java | 2 +- .../test/org/apache/sis/storage/csv/StoreTest.java | 5 +- .../apache/sis/storage/esri/WritableStoreTest.java | 2 +- .../sis/storage/image/WorldFileStoreTest.java | 2 +- .../main/org/apache/sis/setup/GeometryLibrary.java | 2 +- .../main/org/apache/sis/setup/OptionKey.java | 46 +--- .../main/org/apache/sis/setup/package-info.java | 5 +- .../apache/sis/util/internal/shared/Constants.java | 2 +- .../sis/storage/geopackage/GpkgStoreProvider.java | 2 +- .../apache/sis/storage/geopackage/Initializer.java | 2 +- .../sis/storage/geopackage/GpkgStoreTest.java | 2 +- .../conformance/CoreConformanceTest.java | 2 +- .../sis/storage/shapefile/ShapefileStore.java | 2 +- .../sis/storage/shapefile/dbf/DBFIOTest.java | 2 +- .../apache/sis/storage/shapefile/dbf/Snippets.java | 2 +- .../sis/storage/shapefile/shp/ShapeIOTest.java | 2 +- .../apache/sis/storage/shapefile/shp/Snippets.java | 2 +- .../org/apache/sis/storage/gdal/GDALStore.java | 2 +- .../apache/sis/storage/gdal/GDALStoreProvider.java | 2 +- 64 files changed, 413 insertions(+), 256 deletions(-) diff --git a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/CommandRunner.java b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/CommandRunner.java index 14a21e726f..94f11814a8 100644 --- a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/CommandRunner.java +++ b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/CommandRunner.java @@ -37,7 +37,7 @@ import org.apache.sis.util.Exceptions; import org.apache.sis.util.resources.Errors; import org.apache.sis.util.internal.shared.X364; import org.apache.sis.pending.jdk.JDK22; -import org.apache.sis.storage.DataOptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; @@ -419,7 +419,7 @@ abstract class CommandRunner { final var connector = new StorageConnector(input); final Path p = getOptionAsPath(Option.METADATA); if (p != null) { - connector.setOption(DataOptionKey.METADATA_PATH, p); + connector.setOption(OptionKey.METADATA_PATH, p); } return connector; } diff --git a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/FormattedOutputCommand.java b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/FormattedOutputCommand.java index 5168df2f9c..bd8260e400 100644 --- a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/FormattedOutputCommand.java +++ b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/FormattedOutputCommand.java @@ -38,6 +38,7 @@ import org.apache.sis.storage.DataStores; import org.apache.sis.storage.DataStoreProvider; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.base.CodeType; import org.apache.sis.util.ArraysExt; import org.apache.sis.util.Version; @@ -47,7 +48,6 @@ import org.apache.sis.util.collection.TreeTableFormat; import org.apache.sis.util.resources.Errors; import org.apache.sis.util.internal.shared.X364; import org.apache.sis.measure.Range; -import org.apache.sis.setup.OptionKey; import org.apache.sis.xml.MarshallerPool; import org.apache.sis.xml.XML; diff --git a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/TranslateCommand.java b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/TranslateCommand.java index 142fe59bbe..a798a51f21 100644 --- a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/TranslateCommand.java +++ b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/TranslateCommand.java @@ -18,10 +18,10 @@ package org.apache.sis.console; import java.util.EnumSet; import java.nio.file.StandardOpenOption; -import org.apache.sis.setup.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStores; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Resource; import org.apache.sis.storage.GridCoverageResource; import org.apache.sis.storage.WritableGridCoverageResource; diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/XML.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/XML.java index 5da5ebf64d..e196954ddb 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/XML.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/XML.java @@ -117,7 +117,7 @@ public final class XML { * {@link org.apache.sis.metadata.iso.DefaultMetadata#setLanguage(Locale) setLanguage(Locale)} * method will have precedence over this property. This behavior is compliant with INSPIRE rules. * - * @see org.apache.sis.setup.OptionKey#LOCALE + * @see org.apache.sis.storage.OptionKey#LOCALE * @see Marshaller#setProperty(String, Object) * @see org.apache.sis.metadata.iso.DefaultMetadata#setLanguage(Locale) */ @@ -132,7 +132,7 @@ public final class XML { * If this property is never set, then (un)marshalling will use the * {@linkplain TimeZone#getDefault() default timezone}. * - * @see org.apache.sis.setup.OptionKey#TIMEZONE + * @see org.apache.sis.storage.OptionKey#TIMEZONE */ public static final String TIMEZONE = "org.apache.sis.xml.timezone"; diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/WKTFormat.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/WKTFormat.java index 1e109bb5db..365840cdc6 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/WKTFormat.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/WKTFormat.java @@ -142,7 +142,7 @@ public class WKTFormat extends CompoundFormat<Object> { * * @see #getIndentation() * @see #setIndentation(int) - * @see org.apache.sis.setup.OptionKey#INDENTATION + * @see org.apache.sis.storage.OptionKey#INDENTATION */ public static final int SINGLE_LINE = -1; @@ -660,7 +660,7 @@ public class WKTFormat extends CompoundFormat<Object> { * * @param numSpaces the new indentation to use in number of spaces. * - * @see org.apache.sis.setup.OptionKey#INDENTATION + * @see org.apache.sis.storage.OptionKey#INDENTATION */ public void setIndentation(final int numSpaces) { ArgumentChecks.ensureBetween("indentation", SINGLE_LINE, Byte.MAX_VALUE, numSpaces); diff --git a/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/Band.java b/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/Band.java index b43cfcad55..60554ae5d5 100644 --- a/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/Band.java +++ b/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/Band.java @@ -26,7 +26,7 @@ import org.opengis.metadata.content.CoverageContentType; import org.apache.sis.storage.GridCoverageResource; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; -import org.apache.sis.storage.DataOptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.geotiff.GeoTiffStore; import org.apache.sis.storage.modifier.CoverageModifier; import org.apache.sis.storage.base.GridResourceWrapper; @@ -115,7 +115,7 @@ final class Band extends GridResourceWrapper implements CoverageModifier { @Override protected GridCoverageResource createSource() throws DataStoreException { final StorageConnector connector = new StorageConnector(getDataPath()); - connector.setOption(DataOptionKey.COVERAGE_MODIFIER, this); + connector.setOption(OptionKey.COVERAGE_MODIFIER, this); return new GeoTiffStore(parent, parent.getProvider(), connector, true).components().get(0); } diff --git a/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/LandsatStore.java b/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/LandsatStore.java index c50037569d..6a2d6b97f2 100644 --- a/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/LandsatStore.java +++ b/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/LandsatStore.java @@ -36,6 +36,7 @@ import org.opengis.util.NameFactory; import org.opengis.util.FactoryException; import org.opengis.metadata.Metadata; import org.opengis.parameter.ParameterValueGroup; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Aggregate; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreProvider; @@ -51,7 +52,6 @@ import org.apache.sis.storage.base.URIDataStore; import org.apache.sis.storage.folder.ConcurrentCloser; import org.apache.sis.util.iso.DefaultNameFactory; import org.apache.sis.util.collection.Containers; -import org.apache.sis.setup.OptionKey; /** diff --git a/endorsed/src/org.apache.sis.storage.earthobservation/test/org/apache/sis/storage/landsat/LandsatStoreProviderTest.java b/endorsed/src/org.apache.sis.storage.earthobservation/test/org/apache/sis/storage/landsat/LandsatStoreProviderTest.java index 4c50f9706d..e00d32e595 100644 --- a/endorsed/src/org.apache.sis.storage.earthobservation/test/org/apache/sis/storage/landsat/LandsatStoreProviderTest.java +++ b/endorsed/src/org.apache.sis.storage.earthobservation/test/org/apache/sis/storage/landsat/LandsatStoreProviderTest.java @@ -17,7 +17,7 @@ package org.apache.sis.storage.landsat; import java.nio.charset.StandardCharsets; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.ProbeResult; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Compression.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Compression.java index b034ee6507..339c3d3d41 100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Compression.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Compression.java @@ -19,9 +19,9 @@ package org.apache.sis.storage.geotiff; import java.io.Serializable; import java.util.OptionalInt; import java.util.zip.Deflater; -import org.apache.sis.setup.OptionKey; import org.apache.sis.util.ArgumentChecks; import org.apache.sis.util.internal.shared.Strings; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.geotiff.base.Predictor; import org.apache.sis.io.stream.InternalOptionKey; diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/FormatModifier.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/FormatModifier.java index 8a6b93a2e2..23e2dbfe91 100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/FormatModifier.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/FormatModifier.java @@ -16,7 +16,7 @@ */ package org.apache.sis.storage.geotiff; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.io.stream.InternalOptionKey; diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/GeoTiffStore.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/GeoTiffStore.java index dffd88becf..b7eea15c13 100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/GeoTiffStore.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/GeoTiffStore.java @@ -36,7 +36,7 @@ import org.opengis.util.GenericName; import org.opengis.metadata.Metadata; import org.opengis.metadata.maintenance.ScopeCode; import org.opengis.parameter.ParameterValueGroup; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Aggregate; import org.apache.sis.storage.GridCoverageResource; import org.apache.sis.storage.DataStore; diff --git a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStore.java b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStore.java index 2eb0127f3f..114e61e931 100644 --- a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStore.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStore.java @@ -30,6 +30,7 @@ import org.opengis.util.NameFactory; import org.opengis.util.GenericName; import org.opengis.metadata.Metadata; import org.opengis.parameter.ParameterValueGroup; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreProvider; import org.apache.sis.storage.DataStoreException; @@ -44,7 +45,6 @@ import org.apache.sis.storage.netcdf.base.RasterResource; import org.apache.sis.storage.event.StoreEvent; import org.apache.sis.storage.event.StoreListener; import org.apache.sis.storage.event.WarningEvent; -import org.apache.sis.setup.OptionKey; import org.apache.sis.util.Version; import org.apache.sis.util.CharSequences; import org.apache.sis.util.collection.Containers; diff --git a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java index 2deae29e12..8766ff3992 100644 --- a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java @@ -26,6 +26,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.UndeclaredThrowableException; import org.opengis.parameter.ParameterDescriptorGroup; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreProvider; import org.apache.sis.storage.StorageConnector; @@ -48,7 +49,6 @@ import org.apache.sis.storage.base.URIDataStoreProvider; import org.apache.sis.system.SystemListener; import org.apache.sis.system.Modules; import org.apache.sis.setup.GeometryLibrary; -import org.apache.sis.setup.OptionKey; import org.apache.sis.storage.event.StoreListeners; import org.apache.sis.util.Version; import org.apache.sis.util.logging.Logging; diff --git a/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/SQLStore.java b/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/SQLStore.java index dcc04f93c8..6c8bce2ee2 100644 --- a/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/SQLStore.java +++ b/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/SQLStore.java @@ -31,6 +31,7 @@ import java.lang.reflect.Method; import org.opengis.util.GenericName; import org.opengis.metadata.Metadata; import org.opengis.parameter.ParameterValueGroup; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Resource; import org.apache.sis.storage.Aggregate; import org.apache.sis.storage.DataStore; @@ -56,7 +57,6 @@ import org.apache.sis.util.Version; import org.apache.sis.util.iso.Names; import org.apache.sis.util.internal.shared.Strings; import org.apache.sis.setup.GeometryLibrary; -import org.apache.sis.setup.OptionKey; /** diff --git a/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/feature/SchemaModifier.java b/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/feature/SchemaModifier.java index 49b1c822e3..05cd03b6dd 100644 --- a/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/feature/SchemaModifier.java +++ b/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/feature/SchemaModifier.java @@ -17,9 +17,9 @@ package org.apache.sis.storage.sql.feature; import org.apache.sis.feature.builder.FeatureTypeBuilder; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.io.stream.InternalOptionKey; -import org.apache.sis.setup.OptionKey; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.feature.FeatureType; @@ -69,7 +69,7 @@ public interface SchemaModifier { * The option for declaring a schema modifier at {@link org.apache.sis.storage.sql.SQLStore} creation time. * * @todo if we move this key in public API in the future, then it would be a - * value in existing {@link org.apache.sis.storage.DataOptionKey} class. + * value in existing {@link org.apache.sis.storage.OptionKey} class. */ OptionKey<SchemaModifier> OPTION_KEY = new InternalOptionKey<>("SCHEMA_MODIFIER", SchemaModifier.class); } diff --git a/endorsed/src/org.apache.sis.storage.sql/test/org/apache/sis/storage/sql/postgis/PostgresTest.java b/endorsed/src/org.apache.sis.storage.sql/test/org/apache/sis/storage/sql/postgis/PostgresTest.java index 53a2eb680e..0d862e5bcf 100644 --- a/endorsed/src/org.apache.sis.storage.sql/test/org/apache/sis/storage/sql/postgis/PostgresTest.java +++ b/endorsed/src/org.apache.sis.storage.sql/test/org/apache/sis/storage/sql/postgis/PostgresTest.java @@ -39,8 +39,8 @@ import org.opengis.metadata.spatial.SpatialRepresentationType; import org.opengis.util.FactoryException; import org.opengis.referencing.crs.ProjectedCRS; import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.apache.sis.setup.OptionKey; import org.apache.sis.setup.GeometryLibrary; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.FeatureSet; import org.apache.sis.storage.FeatureQuery; import org.apache.sis.storage.StorageConnector; diff --git a/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Store.java b/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Store.java index ebe8c6ddc9..180cc537e9 100644 --- a/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Store.java +++ b/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Store.java @@ -25,6 +25,7 @@ import org.opengis.util.FactoryException; import org.opengis.geometry.Envelope; import org.opengis.metadata.Metadata; import org.opengis.metadata.distribution.Format; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.FeatureSet; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; @@ -33,7 +34,6 @@ import org.apache.sis.storage.base.StoreUtilities; import org.apache.sis.storage.xml.stream.StaxDataStore; import org.apache.sis.util.Version; import org.apache.sis.util.SimpleInternationalString; -import org.apache.sis.setup.OptionKey; import org.apache.sis.setup.GeometryLibrary; import org.apache.sis.util.iso.DefaultNameFactory; import org.apache.sis.metadata.iso.citation.DefaultCitation; diff --git a/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/xml/stream/StaxDataStore.java b/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/xml/stream/StaxDataStore.java index eb7a851324..e96f908262 100644 --- a/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/xml/stream/StaxDataStore.java +++ b/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/xml/stream/StaxDataStore.java @@ -36,7 +36,7 @@ import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import javax.xml.stream.XMLStreamException; import org.apache.sis.xml.XML; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; diff --git a/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/ReaderTest.java b/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/ReaderTest.java index 86cd129697..4b5a69fc3b 100644 --- a/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/ReaderTest.java +++ b/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/ReaderTest.java @@ -25,7 +25,7 @@ import com.esri.core.geometry.Point; import com.esri.core.geometry.Polyline; import org.opengis.geometry.Envelope; import org.apache.sis.setup.GeometryLibrary; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.gps.Fix; diff --git a/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/UpdaterTest.java b/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/UpdaterTest.java index 427187e7db..c82bab74a9 100644 --- a/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/UpdaterTest.java +++ b/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/UpdaterTest.java @@ -26,7 +26,7 @@ import java.nio.file.StandardCopyOption; import java.time.Instant; import com.esri.core.geometry.Point; import org.apache.sis.setup.GeometryLibrary; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; diff --git a/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/WriterTest.java b/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/WriterTest.java index 1b213ad6e3..ad9b7976c2 100644 --- a/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/WriterTest.java +++ b/endorsed/src/org.apache.sis.storage.xml/test/org/apache/sis/storage/gpx/WriterTest.java @@ -24,7 +24,7 @@ import java.io.ByteArrayOutputStream; import java.io.UnsupportedEncodingException; import com.esri.core.geometry.Point; import org.apache.sis.setup.GeometryLibrary; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.gps.Fix; diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/InternalOptionKey.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/InternalOptionKey.java index f36ac483f2..bebafa7137 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/InternalOptionKey.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/io/stream/InternalOptionKey.java @@ -20,9 +20,9 @@ import java.util.Map; import java.util.function.Predicate; import java.util.function.UnaryOperator; import java.util.concurrent.locks.ReadWriteLock; -import org.apache.sis.setup.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreProvider; +import org.apache.sis.storage.OptionKey; /** diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataOptionKey.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataOptionKey.java index 2311189d74..d995be101b 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataOptionKey.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataOptionKey.java @@ -16,16 +16,6 @@ */ package org.apache.sis.storage; -import java.io.ObjectStreamException; -import java.nio.file.Path; -import static java.util.logging.Logger.getLogger; -import org.apache.sis.util.logging.Logging; -import org.apache.sis.system.Modules; -import org.apache.sis.setup.OptionKey; -import org.apache.sis.storage.event.StoreListeners; -import org.apache.sis.feature.FoliationRepresentation; -import org.apache.sis.storage.modifier.CoverageModifier; - /** * Keys in a map of options for configuring the way data are read or written to a storage. @@ -33,85 +23,20 @@ import org.apache.sis.storage.modifier.CoverageModifier; * or other kinds of structure that are specific to some data formats. * * @author Martin Desruisseaux (Geomatys) - * @version 1.5 + * @version 1.7 * * @param <T> the type of option values. * * @since 1.0 + * + * @deprecated Merged with {@link OptionKey}× */ +@Deprecated(since = "1.7", forRemoval = true) public final class DataOptionKey<T> extends OptionKey<T> { - /** - * For cross-version compatibility. - */ - private static final long serialVersionUID = 8927757348322016043L; - - /** - * Path to an auxiliary file containing metadata encoded in an ISO 19115-3 XML document. - * The given path, if not absolute, is relative to the path of the main storage file. - * If the file exists, it is parsed and its content is merged or appended after the - * metadata read by the storage. If the file does not exist, then it is ignored. - * - * <h4>Wildcard</h4> - * It the {@code '*'} character is present in the path, then it is replaced by the name of the - * main file without its extension. For example if the main file is {@code "city-center.tiff"}, - * then {@code "*.xml"} will become {@code "city-center.xml"}. - * - * @since 1.5 - */ - public static final OptionKey<Path> METADATA_PATH = - new DataOptionKey<>("METADATA_PATH", Path.class); - - /** - * Whether to assemble trajectory fragments (distinct CSV lines) into a single {@code Feature} instance - * forming a foliation. This is ignored if the file does not seem to contain moving features. - * - * @since 1.0 - */ - public static final OptionKey<FoliationRepresentation> FOLIATION_REPRESENTATION = - new DataOptionKey<>("FOLIATION_REPRESENTATION", FoliationRepresentation.class); - - /** - * The listeners to declare as the parent of the data store listeners. - * This option can be used when the {@link DataStore} to open is itself - * a child of an {@link Aggregate}. - * - * @since 1.3 - */ - public static final OptionKey<StoreListeners> PARENT_LISTENERS = - new DataOptionKey<>("PARENT_LISTENERS", StoreListeners.class); - - /** - * Callback methods invoked for modifying some aspects of the grid coverages created by resources. - * - * @since 1.5 - */ - public static final OptionKey<CoverageModifier> COVERAGE_MODIFIER = - new DataOptionKey<>("COVERAGE_MODIFIER", CoverageModifier.class); - /** * Creates a new key of the given name. */ private DataOptionKey(final String name, final Class<T> type) { super(name, type); } - - /** - * Resolves this option key on deserialization. This method is invoked only - * for instance of the exact {@code DataOptionKey} class, not subclasses. - * - * @return the unique {@code DataOptionKey} instance. - * @throws ObjectStreamException required by specification but should never be thrown. - */ - private Object readResolve() throws ObjectStreamException { - try { - return DataOptionKey.class.getField(getName()).get(null); - } catch (ReflectiveOperationException e) { - /* - * This may happen if we are deserializing a stream produced by a more recent SIS library - * than the one running in this JVM. - */ - Logging.recoverableException(getLogger(Modules.STORAGE), DataOptionKey.class, "readResolve", e); - return this; - } - } } diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStore.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStore.java index c0ab806cbb..714268025e 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStore.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStore.java @@ -134,7 +134,7 @@ public abstract class DataStore implements Resource, Localized, AutoCloseable { this.provider = provider; this.displayName = connector.getDisplayName(); this.locale = Locale.getDefault(Locale.Category.DISPLAY); - this.listeners = new StoreListeners(connector.getOption(DataOptionKey.PARENT_LISTENERS), this); + this.listeners = new StoreListeners(connector.getOption(OptionKey.PARENT_LISTENERS), this); /* * Above locale is NOT OptionKey.LOCALE because we are not talking about the same locale. * The one in this DataStore is for warning and exception messages, not for parsing data. @@ -232,6 +232,7 @@ public abstract class DataStore implements Resource, Localized, AutoCloseable { * @param locale the new locale to use. * * @see DataStoreException#getLocalizedMessage() + * @see OptionKey#LOCALE */ public synchronized void setLocale(final Locale locale) { this.locale = Objects.requireNonNull(locale); diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreRegistry.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreRegistry.java index 5e3e9d7082..358f189bcb 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreRegistry.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/DataStoreRegistry.java @@ -23,10 +23,10 @@ import java.util.function.Predicate; import java.nio.file.StandardOpenOption; import org.apache.sis.io.stream.IOUtilities; import org.apache.sis.io.stream.InternalOptionKey; -import org.apache.sis.setup.OptionKey; import org.apache.sis.system.Reflect; import org.apache.sis.system.Modules; import org.apache.sis.system.SystemListener; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.internal.Resources; import org.apache.sis.storage.base.Capability; import org.apache.sis.storage.base.StoreMetadata; diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/OptionKey.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/OptionKey.java new file mode 100644 index 0000000000..ca0dfd18a1 --- /dev/null +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/OptionKey.java @@ -0,0 +1,285 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sis.storage; + +import java.util.Locale; +import java.util.logging.Logger; +import java.util.function.Supplier; +import java.time.ZoneId; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.file.Path; +import java.nio.file.OpenOption; +import java.nio.file.StandardOpenOption; +import java.io.ObjectStreamException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.apache.sis.util.logging.Logging; +import org.apache.sis.setup.GeometryLibrary; +import org.apache.sis.storage.event.StoreListeners; +import org.apache.sis.storage.modifier.CoverageModifier; +import org.apache.sis.feature.FoliationRepresentation; +import org.apache.sis.system.Modules; + + +/** + * Keys in a map of options for configuring data stores. + * {@code OptionKey}s are used for aspects that usually do not need to be configured, except in a few specialized cases. + * For example, most data file formats read by <abbr>SIS</abbr> do not require the user to specify the character encoding, + * because the encoding is often given in the file header or in the format specification. However, if <abbr>SIS</abbr> + * needs to read plain text files <em>and</em> the default platform encoding is not suitable, + * then the user can specify the desired encoding explicitly using the {@link #ENCODING} option. + * + * <p>All options are <em>hints</em> and may be silently ignored. For example, most {@link DataStore}s will ignore the + * {@code ENCODING} option if irrelevant to their format, or if the encoding is specified in the data file header.</p> + * + * <p>Options are <em>transitive</em>: if a data store uses others data stores for its internal working, + * the given options may also be given to those dependencies, at implementation choice.</p> + * + * <h2>Defining new options</h2> + * Developers who wish to define their own options can define static constants in a subclass, + * as in the following example: + * + * {@snippet lang="java" : + * public final class MyOptionKey<T> extends OptionKey<T> { + * public static final OptionKey<String> MY_OPTION = new MyOptionKey<>("MY_OPTION", String.class); + * + * private MyOptionKey(final String name, final Class<T> type) { + * super(name, type); + * } + * } + * } + * + * @author Martin Desruisseaux (Geomatys) + * @version 1.7 + * + * @param <T> the type of option values. + * + * @since 1.7 + */ +public class OptionKey<T> extends org.apache.sis.setup.OptionKey<T> { + /** + * The locale to use for locale-sensitive data. This option determines the language to use for writing + * {@link org.opengis.util.InternationalString international strings} when the target storage supports + * only one language. It may also control number and date patterns in some file formats such as + * Comma Separated Values (<abbr>CSV</abbr>). However, most data formats will ignore this locale. + * + * <p>This option is <strong>not</strong> for the locale of logging or warning messages. + * Messages locale is rather controlled by {@link DataStore#setLocale(Locale)}.</p> + * + * @see org.apache.sis.xml.XML#LOCALE + * @see DataStore#setLocale(Locale) + */ + public static final OptionKey<Locale> LOCALE = new OptionKey<>("LOCALE", Locale.class); + + /** + * The timezone to use when parsing or formatting dates and times without explicit timezone. + * If this option is not provided, then the default value is format specific. + * That default is often, but not necessarily, the {@linkplain ZoneId#systemDefault() platform default}. + * + * @see org.apache.sis.xml.XML#TIMEZONE + */ + public static final OptionKey<ZoneId> TIMEZONE = new OptionKey<>("TIMEZONE", ZoneId.class); + + /** + * The number of spaces to use for indentation when formatting texts in <abbr>WKT</abbr> or <abbr>XML</abbr>. + * A value of {@value org.apache.sis.io.wkt.WKTFormat#SINGLE_LINE} means to format the whole <abbr>WKT</abbr> + * or <abbr>XML</abbr> document on a single line without line feeds or indentation. + * + * <p>If this option is not provided, then the most typical default value used in Apache <abbr>SIS</abbr> is 2. + * Such small indentation value is used because <abbr>XML</abbr> documents defined by <abbr>OGC</abbr> standards + * tend to be verbose.</p> + * + * @see org.apache.sis.io.wkt.WKTFormat#SINGLE_LINE + * @see jakarta.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT + */ + public static final OptionKey<Integer> INDENTATION = new OptionKey<>("INDENTATION", Integer.class); + + /** + * The character encoding of document content. + * This option can be used when the file to read or write does not describe itself its encoding. + * For example, this option can be used when reading plain text files, but is ignored when + * reading <abbr>XML</abbr> files having a {@code <?xml version="1.0" encoding="…"?>} declaration. + * + * <p>If this option is not provided, then the default value is format specific. + * That default is often, but not necessarily, the {@linkplain Charset#defaultCharset() platform default}.</p> + * + * @see jakarta.xml.bind.Marshaller#JAXB_ENCODING + */ + public static final OptionKey<Charset> ENCODING = new OptionKey<>("ENCODING", Charset.class); + + /** + * The encoding of a <abbr>URL</abbr> (<em>not</em> the encoding of the document content). + * This option may be used when converting a {@link String} or a {@link java.net.URL} + * to a {@link java.net.URI} or a {@link java.io.File}. The following rules apply: + * + * <ul> + * <li><abbr>URI</abbr> are always encoded in <abbr>UTF</abbr>-8. + * Therefore, this option is ignored for <abbr>URI</abbr>.</li> + * <li><abbr>URL</abbr> are often encoded in <abbr>UTF</abbr>-8, but not necessarily. + * Other encoding are possible (while not recommended), or some <abbr>URL</abbr> may not be encoded at all.</li> + * </ul> + * + * If this option is not provided, then the <abbr>URL</abbr> is assumed <em>not</em> encoded. + * + * <p><b>Example:</b> Given the {@code "file:Map%20with%20spaces.png"} URL, then:</p> + * <ul> + * <li>If the <abbr>URL</abbr> encoding option is set to {@code "UTF-8"} or {@code "ISO-8859-1"}, then:<ul> + * <li>the encoded <abbr>URI</abbr> will be {@code "file:Map%20with%20spaces.png"};</li> + * <li>the decoded <abbr>URI</abbr> or the file will be {@code "file:Map with spaces.png"}.</li> + * </ul></li> + * <li>If the <abbr>URL</abbr> encoding option is set to {@code null} or is not provided, then:<ul> + * <li>the encoded <abbr>URI</abbr> will be {@code "file:Map%2520with%2520spaces.png"}, + * i.e. the percent sign will be encoded as {@code "%25"};</li> + * <li>the decoded <abbr>URI</abbr> or the file will be {@code "file:Map%20with%20spaces.png"}.</li> + * </ul></li> + * </ul> + * + * @see java.net.URLDecoder + */ + public static final OptionKey<String> URL_ENCODING = new OptionKey<>("URL_ENCODING", String.class); + + /** + * Whether a storage object shall be opened in read, write, append or other modes. + * The main options that can be provided are: + * + * <table class="sis"> + * <caption>Supported open options</caption> + * <tr><th>Value</th> <th>Meaning</th></tr> + * <tr><td>{@link StandardOpenOption#READ}</td> <td>Open for reading data from the storage object.</td></tr> + * <tr><td>{@link StandardOpenOption#WRITE}</td> <td>Open for modifying existing data in the storage object.</td></tr> + * <tr><td>{@link StandardOpenOption#APPEND}</td> <td>Open for appending new data in the storage object.</td></tr> + * <tr><td>{@link StandardOpenOption#CREATE}</td> <td>Creates a new storage object (file or database) if it does not exist.</td></tr> + * </table> + */ + public static final OptionKey<OpenOption[]> OPEN_OPTIONS = new OptionKey<>("OPEN_OPTIONS", OpenOption[].class); + + /** + * Provider of the byte buffer to use for input/output operations. Some {@link DataStore} implementations allow + * a buffer to be specified, thus allowing users to choose the buffer {@linkplain ByteBuffer#capacity() capacity}, + * whether the buffer {@linkplain ByteBuffer#isDirect() is direct}, or to recycle existing buffers. + * + * <p>It is user's responsibility to ensure that:</p> + * <ul> + * <li>The buffer does not contains any valuable data, as it will be {@linkplain ByteBuffer#clear() cleared}.</li> + * <li>The same buffer is not used concurrently by two different {@code DataStore} instances.</li> + * </ul> + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + public static final OptionKey<Supplier<ByteBuffer>> BYTE_BUFFER = new OptionKey("BYTE_BUFFER", Supplier.class); + + /** + * Path to an auxiliary file containing metadata encoded in an <abbr>ISO</abbr> 19115-3 <abbr>XML</abbr> document. + * The given path, if not absolute, is relative to the path of the main storage file. + * If the file exists, it is parsed and its content is merged or appended after the + * metadata read by the storage. If the file does not exist, then it is ignored. + * + * <h4>Wildcard</h4> + * It the {@code '*'} character is present in the path, then it is replaced by the name of the + * main file without its extension. For example if the main file is {@code "city-center.tiff"}, + * then {@code "*.xml"} will become {@code "city-center.xml"}. + */ + public static final OptionKey<Path> METADATA_PATH = new OptionKey<>("METADATA_PATH", Path.class); + + /** + * The coordinate reference system (<abbr>CRS</abbr>) of data to use if not explicitly defined. + * This option can be used when the file to read does not describe itself the data <abbr>CRS</abbr>. + * For example, this option can be used when reading <abbr>ASCII</abbr> Grid without <abbr>CRS</abbr> + * information, but is ignored if the <abbr>ASCII</abbr> Grid file is accompanied by a {@code *.prj} + * file giving the <abbr>CRS</abbr>. + */ + public static final OptionKey<CoordinateReferenceSystem> DEFAULT_CRS = + new OptionKey<>("DEFAULT_CRS", CoordinateReferenceSystem.class); + + /** + * Whether to assemble trajectory fragments (distinct <abbr>CSV</abbr> lines) into a single {@code Feature} + * instance forming a foliation. This is ignored if the file does not seem to contain moving features. + */ + public static final OptionKey<FoliationRepresentation> FOLIATION_REPRESENTATION = + new OptionKey<>("FOLIATION_REPRESENTATION", FoliationRepresentation.class); + + /** + * The library to use for creating geometric objects at reading time. Some available libraries are + * the Java Topology Suite (<abbr>JTS</abbr>), <abbr>ESRI</abbr> geometry <abbr>API</abbr> and Java2D. + * If this option is not specified, then a default library will be selected among the libraries available + * in the runtime environment. + */ + public static final OptionKey<GeometryLibrary> GEOMETRY_LIBRARY = + new OptionKey<>("GEOMETRY_LIBRARY", GeometryLibrary.class); + + /** + * Callback methods invoked for modifying some aspects of the grid coverages created by resources. + */ + public static final OptionKey<CoverageModifier> COVERAGE_MODIFIER = + new OptionKey<>("COVERAGE_MODIFIER", CoverageModifier.class); + + /** + * The listeners to declare as the parent of the data store listeners. + * This option can be used when the {@link DataStore} to open is itself + * a child of an {@link Aggregate}. + */ + public static final OptionKey<StoreListeners> PARENT_LISTENERS = + new OptionKey<>("PARENT_LISTENERS", StoreListeners.class); + + // Temporary hack for transition from deprecated class. + static { + org.apache.sis.setup.OptionKey.LOCALE = LOCALE; + org.apache.sis.setup.OptionKey.TIMEZONE = TIMEZONE; + org.apache.sis.setup.OptionKey.ENCODING = ENCODING; + org.apache.sis.setup.OptionKey.URL_ENCODING = URL_ENCODING; + org.apache.sis.setup.OptionKey.OPEN_OPTIONS = OPEN_OPTIONS; + org.apache.sis.setup.OptionKey.DEFAULT_CRS = DEFAULT_CRS; + org.apache.sis.setup.OptionKey.INDENTATION = INDENTATION; + org.apache.sis.setup.OptionKey.GEOMETRY_LIBRARY = GEOMETRY_LIBRARY; + } + + /* + * Note: we do not provide a LINE_SEPARATOR option for now because we cannot control the line separator + * in JDK's JAXB implementation, and Apache SIS provides an org.apache.sis.io.LineAppender alternative. + */ + + /** + * Creates a new key of the given name for values of the given type. + * + * @param name the key name. + * @param type the type of values. + */ + protected OptionKey(final String name, final Class<T> type) { + super(name, type); + } + + /** + * Resolves this option key on deserialization. This method is invoked + * only for instance of the exact {@code OptionKey} class, not subclasses. + * + * @return the unique {@code OptionKey} instance. + * @throws ObjectStreamException required by specification but should never be thrown. + */ + private Object readResolve() throws ObjectStreamException { + try { + return OptionKey.class.getField(super.getName()).get(null); + } catch (ReflectiveOperationException e) { + /* + * This may happen if we are deserializing a stream produced by a more recent SIS library + * than the one running in this JVM. This class should be robust to this situation, since + * we override the `equals` and `hashCode` methods. This option is likely to be ignored, + * but options are expected to be optional. + */ + Logging.recoverableException(Logger.getLogger(Modules.STORAGE), OptionKey.class, "readResolve", e); + return this; + } + } +} diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/StorageConnector.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/StorageConnector.java index 93a02c84c7..9d7f5a3c99 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/StorageConnector.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/StorageConnector.java @@ -20,6 +20,7 @@ import java.util.Map; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.Objects; +import java.util.function.Supplier; import java.util.function.UnaryOperator; import java.net.URI; import java.net.URL; @@ -77,7 +78,6 @@ import org.apache.sis.io.stream.ChannelImageInputStream; import org.apache.sis.io.stream.ChannelImageOutputStream; import org.apache.sis.io.stream.InternalOptionKey; import org.apache.sis.system.Configuration; -import org.apache.sis.setup.OptionKey; /** @@ -294,7 +294,7 @@ public class StorageConnector implements Serializable { * @see #setOption(OptionKey, Object) */ @SuppressWarnings("serial") // Not statically typed as Serializable. - private Map<OptionKey<?>, Object> options; + private Map<org.apache.sis.setup.OptionKey<?>, Object> options; /** * If a probing operation is ongoing, the provider doing the operation. Otherwise {@code null}. @@ -670,7 +670,7 @@ public class StorageConnector implements Serializable { * @param key the option for which to set the value. * @param value the new value for the given option, or {@code null} for removing the value. */ - public <T> void setOption(final OptionKey<T> key, final T value) { + public <T> void setOption(final org.apache.sis.setup.OptionKey<T> key, final T value) { options = key.setValueInto(options, value); } @@ -682,7 +682,7 @@ public class StorageConnector implements Serializable { * @param key the option for which to get the value. * @return the current value for the given option, or {@code null} if none. */ - public <T> T getOption(final OptionKey<T> key) { + public <T> T getOption(final org.apache.sis.setup.OptionKey<T> key) { return key.getValueFrom(options); } @@ -1307,14 +1307,14 @@ public class StorageConnector implements Serializable { * @return the byte buffer to use with {@link ChannelDataInput} or {@link ChannelDataOutput}. */ private ByteBuffer getChannelBuffer(final ChannelFactory factory) { - @SuppressWarnings("deprecation") - ByteBuffer buffer = getOption(OptionKey.BYTE_BUFFER); // User-supplied buffer. - if (buffer == null) { - if (factory.suggestDirectBuffer) { + ByteBuffer buffer; + final Supplier<ByteBuffer> s = getOption(OptionKey.BYTE_BUFFER); + if (s == null || (buffer = s.get()) == null) { + if (factory.suggestDirectBuffer) { buffer = ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE); } else { buffer = ByteBuffer.allocate(DEFAULT_BUFFER_SIZE); - } + } } return buffer; } @@ -1842,6 +1842,7 @@ public class StorageConnector implements Serializable { * * @since 1.2 */ + @SuppressWarnings("UseSpecificCatch") public <S> S commit(final Class<S> type, final String format) throws IllegalArgumentException, DataStoreException { final S view; try { diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/PRJDataStore.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/PRJDataStore.java index d7239a84bc..a7bd5b81f9 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/PRJDataStore.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/PRJDataStore.java @@ -33,7 +33,7 @@ import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreProvider; import org.apache.sis.storage.DataStoreException; diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStore.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStore.java index e57ab44988..33df2902b2 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStore.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStore.java @@ -41,7 +41,7 @@ import jakarta.xml.bind.JAXBException; import org.opengis.util.GenericName; import org.opengis.parameter.ParameterValueGroup; import org.apache.sis.storage.StorageConnector; -import org.apache.sis.storage.DataOptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreProvider; import org.apache.sis.storage.DataStoreException; @@ -49,7 +49,6 @@ import org.apache.sis.storage.DataStoreContentException; import org.apache.sis.storage.ReadOnlyStorageException; import org.apache.sis.storage.internal.Resources; import org.apache.sis.io.stream.IOUtilities; -import org.apache.sis.setup.OptionKey; import org.apache.sis.util.ArraysExt; import org.apache.sis.util.iso.Names; import org.apache.sis.util.resources.Errors; @@ -124,7 +123,7 @@ public abstract class URIDataStore extends DataStore implements StoreResource { location = connector.getStorageAs(URI.class); locationAsPath = connector.getStorageAs(Path.class); if (locationAsPath != null || location != null) { - metadataPath = connector.getOption(DataOptionKey.METADATA_PATH); + metadataPath = connector.getOption(OptionKey.METADATA_PATH); } else { metadataPath = null; } @@ -183,7 +182,7 @@ public abstract class URIDataStore extends DataStore implements StoreResource { * Returns the main and metadata locations as {@code Path} components, or an empty value if none. * The default implementation returns the storage specified at construction time converted to a * {@link Path} if such conversion was possible, or an empty value otherwise. The set may also - * contains the path to the {@linkplain DataOptionKey#METADATA_PATH auxiliary metadata file}. + * contains the path to the {@linkplain OptionKey#METADATA_PATH auxiliary metadata file}. * * @return the URI to component files as paths, or an empty value if unknown. * @throws DataStoreException if an error occurred while getting the paths. @@ -284,7 +283,7 @@ public abstract class URIDataStore extends DataStore implements StoreResource { /** * Returns the path to the auxiliary metadata file, or {@code null} if none. - * This is a path built from the {@link DataOptionKey#METADATA_PATH} value if present. + * This is a path built from the {@link OptionKey#METADATA_PATH} value if present. * Note that the metadata may be unavailable as a {@link Path} but available as an {@link URI}. * * @return the path to the auxiliary metadata file, or {@code null} if none. @@ -308,7 +307,7 @@ public abstract class URIDataStore extends DataStore implements StoreResource { /** * Returns the <abbr>URI</abbr> to the auxiliary metadata file, or {@code null} if none. - * This is a path built from the {@link DataOptionKey#METADATA_PATH} value if present. + * This is a path built from the {@link OptionKey#METADATA_PATH} value if present. * Note that the metadata may be unavailable as an {@link URI} but available as a {@link Path}. * * @return the <abbr>URI</abbr> to the auxiliary metadata file, or {@code null} if none. diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStoreProvider.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStoreProvider.java index dfb80acdef..dc53621cc9 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStoreProvider.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/URIDataStoreProvider.java @@ -35,6 +35,7 @@ import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.parameter.ParameterNotFoundException; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.storage.StorageConnector; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreProvider; import org.apache.sis.storage.DataStoreException; @@ -43,7 +44,6 @@ import org.apache.sis.storage.Resource; import org.apache.sis.storage.internal.Resources; import org.apache.sis.io.stream.ChannelDataOutput; import org.apache.sis.io.stream.IOUtilities; -import org.apache.sis.setup.OptionKey; import org.apache.sis.util.ArraysExt; import org.apache.sis.util.logging.Logging; diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/Store.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/Store.java index 58d5d7760b..74ba1d6c77 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/Store.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/Store.java @@ -55,7 +55,7 @@ import org.apache.sis.util.internal.shared.Numerics; import org.apache.sis.util.resources.Errors; import org.apache.sis.util.resources.Vocabulary; import org.apache.sis.temporal.LenientDateFormat; -import org.apache.sis.storage.DataOptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.DataStoreContentException; import org.apache.sis.storage.DataStoreReferencingException; @@ -72,7 +72,6 @@ import org.apache.sis.geometry.ImmutableEnvelope; import org.apache.sis.geometry.wrapper.Geometries; import org.apache.sis.geometry.wrapper.GeometryType; import org.apache.sis.metadata.iso.DefaultMetadata; -import org.apache.sis.setup.OptionKey; import org.apache.sis.measure.Units; // Specific to the geoapi-3.1 and geoapi-4.0 branches: @@ -216,7 +215,7 @@ final class Store extends URIDataStore implements FeatureSet { * Creates a new CSV store from the given file, URL or stream. * * <p>If the CSV file is known to be a Moving Feature file, then the given connector should - * have an {@link org.apache.sis.setup.OptionKey#ENCODING} value set to UTF-8.</p> + * have an {@link OptionKey#ENCODING} value set to UTF-8.</p> * * @param provider the factory that created this {@code DataStore} instance, or {@code null} if unspecified. * @param connector information about the storage (URL, stream, <i>etc</i>). @@ -227,7 +226,7 @@ final class Store extends URIDataStore implements FeatureSet { final Reader r = connector.commit(Reader.class, StoreProvider.NAME); source = (r instanceof BufferedReader) ? (BufferedReader) r : new LineNumberReader(r); geometries = Geometries.factory(connector.getOption(OptionKey.GEOMETRY_LIBRARY)); - dissociate = connector.getOption(DataOptionKey.FOLIATION_REPRESENTATION) == FoliationRepresentation.FRAGMENTED; + dissociate = connector.getOption(OptionKey.FOLIATION_REPRESENTATION) == FoliationRepresentation.FRAGMENTED; @SuppressWarnings("LocalVariableHidesMemberVariable") GeneralEnvelope envelope = null; @SuppressWarnings("LocalVariableHidesMemberVariable") FeatureType featureType = null; @SuppressWarnings("LocalVariableHidesMemberVariable") Foliation foliation = null; diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/StoreProvider.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/StoreProvider.java index 4cdda19ab5..78c73053e4 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/StoreProvider.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/StoreProvider.java @@ -24,7 +24,7 @@ import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreException; -import org.apache.sis.storage.DataOptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.ProbeResult; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.FeatureSet; @@ -183,8 +183,8 @@ public final class StoreProvider extends URIDataStoreProvider { public DataStore open(final ParameterValueGroup parameters) throws DataStoreException { final StorageConnector connector = connector(this, parameters); final Parameters pg = Parameters.castOrWrap(parameters); - connector.setOption(DataOptionKey.ENCODING, pg.getValue(ENCODING)); - connector.setOption(DataOptionKey.FOLIATION_REPRESENTATION, pg.getValue(FOLIATION)); + connector.setOption(OptionKey.ENCODING, pg.getValue(ENCODING)); + connector.setOption(OptionKey.FOLIATION_REPRESENTATION, pg.getValue(FOLIATION)); return new Store(this, connector); } diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/package-info.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/package-info.java index cf15404897..e8a5af8da0 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/package-info.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/package-info.java @@ -44,7 +44,7 @@ * * <ul> * <li>Character encoding is not necessarily UTF-8 since a different encoding can be specified with - * {@link org.apache.sis.setup.OptionKey#ENCODING} in the {@link org.apache.sis.storage.StorageConnector}. + * {@link org.apache.sis.storage.OptionKey#ENCODING} in the {@link org.apache.sis.storage.StorageConnector}. * If not specified, Apache SIS uses the Java platform default encoding (which is often UTF-8).</li> * <li>The Apache SIS implementation does not replace the XML entities by the referenced characters. * XML entities, if present, are included verbatim in the parsed text.</li> diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/esri/AsciiGridStore.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/esri/AsciiGridStore.java index fda499dda2..112b6237b7 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/esri/AsciiGridStore.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/esri/AsciiGridStore.java @@ -31,6 +31,7 @@ import org.apache.sis.coverage.grid.GridExtent; import org.apache.sis.coverage.grid.GridGeometry; import org.apache.sis.coverage.grid.PixelInCell; import org.apache.sis.math.Statistics; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.DataStoreClosedException; @@ -48,9 +49,8 @@ import org.apache.sis.util.resources.Errors; * Data store implementation for ESRI ASCII grid format. * This is a very simple format for reading and writing single-banded raster data. * As the "ASCII" name implies, files are text files in US-ASCII character encoding - * no matter what the {@link org.apache.sis.setup.OptionKey#ENCODING} value is, - * and numbers are parsed or formatted according the US locale no matter - * what the {@link org.apache.sis.setup.OptionKey#LOCALE} value is. + * no matter what the {@link OptionKey#ENCODING} value is, and numbers are parsed or + * formatted according the US locale no matter what the {@link OptionKey#LOCALE} value is. * * <p>ASCII grid files contains a header before the actual data. * The header contains (<var>key</var> <var>value</var>) pairs, diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/Store.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/Store.java index 6e1c24ad7a..a1e57ae6aa 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/Store.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/Store.java @@ -39,10 +39,9 @@ import org.opengis.util.NameSpace; import org.opengis.metadata.Metadata; import org.opengis.metadata.maintenance.ScopeCode; import org.opengis.parameter.ParameterValueGroup; -import org.apache.sis.setup.OptionKey; import org.apache.sis.storage.Resource; import org.apache.sis.storage.Aggregate; -import org.apache.sis.storage.DataOptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStores; import org.apache.sis.storage.DataStoreProvider; @@ -315,7 +314,7 @@ class Store extends DataStore implements StoreResource, UnstructuredAggregate, D * check if we can open it as a child folder store before to skip it. */ final StorageConnector connector = new StorageConnector(configuration, candidate); - connector.setOption(DataOptionKey.PARENT_LISTENERS, listeners); + connector.setOption(OptionKey.PARENT_LISTENERS, listeners); connector.setOption(OptionKey.OPEN_OPTIONS, new StandardOpenOption[] { StandardOpenOption.READ // Restrict to read-only mode. }); diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/StoreProvider.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/StoreProvider.java index a5c95abfc3..bd40e74acf 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/StoreProvider.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/StoreProvider.java @@ -34,6 +34,7 @@ import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreProvider; import org.apache.sis.storage.DataStoreException; @@ -42,13 +43,12 @@ import org.apache.sis.storage.ProbeResult; import org.apache.sis.storage.Aggregate; import org.apache.sis.storage.FeatureSet; import org.apache.sis.storage.GridCoverageResource; -import org.apache.sis.util.logging.Logging; import org.apache.sis.storage.internal.Resources; import org.apache.sis.storage.base.URIDataStoreProvider; import org.apache.sis.storage.base.Capability; import org.apache.sis.storage.base.StoreMetadata; import org.apache.sis.storage.base.StoreUtilities; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.util.logging.Logging; /** diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/WritableStore.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/WritableStore.java index bc55ac81cc..3c9cff1d44 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/WritableStore.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/folder/WritableStore.java @@ -25,7 +25,7 @@ import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardOpenOption; import java.nio.file.attribute.BasicFileAttributes; import org.opengis.util.GenericName; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Resource; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreProvider; diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WorldFileStore.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WorldFileStore.java index fd8a720a8d..460d453299 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WorldFileStore.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WorldFileStore.java @@ -42,6 +42,7 @@ import org.apache.sis.coverage.grid.PixelInCell; import org.apache.sis.coverage.grid.GridExtent; import org.apache.sis.coverage.grid.GridGeometry; import org.apache.sis.io.stream.IOUtilities; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Resource; import org.apache.sis.storage.Aggregate; import org.apache.sis.storage.StorageConnector; @@ -61,7 +62,6 @@ import org.apache.sis.util.ArraysExt; import org.apache.sis.util.collection.ListOfUnknownSize; import org.apache.sis.util.collection.BackingStoreException; import org.apache.sis.util.resources.Errors; -import org.apache.sis.setup.OptionKey; /** diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WritableStore.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WritableStore.java index 43555d3137..28a3cffd58 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WritableStore.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WritableStore.java @@ -33,6 +33,7 @@ import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageOutputStream; import org.apache.sis.coverage.grid.GridCoverage; import org.apache.sis.coverage.grid.GridGeometry; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Resource; import org.apache.sis.storage.GridCoverageResource; import org.apache.sis.storage.WritableAggregate; @@ -44,7 +45,6 @@ import org.apache.sis.storage.IncompatibleResourceException; import org.apache.sis.storage.internal.Resources; import org.apache.sis.referencing.operation.matrix.AffineTransforms2D; import org.apache.sis.util.ComparisonMode; -import org.apache.sis.setup.OptionKey; /** diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/modifier/CoverageModifier.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/modifier/CoverageModifier.java index 2ed69e6ee8..e0dfe7bf35 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/modifier/CoverageModifier.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/modifier/CoverageModifier.java @@ -22,7 +22,7 @@ import java.util.OptionalInt; import org.opengis.metadata.Metadata; import org.opengis.util.GenericName; import org.apache.sis.image.DataType; -import org.apache.sis.storage.DataOptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; @@ -46,7 +46,7 @@ import org.apache.sis.util.internal.shared.Strings; * {@snippet lang="java" : * StorageConnector storage = ...; * CoverageModifier modifier = ...; - * storage.setOption(DataOptionKey.COVERAGE_MODIFIER, modifier); + * storage.setOption(OptionKey.COVERAGE_MODIFIER, modifier); * try (DataStore store = DataStores.open(connector)) { * // Modified resources will be returned. * } @@ -60,21 +60,21 @@ import org.apache.sis.util.internal.shared.Strings; * @author Martin Desruisseaux (Geomatys) * @version 1.5 * - * @see DataOptionKey#COVERAGE_MODIFIER + * @see OptionKey#COVERAGE_MODIFIER * * @since 1.5 */ public interface CoverageModifier { /** * Returns modifier specified in the options of the given storage connector. - * This convenience method fetches the value associated to {@link DataOptionKey#COVERAGE_MODIFIER}. + * This convenience method fetches the value associated to {@link OptionKey#COVERAGE_MODIFIER}. * If there is no such value, then this method returns the {@link #DEFAULT} instance. * * @param connector the storage connector from which to get the modifier. * @return the modifier to use, never {@code null}. */ public static CoverageModifier getOrDefault(StorageConnector connector) { - final CoverageModifier customizer = connector.getOption(DataOptionKey.COVERAGE_MODIFIER); + final CoverageModifier customizer = connector.getOption(OptionKey.COVERAGE_MODIFIER); return (customizer != null) ? customizer : Source.DEFAULT; } diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/wkt/Store.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/wkt/Store.java index ef03961fef..75054c0733 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/wkt/Store.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/wkt/Store.java @@ -26,6 +26,7 @@ import java.text.ParseException; import org.opengis.metadata.Metadata; import org.opengis.util.InternationalString; import org.opengis.referencing.ReferenceSystem; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.DataStoreContentException; @@ -34,7 +35,6 @@ import org.apache.sis.storage.base.MetadataBuilder; import org.apache.sis.storage.base.URIDataStore; import org.apache.sis.referencing.IdentifiedObjects; import org.apache.sis.setup.GeometryLibrary; -import org.apache.sis.setup.OptionKey; import org.apache.sis.util.CharSequences; diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/xml/Store.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/xml/Store.java index 79bf2ba56f..c96ba1d07a 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/xml/Store.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/xml/Store.java @@ -32,6 +32,7 @@ import org.opengis.referencing.ReferenceSystem; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.xml.XML; import org.apache.sis.xml.internal.shared.URISource; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.UnsupportedStorageException; @@ -42,7 +43,6 @@ import org.apache.sis.metadata.iso.DefaultMetadata; import org.apache.sis.util.resources.Errors; import org.apache.sis.system.Loggers; import org.apache.sis.referencing.internal.shared.DefinitionVerifier; -import org.apache.sis.setup.OptionKey; /** diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/DataOptionKeyTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/DataOptionKeyTest.java deleted file mode 100644 index 67311e7812..0000000000 --- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/DataOptionKeyTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.storage; - -// Test dependencies -import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; -import org.apache.sis.test.TestCase; -import static org.apache.sis.test.Assertions.assertSerializedEquals; - - -/** - * Tests {@link DataOptionKey}. - * - * @author Martin Desruisseaux (Geomatys) - */ -public final class DataOptionKeyTest extends TestCase { - /** - * Creates a new test case. - */ - public DataOptionKeyTest() { - } - - /** - * Tests the serialization of constants. - * Those constants shall be resolved to their singleton instance on deserialization. - */ - @Test - public void testSerialization() { - assertSame(DataOptionKey.METADATA_PATH, assertSerializedEquals(DataOptionKey.METADATA_PATH)); - } -} diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/setup/OptionKeyTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/OptionKeyTest.java similarity index 79% rename from endorsed/src/org.apache.sis.util/test/org/apache/sis/setup/OptionKeyTest.java rename to endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/OptionKeyTest.java index cb5205fcf8..8147092940 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/setup/OptionKeyTest.java +++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/OptionKeyTest.java @@ -14,9 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.setup; +package org.apache.sis.storage; import java.util.Map; +import org.apache.sis.setup.OptionKey; import org.apache.sis.util.collection.CheckedContainer; import static org.apache.sis.setup.OptionKey.*; @@ -75,7 +76,7 @@ public final class OptionKeyTest extends TestCase { */ @Test public void testSetAndGet() { - final Map<OptionKey<?>,Object> options = URL_ENCODING.setValueInto(null, "UTF-8"); + final Map<OptionKey<?>, Object> options = URL_ENCODING.setValueInto(null, "UTF-8"); assertEquals("UTF-8", assertSingleton(options.values())); assertEquals("UTF-8", URL_ENCODING.getValueFrom(options)); @@ -100,7 +101,23 @@ public final class OptionKeyTest extends TestCase { */ @Test public void testSubclassSerialization() { - final CustomKey<Integer> key = new CustomKey<>("key", Integer.class); + final var key = new CustomKey<Integer>("key", Integer.class); assertNotSame(key, assertSerializedEquals(key)); } + + /** + * Temporary test for migration. + * + * @see <a href="https://issues.apache.org/jira/browse/SIS-633">SIS-633</a> + */ + @Test + public void testCompatibility() { + assertSame(org.apache.sis.storage.OptionKey.LOCALE, LOCALE); + assertSame(org.apache.sis.storage.OptionKey.TIMEZONE, TIMEZONE); + assertSame(org.apache.sis.storage.OptionKey.ENCODING, ENCODING); + assertSame(org.apache.sis.storage.OptionKey.URL_ENCODING, URL_ENCODING); + assertSame(org.apache.sis.storage.OptionKey.OPEN_OPTIONS, OPEN_OPTIONS); + assertSame(org.apache.sis.storage.OptionKey.DEFAULT_CRS, DEFAULT_CRS); + assertSame(org.apache.sis.storage.OptionKey.INDENTATION, INDENTATION); + } } diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/StorageConnectorTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/StorageConnectorTest.java index 6ac3d527e5..7db0961468 100644 --- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/StorageConnectorTest.java +++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/StorageConnectorTest.java @@ -29,7 +29,6 @@ import java.nio.channels.ReadableByteChannel; import javax.imageio.ImageIO; import javax.imageio.stream.ImageInputStream; import java.sql.Connection; -import org.apache.sis.setup.OptionKey; import org.apache.sis.util.UnconvertibleObjectException; import org.apache.sis.io.stream.ChannelDataInput; import org.apache.sis.io.stream.ChannelImageInputStream; diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/csv/StoreProviderTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/csv/StoreProviderTest.java index 86fea28ed6..3c1d14579a 100644 --- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/csv/StoreProviderTest.java +++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/csv/StoreProviderTest.java @@ -16,11 +16,11 @@ */ package org.apache.sis.storage.csv; -import org.apache.sis.setup.OptionKey; import org.apache.sis.setup.GeometryLibrary; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.ProbeResult; +import org.apache.sis.storage.OptionKey; // Test dependencies import org.junit.jupiter.api.Test; diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/csv/StoreTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/csv/StoreTest.java index b2493af31a..7520a27c08 100644 --- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/csv/StoreTest.java +++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/csv/StoreTest.java @@ -28,8 +28,7 @@ import org.opengis.metadata.extent.GeographicBoundingBox; import org.apache.sis.feature.FoliationRepresentation; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; -import org.apache.sis.storage.DataOptionKey; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.setup.GeometryLibrary; // Test dependencies @@ -91,7 +90,7 @@ public final class StoreTest extends TestCase { private static Store open(final boolean fragmented) throws DataStoreException { final var connector = new StorageConnector(testData()); if (fragmented) { - connector.setOption(DataOptionKey.FOLIATION_REPRESENTATION, FoliationRepresentation.FRAGMENTED); + connector.setOption(OptionKey.FOLIATION_REPRESENTATION, FoliationRepresentation.FRAGMENTED); } connector.setOption(OptionKey.GEOMETRY_LIBRARY, GeometryLibrary.ESRI); return new Store(null, connector); diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/WritableStoreTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/WritableStoreTest.java index cbbbf4151e..6ebb96df3f 100644 --- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/WritableStoreTest.java +++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/esri/WritableStoreTest.java @@ -27,11 +27,11 @@ import java.awt.image.DataBufferByte; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.coverage.grid.GridCoverageBuilder; import org.apache.sis.coverage.grid.GridCoverage; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.ResourceAlreadyExistsException; import org.apache.sis.geometry.Envelope2D; -import org.apache.sis.setup.OptionKey; import org.apache.sis.util.CharSequences; // Test dependencies diff --git a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/image/WorldFileStoreTest.java b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/image/WorldFileStoreTest.java index fa78396518..f6d4aa4fdc 100644 --- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/image/WorldFileStoreTest.java +++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/image/WorldFileStoreTest.java @@ -28,7 +28,7 @@ import org.apache.sis.storage.GridCoverageResource; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.ProbeResult; import org.apache.sis.storage.ResourceAlreadyExistsException; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.util.ArraysExt; // Test dependencies diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/GeometryLibrary.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/GeometryLibrary.java index fa7cdcdaf3..3813381497 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/GeometryLibrary.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/GeometryLibrary.java @@ -31,7 +31,7 @@ import org.apache.sis.util.internal.shared.Constants; * @author Martin Desruisseaux (Geomatys) * @version 1.5 * - * @see OptionKey#GEOMETRY_LIBRARY + * @see org.apache.sis.storage.OptionKey#GEOMETRY_LIBRARY * @see org.apache.sis.feature.builder.FeatureTypeBuilder#addAttribute(GeometryType) * * @since 0.8 diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/OptionKey.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/OptionKey.java index 509985913f..b8f8174467 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/OptionKey.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/OptionKey.java @@ -21,7 +21,6 @@ import java.util.HashMap; import java.util.Locale; import java.util.Objects; import java.time.ZoneId; -import java.nio.ByteBuffer; import java.io.Serializable; import java.io.ObjectStreamException; import java.nio.charset.Charset; @@ -63,12 +62,15 @@ import org.apache.sis.system.Modules; * } * * @author Martin Desruisseaux (Geomatys) - * @version 1.5 + * @version 1.7 * * @param <T> the type of option values. * * @since 0.3 + * + * @deprecated Moved to the {@link org.apache.sis.storage} because these options appear to be used only by data stores. */ +@Deprecated(since = "1.7", forRemoval = true) public class OptionKey<T> implements Serializable { /** * For cross-version compatibility. @@ -88,7 +90,7 @@ public class OptionKey<T> implements Serializable { * * @since 0.8 */ - public static final OptionKey<Locale> LOCALE = new OptionKey<>("LOCALE", Locale.class); + public static OptionKey<Locale> LOCALE = new OptionKey<>("LOCALE", Locale.class); /** * The timezone to use when parsing or formatting dates and times without explicit timezone. @@ -99,7 +101,7 @@ public class OptionKey<T> implements Serializable { * * @since 0.8 */ - public static final OptionKey<ZoneId> TIMEZONE = new OptionKey<>("TIMEZONE", ZoneId.class); + public static OptionKey<ZoneId> TIMEZONE = new OptionKey<>("TIMEZONE", ZoneId.class); /** * The character encoding of document content. @@ -114,7 +116,7 @@ public class OptionKey<T> implements Serializable { * * @since 0.4 */ - public static final OptionKey<Charset> ENCODING = new OptionKey<>("ENCODING", Charset.class); + public static OptionKey<Charset> ENCODING = new OptionKey<>("ENCODING", Charset.class); /** * The encoding of a URL (<strong>not</strong> the encoding of the document content). @@ -146,7 +148,7 @@ public class OptionKey<T> implements Serializable { * * @see java.net.URLDecoder */ - public static final OptionKey<String> URL_ENCODING = new OptionKey<>("URL_ENCODING", String.class); + public static OptionKey<String> URL_ENCODING = new OptionKey<>("URL_ENCODING", String.class); /** * Whether a storage object shall be opened in read, write, append or other modes. @@ -161,27 +163,7 @@ public class OptionKey<T> implements Serializable { * <tr><td>{@link StandardOpenOption#CREATE}</td> <td>Creates a new storage object (file or database) if it does not exist.</td></tr> * </table> */ - public static final OptionKey<OpenOption[]> OPEN_OPTIONS = new OptionKey<>("OPEN_OPTIONS", OpenOption[].class); - - /** - * The byte buffer to use for input/output operations. Some {@link org.apache.sis.storage.DataStore} - * implementations allow a byte buffer to be specified, thus allowing users to choose the buffer - * {@linkplain ByteBuffer#capacity() capacity}, whether the buffer {@linkplain ByteBuffer#isDirect() - * is direct}, or to recycle existing buffers. - * - * <p>It is user's responsibility to ensure that:</p> - * <ul> - * <li>The buffer does not contains any valuable data, as it will be {@linkplain ByteBuffer#clear() cleared}.</li> - * <li>The same buffer is not used concurrently by two different {@code DataStore} instances.</li> - * </ul> - * - * @deprecated This option forces unconditional allocation of byte buffer, even if the data store does not use it. - * It should be replaced by a {@link java.util.function.Supplier} or {@link java.util.function.Function}, but the - * exact form has not been determined yet. - */ - @Deprecated(since="1.5") - // TODO: provide replacement in DataOptionKey, because this option is specific to data stores. - public static final OptionKey<ByteBuffer> BYTE_BUFFER = new OptionKey<>("BYTE_BUFFER", ByteBuffer.class); + public static OptionKey<OpenOption[]> OPEN_OPTIONS = new OptionKey<>("OPEN_OPTIONS", OpenOption[].class); /** * The coordinate reference system (CRS) of data to use if not explicitly defined. @@ -191,7 +173,7 @@ public class OptionKey<T> implements Serializable { * * @since 1.5 */ - public static final OptionKey<CoordinateReferenceSystem> DEFAULT_CRS = + public static OptionKey<CoordinateReferenceSystem> DEFAULT_CRS = new OptionKey<>("DEFAULT_CRS", CoordinateReferenceSystem.class); /** @@ -202,7 +184,7 @@ public class OptionKey<T> implements Serializable { * * @since 0.8 */ - public static final OptionKey<GeometryLibrary> GEOMETRY_LIBRARY = new OptionKey<>("GEOMETRY_LIBRARY", GeometryLibrary.class); + public static OptionKey<GeometryLibrary> GEOMETRY_LIBRARY = new OptionKey<>("GEOMETRY_LIBRARY", GeometryLibrary.class); /** * The number of spaces to use for indentation when formatting text files in WKT or XML formats. @@ -218,7 +200,7 @@ public class OptionKey<T> implements Serializable { * * @since 0.8 */ - public static final OptionKey<Integer> INDENTATION = new OptionKey<>("INDENTATION", Integer.class); + public static OptionKey<Integer> INDENTATION = new OptionKey<>("INDENTATION", Integer.class); /* * Note: we do not provide a LINE_SEPARATOR option for now because we cannot control the line separator @@ -278,7 +260,7 @@ public class OptionKey<T> implements Serializable { * @param options the map where to search for the value, or {@code null} if not yet created. * @return the current value in the map for the this option, or {@code null} if none. */ - public T getValueFrom(final Map<OptionKey<?>,?> options) { + public T getValueFrom(final Map<? extends OptionKey<?>, ?> options) { return (options != null) ? type.cast(options.get(this)) : null; } @@ -297,7 +279,7 @@ public class OptionKey<T> implements Serializable { * @return the given map of options, or a new map if the given map was null. The returned value * may be null if the given map and the given value are both null. */ - public Map<OptionKey<?>,Object> setValueInto(Map<OptionKey<?>,Object> options, final T value) { + public Map<OptionKey<?>, Object> setValueInto(Map<OptionKey<?>, Object> options, final T value) { if (value != null) { if (options == null) { options = new HashMap<>(); diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/package-info.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/package-info.java index 765bdd50e8..c595795802 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/package-info.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/package-info.java @@ -18,12 +18,9 @@ /** * Provides information and some controls about Apache <abbr>SIS</abbr> configuration. * System-wide information are provided by the {@link org.apache.sis.setup.About} class. - * Some controls, for example on the {@linkplain org.apache.sis.setup.GeometryLibrary geometry library} to use, - * is provided by a set of {@linkplain org.apache.sis.setup.OptionKey options} which can be used when a data store - * is created. * * @author Martin Desruisseaux (Geomatys) - * @version 1.5 + * @version 1.7 * @since 0.3 */ package org.apache.sis.setup; diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/Constants.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/Constants.java index 5013a322b5..ff5eef6e7f 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/Constants.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/shared/Constants.java @@ -43,7 +43,7 @@ public final class Constants { * The default indentation value to use in various text formats (both WKT and XML). * We use a small value (2 instead of 4) because OGC's XML are very verbose. * - * @see org.apache.sis.setup.OptionKey#INDENTATION + * @see org.apache.sis.storage.OptionKey#INDENTATION */ public static final byte DEFAULT_INDENTATION = 2; diff --git a/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/GpkgStoreProvider.java b/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/GpkgStoreProvider.java index 1fd3503b28..1217edb8e8 100644 --- a/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/GpkgStoreProvider.java +++ b/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/GpkgStoreProvider.java @@ -32,6 +32,7 @@ import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.parameter.ParameterValueGroup; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Aggregate; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreException; @@ -48,7 +49,6 @@ import org.apache.sis.metadata.sql.internal.shared.Reflection; import org.apache.sis.io.stream.InternalOptionKey; import org.apache.sis.util.CharSequences; import org.apache.sis.util.Version; -import org.apache.sis.setup.OptionKey; /** diff --git a/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/Initializer.java b/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/Initializer.java index 0cff27caa5..8fc16d3d01 100644 --- a/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/Initializer.java +++ b/incubator/src/org.apache.sis.storage.geopackage/main/org/apache/sis/storage/geopackage/Initializer.java @@ -30,7 +30,7 @@ import org.sqlite.SQLiteConfig; import org.sqlite.SQLiteDataSource; import org.apache.sis.io.stream.InternalOptionKey; import org.apache.sis.io.stream.IOUtilities; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; import org.apache.sis.util.ArraysExt; diff --git a/incubator/src/org.apache.sis.storage.geopackage/test/org/apache/sis/storage/geopackage/GpkgStoreTest.java b/incubator/src/org.apache.sis.storage.geopackage/test/org/apache/sis/storage/geopackage/GpkgStoreTest.java index 6a8cceb6c9..05bf9e425d 100644 --- a/incubator/src/org.apache.sis.storage.geopackage/test/org/apache/sis/storage/geopackage/GpkgStoreTest.java +++ b/incubator/src/org.apache.sis.storage.geopackage/test/org/apache/sis/storage/geopackage/GpkgStoreTest.java @@ -32,7 +32,7 @@ import java.util.stream.Stream; import org.apache.sis.geometry.wrapper.Geometries; import org.apache.sis.geometry.wrapper.GeometryWrapper; import org.apache.sis.referencing.IdentifiedObjects; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.DataStores; diff --git a/incubator/src/org.apache.sis.storage.geopackage/test/org/apache/sis/storage/geopackage/conformance/CoreConformanceTest.java b/incubator/src/org.apache.sis.storage.geopackage/test/org/apache/sis/storage/geopackage/conformance/CoreConformanceTest.java index fb554870ea..6c62abcd21 100644 --- a/incubator/src/org.apache.sis.storage.geopackage/test/org/apache/sis/storage/geopackage/conformance/CoreConformanceTest.java +++ b/incubator/src/org.apache.sis.storage.geopackage/test/org/apache/sis/storage/geopackage/conformance/CoreConformanceTest.java @@ -26,7 +26,7 @@ import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.geopackage.GpkgStore; diff --git a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java index cee805ad31..cec90869c2 100644 --- a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java +++ b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java @@ -88,7 +88,7 @@ import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.CRS; import org.apache.sis.referencing.CommonCRS; import org.apache.sis.referencing.IdentifiedObjects; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.AbstractFeatureSet; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreException; diff --git a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/dbf/DBFIOTest.java b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/dbf/DBFIOTest.java index c8d40ba919..cf258ab64a 100644 --- a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/dbf/DBFIOTest.java +++ b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/dbf/DBFIOTest.java @@ -28,7 +28,7 @@ import java.nio.file.StandardOpenOption; import java.time.LocalDate; import org.apache.sis.io.stream.ChannelDataInput; import org.apache.sis.io.stream.ChannelDataOutput; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; diff --git a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/dbf/Snippets.java b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/dbf/Snippets.java index 9f8a856427..7fb660677e 100644 --- a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/dbf/Snippets.java +++ b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/dbf/Snippets.java @@ -25,7 +25,7 @@ import java.nio.file.StandardOpenOption; import java.time.LocalDate; import org.apache.sis.io.stream.ChannelDataInput; import org.apache.sis.io.stream.ChannelDataOutput; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; diff --git a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/shp/ShapeIOTest.java b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/shp/ShapeIOTest.java index 988a76927b..f931979767 100644 --- a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/shp/ShapeIOTest.java +++ b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/shp/ShapeIOTest.java @@ -27,9 +27,9 @@ import org.locationtech.jts.geom.Point; import org.locationtech.jts.geom.MultiPoint; import org.locationtech.jts.geom.MultiPolygon; import org.locationtech.jts.geom.Polygon; -import org.apache.sis.setup.OptionKey; import org.apache.sis.io.stream.ChannelDataInput; import org.apache.sis.io.stream.ChannelDataOutput; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.StorageConnector; import org.apache.sis.storage.DataStoreException; import org.apache.sis.geometry.Envelope2D; diff --git a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/shp/Snippets.java b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/shp/Snippets.java index cfaaa30550..5761e32e0e 100644 --- a/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/shp/Snippets.java +++ b/incubator/src/org.apache.sis.storage.shapefile/test/org/apache/sis/storage/shapefile/shp/Snippets.java @@ -24,7 +24,7 @@ import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.GeometryFactory; import org.apache.sis.io.stream.ChannelDataInput; import org.apache.sis.io.stream.ChannelDataOutput; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.StorageConnector; diff --git a/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java index c5b5cdda7c..db6bb21603 100644 --- a/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java +++ b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java @@ -39,7 +39,7 @@ import org.apache.sis.io.wkt.Convention; import org.apache.sis.io.stream.IOUtilities; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.setup.GeometryLibrary; -import org.apache.sis.setup.OptionKey; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.AbstractResource; import org.apache.sis.storage.Resource; import org.apache.sis.storage.Aggregate; diff --git a/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStoreProvider.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStoreProvider.java index cb7d8d6882..e1d83b43ec 100644 --- a/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStoreProvider.java +++ b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStoreProvider.java @@ -26,6 +26,7 @@ import java.nio.file.Path; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.parameter.ParameterValueGroup; +import org.apache.sis.storage.OptionKey; import org.apache.sis.storage.Aggregate; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStoreException; @@ -41,7 +42,6 @@ import org.apache.sis.storage.panama.Resources; import org.apache.sis.io.stream.InternalOptionKey; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; -import org.apache.sis.setup.OptionKey; import org.apache.sis.util.Version; import org.apache.sis.util.internal.shared.Constants; import org.apache.sis.util.collection.TreeTable;
