You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2024/10/01 15:52:26 UTC

(sis) branch geoapi-4.0 updated (5364df70d4 -> 27465f381e)

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


    from 5364df70d4 Handle more divers structures in GIMI files
     new 363f81c359 Document the limitations of the current GDAL modules. Tune the exception to throw when GDAL is not available.
     new 23f06c63c3 Make the GSF module independent of the GDAL module. It forces us to copy the `org.apache.sis.storage.panama` package, because we do not yet have a location for it that modules could share. However, we copy only a simplified version of that package in GSF for now.
     new 27465f381e Move the GDAL module from "incubator" to "optional". The use of `optional` is temporary since the GDAL license is not a problem. This is because the module depends on Java 22, while the core library depends on Java 11.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 incubator/build.gradle.kts                         |  17 +--
 .../main/module-info.java                          |   3 -
 .../main/org/apache/sis/storage/gsf/GSF.java       |  34 +++---
 .../apache/sis/storage/gsf/GSFStoreProvider.java   |   6 +-
 .../sis/storage/gsf/panama/LibraryLoader.java      | 125 +++++++++++++++++++++
 .../sis/storage/gsf/panama/LibraryStatus.java      |  25 +++--
 .../sis/storage/gsf/panama/NativeFunctions.java    |  84 ++++++++++++++
 .../sis/storage/gsf/panama}/package-info.java      |  12 +-
 optional/README.md                                 |   3 +
 optional/build.gradle.kts                          |  19 +++-
 optional/src/org.apache.sis.gui/bundle/README      |   5 +-
 .../org.apache.sis.storage.DataStoreProvider       |   0
 .../main/module-info.java                          |   3 -
 .../main/org/apache/sis/storage/gdal/Band.java     |   0
 .../sis/storage/gdal/ColorInterpretation.java      |   0
 .../main/org/apache/sis/storage/gdal/DataType.java |   0
 .../main/org/apache/sis/storage/gdal/Driver.java   |   0
 .../org/apache/sis/storage/gdal/ErrorHandler.java  |   0
 .../main/org/apache/sis/storage/gdal/GDAL.java     |   0
 .../org/apache/sis/storage/gdal/GDALStore.java     |   0
 .../apache/sis/storage/gdal/GDALStoreProvider.java |   0
 .../main/org/apache/sis/storage/gdal/OpenFlag.java |   0
 .../main/org/apache/sis/storage/gdal/Opener.java   |   0
 .../org/apache/sis/storage/gdal/SpatialRef.java    |   0
 .../org/apache/sis/storage/gdal/Subdataset.java    |   0
 .../apache/sis/storage/gdal/SubdatasetList.java    |   0
 .../org/apache/sis/storage/gdal/TiledCoverage.java |   0
 .../org/apache/sis/storage/gdal/TiledResource.java |   0
 .../org/apache/sis/storage/gdal/package-info.java  |   7 +-
 .../apache/sis/storage/panama/LibraryLoader.java   |   0
 .../apache/sis/storage/panama/LibraryStatus.java   |  13 ++-
 .../apache/sis/storage/panama/NativeFunctions.java |   0
 .../org/apache/sis/storage/panama/Resources.java   |   0
 .../apache/sis/storage/panama/Resources.properties |   0
 .../apache/sis/storage/panama/Resources_en.java    |   0
 .../apache/sis/storage/panama/Resources_fr.java    |   0
 .../sis/storage/panama/Resources_fr.properties     |   0
 .../apache/sis/storage/panama/package-info.java    |   0
 .../org/apache/sis/storage/gdal/GDALStoreTest.java |   0
 .../test/org/apache/sis/storage/gdal/test.tiff     | Bin
 40 files changed, 289 insertions(+), 67 deletions(-)
 create mode 100644 incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/LibraryLoader.java
 copy optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/TreeViewType.java => incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/LibraryStatus.java (59%)
 create mode 100644 incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/NativeFunctions.java
 copy {buildSrc/src/main/java/org/apache/sis/buildtools/doclet => incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama}/package-info.java (61%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/META-INF.services/org.apache.sis.storage.DataStoreProvider (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/module-info.java (95%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Band.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ColorInterpretation.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/DataType.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Driver.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ErrorHandler.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDAL.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStoreProvider.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/OpenFlag.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Opener.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SpatialRef.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Subdataset.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SubdatasetList.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledCoverage.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledResource.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java (85%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryLoader.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java (85%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/NativeFunctions.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.properties (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_en.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.properties (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/package-info.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/GDALStoreTest.java (100%)
 rename {incubator => optional}/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/test.tiff (100%)


(sis) 02/03: Make the GSF module independent of the GDAL module. It forces us to copy the `org.apache.sis.storage.panama` package, because we do not yet have a location for it that modules could share. However, we copy only a simplified version of that package in GSF for now.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 23f06c63c307da91a3f87fd2d40986c30d327f7b
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Oct 1 13:02:30 2024 +0200

    Make the GSF module independent of the GDAL module.
    It forces us to copy the `org.apache.sis.storage.panama` package,
    because we do not yet have a location for it that modules could share.
    However, we copy only a simplified version of that package in GSF for now.
---
 .../main/module-info.java                          |   3 -
 .../main/module-info.java                          |   3 -
 .../main/org/apache/sis/storage/gsf/GSF.java       |  34 +++---
 .../apache/sis/storage/gsf/GSFStoreProvider.java   |   6 +-
 .../sis/storage/gsf/panama/LibraryLoader.java      | 125 +++++++++++++++++++++
 .../sis/storage/gsf/panama/LibraryStatus.java}     |  29 +++--
 .../sis/storage/gsf/panama/NativeFunctions.java    |  84 ++++++++++++++
 .../sis/storage/gsf/panama/package-info.java}      |  20 +---
 8 files changed, 254 insertions(+), 50 deletions(-)

diff --git a/incubator/src/org.apache.sis.storage.gdal/main/module-info.java b/incubator/src/org.apache.sis.storage.gdal/main/module-info.java
index f191af4435..e4d87b9584 100644
--- a/incubator/src/org.apache.sis.storage.gdal/main/module-info.java
+++ b/incubator/src/org.apache.sis.storage.gdal/main/module-info.java
@@ -54,9 +54,6 @@ module org.apache.sis.storage.gdal {
 
     exports org.apache.sis.storage.gdal;
 
-    exports org.apache.sis.storage.panama to
-            org.apache.sis.storage.gsf;                 // In the "incubator" sub-project.
-
     provides org.apache.sis.storage.DataStoreProvider
             with org.apache.sis.storage.gdal.GDALStoreProvider;
 }
diff --git a/incubator/src/org.apache.sis.storage.gsf/main/module-info.java b/incubator/src/org.apache.sis.storage.gsf/main/module-info.java
index d006a4f811..143d3bc638 100644
--- a/incubator/src/org.apache.sis.storage.gsf/main/module-info.java
+++ b/incubator/src/org.apache.sis.storage.gsf/main/module-info.java
@@ -25,9 +25,6 @@ module org.apache.sis.storage.gsf {
     requires transitive org.apache.sis.referencing;
     requires transitive org.apache.sis.storage;
 
-    // For internal usage only.
-    requires org.apache.sis.storage.gdal;
-
     provides org.apache.sis.storage.DataStoreProvider
             with org.apache.sis.storage.gsf.GSFStoreProvider;
 }
diff --git a/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/GSF.java b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/GSF.java
index 1a00375184..e08338175f 100644
--- a/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/GSF.java
+++ b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/GSF.java
@@ -17,7 +17,6 @@
 package org.apache.sis.storage.gsf;
 
 import java.lang.foreign.AddressLayout;
-import java.lang.foreign.Arena;
 import java.lang.foreign.FunctionDescriptor;
 import java.lang.foreign.MemoryLayout;
 import java.lang.foreign.MemorySegment;
@@ -30,9 +29,9 @@ import java.util.Optional;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
 import org.apache.sis.storage.DataStoreException;
-import org.apache.sis.storage.panama.LibraryLoader;
-import org.apache.sis.storage.panama.LibraryStatus;
-import org.apache.sis.storage.panama.NativeFunctions;
+import org.apache.sis.storage.gsf.panama.LibraryLoader;
+import org.apache.sis.storage.gsf.panama.LibraryStatus;
+import org.apache.sis.storage.gsf.panama.NativeFunctions;
 import org.apache.sis.util.logging.Logging;
 
 /**
@@ -680,11 +679,13 @@ public class GSF extends NativeFunctions {
 
     /**
      * Creates the handles for all <abbr>GSF</abbr> functions which will be needed.
+     * This constructor is public for {@link LibraryLoader} purpose only.
+     * <strong>Do not use.</strong>
      *
      * @param  loader  the object used for loading the library.
      * @throws NoSuchElementException if a <abbr>GSF</abbr> function has not been found in the library.
      */
-    private GSF(final LibraryLoader<GSF> loader) {
+    public GSF(final LibraryLoader loader) {
         super(loader);
 
         final FunctionDescriptor p = FunctionDescriptor.of(GSF.C_POINTER);
@@ -729,10 +730,6 @@ public class GSF extends NativeFunctions {
         gsfGetPositionOffsets                   = lookup("gsfGetPositionOffsets",                   FunctionDescriptor.of(GSF.C_POINTER, Position.LAYOUT, Position.LAYOUT, GSF.C_DOUBLE, GSF.C_DOUBLE));
     }
 
-    public Arena getArena() {
-        return arena();
-    }
-
     public int open(MemorySegment filename, int mode, MemorySegment handle) throws Throwable {
         return (int) gsfOpen.invokeExact(filename, mode, handle);
     }
@@ -883,7 +880,7 @@ public class GSF extends NativeFunctions {
     /**
      * Raise an exception if code is an error code.
      */
-    public void catchError(int error) throws GSFException {
+    public static void catchError(int error) throws GSFException {
         if (error == 0) return;
         String message = ERRORCODES.get(error);
         if (message == null) message = "UNKNOWN ERROR CODE";
@@ -899,13 +896,13 @@ public class GSF extends NativeFunctions {
      *         In such case, the caller must be synchronized and {@link #global} must be initially null.
      * @return the library loader for <abbr>GSF</abbr>.
      */
-    private static LibraryLoader<GSF> load(final boolean now) {
-        final var loader = new LibraryLoader<>(GSF::new);
+    private static LibraryLoader load(final boolean now) {
+        final var loader = new LibraryLoader();
         if (now) {
             try {
-                global = loader.global("gsf");
+                global = loader.global();
             } finally {
-                globalStatus = loader.status();
+                globalStatus = loader.status;
             }
             if (global != null) {
                 if (GSFStoreProvider.LOGGER.isLoggable(Level.CONFIG)) {
@@ -945,9 +942,11 @@ public class GSF extends NativeFunctions {
      */
     static synchronized GSF global() throws DataStoreException {
         if (globalStatus == null) {
-            load(true).validate(GSFStoreProvider.NAME);
+            load(true).validate();
+        }
+        if (globalStatus != LibraryStatus.LOADED) {
+            throw new DataStoreException("GSF not loaded.");
         }
-        globalStatus.report(GSFStoreProvider.NAME, null);
         return global;
     }
 
@@ -959,7 +958,7 @@ public class GSF extends NativeFunctions {
      */
     static synchronized Optional<GSF> tryGlobal(final String caller) {
         if (globalStatus == null) {
-            load(true).getError(GSFStoreProvider.NAME).ifPresent((record) -> log(caller, record));
+            load(true).getError().ifPresent((record) -> log(caller, record));
         }
         return Optional.ofNullable(global);
     }
@@ -973,5 +972,4 @@ public class GSF extends NativeFunctions {
     private static void log(final String caller, final LogRecord record) {
         Logging.completeAndLog(GSFStoreProvider.LOGGER, GSFStoreProvider.class, caller, record);
     }
-
 }
diff --git a/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/GSFStoreProvider.java b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/GSFStoreProvider.java
index 4be4cdd695..f74d71e125 100644
--- a/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/GSFStoreProvider.java
+++ b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/GSFStoreProvider.java
@@ -29,7 +29,7 @@ import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.base.StoreMetadata;
 import org.apache.sis.storage.base.Capability;
 import org.apache.sis.storage.base.URIDataStoreProvider;
-import org.apache.sis.storage.panama.LibraryStatus;
+import org.apache.sis.storage.gsf.panama.LibraryStatus;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.parameter.Parameters;
 import org.apache.sis.system.Cleaners;
@@ -114,7 +114,9 @@ public class GSFStoreProvider extends DataStoreProvider {
         if (status == null) {
             return GSF.global();        // Fetch each time (no cache) because may have changed outside this class.
         }
-        status.report(NAME, null);      // Should never return if `nativeFunctions` is null.
+        if (status != LibraryStatus.LOADED) {
+            throw new DataStoreException("GSF not loaded.");
+        }
         return nativeFunctions;
     }
 
diff --git a/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/LibraryLoader.java b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/LibraryLoader.java
new file mode 100644
index 0000000000..b42ebfeaaa
--- /dev/null
+++ b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/LibraryLoader.java
@@ -0,0 +1,125 @@
+/*
+ * 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.gsf.panama;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.util.Optional;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.lang.foreign.Arena;
+import java.lang.foreign.SymbolLookup;
+import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.gsf.GSF;
+import org.apache.sis.system.Shutdown;
+import org.apache.sis.util.Exceptions;
+
+
+/**
+ * A helper class for loading a native library.
+ *
+ * @see org.apache.sis.storage.panama.LibraryLoader
+ */
+public final class LibraryLoader {
+    /**
+     * Value to assign to {@link NativeFunctions#arena}.
+     */
+    Arena arena;
+
+    /**
+     * Value to assign to {@link NativeFunctions#symbols}.
+     */
+    SymbolLookup symbols;
+
+    /**
+     * Whether the library has been found.
+     */
+    public LibraryStatus status;
+
+    /**
+     * Cause of failure to load the library, or {@code null} if none.
+     */
+    private RuntimeException error;
+
+    /**
+     * Creates a new instance.
+     */
+    public LibraryLoader() {
+    }
+
+    /**
+     * Loads the native library from the given file.
+     * Callers should register the returned instance in a {@link java.lang.ref.Cleaner}.
+     */
+    @SuppressWarnings("restricted")
+    public GSF load(final Path library) {
+        status = LibraryStatus.CANNOT_LOAD_LIBRARY;
+        arena  = Arena.ofShared();
+        final GSF instance;
+        try {
+            symbols  = SymbolLookup.libraryLookup(library, arena);
+            status   = LibraryStatus.FUNCTION_NOT_FOUND;
+            instance = new GSF(this);
+            status   = LibraryStatus.LOADED;
+        } catch (Throwable e) {
+            arena.close();
+            throw e;
+        }
+        return instance;
+    }
+
+    /**
+     * Searches the native library in the default library path.
+     */
+    @SuppressWarnings("restricted")
+    public GSF global() {
+        status = LibraryStatus.CANNOT_LOAD_LIBRARY;
+        String filename = (File.separatorChar == '\\') ? "gsf.dll" : "libgsf.so";
+        try {
+            symbols = SymbolLookup.libraryLookup(filename, Arena.global());
+            GSF instance = new GSF(this);
+            status = LibraryStatus.LOADED;
+            Shutdown.register(instance);
+            return instance;
+        } catch (RuntimeException e) {
+            error = e;
+            return null;
+        }
+    }
+
+    /**
+     * Throws an exception if the loading of the native library failed.
+     */
+    public void validate() throws DataStoreException {
+        if (error != null) {
+            throw new DataStoreException(error);
+        }
+    }
+
+    /**
+     * Returns the error as a log message.
+     */
+    public Optional<LogRecord> getError() {
+        if (error == null) {
+            return Optional.empty();
+        }
+        String msg = "Cannot initialize the GSF library.";
+        var record = new LogRecord(Level.CONFIG, Exceptions.formatChainedMessages(null, msg, error));
+        record.setThrown(error);
+        return Optional.of(record);
+    }
+}
diff --git a/incubator/src/org.apache.sis.storage.gsf/main/module-info.java b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/LibraryStatus.java
similarity index 56%
copy from incubator/src/org.apache.sis.storage.gsf/main/module-info.java
copy to incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/LibraryStatus.java
index d006a4f811..9b21d9afeb 100644
--- a/incubator/src/org.apache.sis.storage.gsf/main/module-info.java
+++ b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/LibraryStatus.java
@@ -14,20 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.sis.storage.gsf.panama;
+
 
 /**
- * LibGSF Panama binding.
+ * Status of the native library.
  *
- * @author Johann Sorel (Geomatys)
+ * @see org.apache.sis.storage.panama.LibraryStatus
  */
-module org.apache.sis.storage.gsf {
-    // Dependencies used in public API.
-    requires transitive org.apache.sis.referencing;
-    requires transitive org.apache.sis.storage;
+public enum LibraryStatus {
+    /**
+     * The native library is ready for use.
+     */
+    LOADED,
 
-    // For internal usage only.
-    requires org.apache.sis.storage.gdal;
+    /**
+     * The native library has not been found or cannot be loaded. Note: this is a merge of
+     * {@link org.apache.sis.storage.panama.LibraryStatus#LIBRARY_NOT_FOUND} and
+     * {@link org.apache.sis.storage.panama.LibraryStatus#UNAUTHORIZED}.
+     */
+    CANNOT_LOAD_LIBRARY,
 
-    provides org.apache.sis.storage.DataStoreProvider
-            with org.apache.sis.storage.gsf.GSFStoreProvider;
+    /**
+     * The native library was found, but not symbol that we searched.
+     */
+    FUNCTION_NOT_FOUND
 }
diff --git a/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/NativeFunctions.java b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/NativeFunctions.java
new file mode 100644
index 0000000000..41e107b886
--- /dev/null
+++ b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/NativeFunctions.java
@@ -0,0 +1,84 @@
+/*
+ * 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.gsf.panama;
+
+import java.util.concurrent.Callable;
+import java.lang.foreign.Arena;
+import java.lang.foreign.Linker;
+import java.lang.foreign.SymbolLookup;
+import java.lang.foreign.FunctionDescriptor;
+import java.lang.invoke.MethodHandle;
+
+
+/**
+ * Base class for sets of method handles to native functions.
+ *
+ * @see org.apache.sis.storage.panama.NativeFunctions
+ */
+public abstract class NativeFunctions implements Runnable, Callable<Object> {
+    /**
+     * The arena used for loading the library, or {@code null} for the global arena.
+     */
+    private final Arena arena;
+
+    /**
+     * The lookup for retrieving the address of a symbol in the native library.
+     */
+    public final SymbolLookup symbols;
+
+    /**
+     * The linker to use for fetching method handles from the {@linkplain #symbols}.
+     */
+    public final Linker linker;
+
+    /**
+     * Creates a new set of handles to native functions.
+     */
+    protected NativeFunctions(final LibraryLoader loader) {
+        arena   = loader.arena;
+        symbols = loader.symbols;
+        linker  = Linker.nativeLinker();
+    }
+
+    /**
+     * Returns the method handler for the <abbr>GSF</abbr> function of given name and signature.
+     */
+    @SuppressWarnings("restricted")
+    protected final MethodHandle lookup(final String function, final FunctionDescriptor signature) {
+        return symbols.find(function).map((method) -> linker.downcallHandle(method, signature)).orElseThrow();
+    }
+
+    /**
+     * Unloads the native library. If the arena is global,
+     * then this method should not be invoked before <abbr>JVM</abbr> shutdown.
+     */
+    @Override
+    public void run() {
+        if (arena != null) {
+            arena.close();
+        }
+    }
+
+    /**
+     * Synonymous of {@link #run()}, used in shutdown hook.
+     */
+    @Override
+    public final Object call() {
+        run();
+        return null;
+    }
+}
diff --git a/incubator/src/org.apache.sis.storage.gsf/main/module-info.java b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/package-info.java
similarity index 61%
copy from incubator/src/org.apache.sis.storage.gsf/main/module-info.java
copy to incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/package-info.java
index d006a4f811..ce1282d7de 100644
--- a/incubator/src/org.apache.sis.storage.gsf/main/module-info.java
+++ b/incubator/src/org.apache.sis.storage.gsf/main/org/apache/sis/storage/gsf/panama/package-info.java
@@ -16,18 +16,10 @@
  */
 
 /**
- * LibGSF Panama binding.
- *
- * @author Johann Sorel (Geomatys)
+ * Partial (simplified) copy of the {@code org.apache.sis.storage.panama} package.
+ * This copy is for keeping this <abbr>GSF</abbr> module independent from the <abbr>GDAL</abbr> module,
+ * because we do not yet have a location where to put the {@code org.apache.sis.storage.panama} package
+ * in a way where it can be reused by other modules. This package will be deleted in a future version
+ * if we find a home for the {@code org.apache.sis.storage.panama} package.
  */
-module org.apache.sis.storage.gsf {
-    // Dependencies used in public API.
-    requires transitive org.apache.sis.referencing;
-    requires transitive org.apache.sis.storage;
-
-    // For internal usage only.
-    requires org.apache.sis.storage.gdal;
-
-    provides org.apache.sis.storage.DataStoreProvider
-            with org.apache.sis.storage.gsf.GSFStoreProvider;
-}
+package org.apache.sis.storage.gsf.panama;


(sis) 01/03: Document the limitations of the current GDAL modules. Tune the exception to throw when GDAL is not available.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 363f81c359a82bef705f49ba0e4c18aedda47558
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Oct 1 13:01:17 2024 +0200

    Document the limitations of the current GDAL modules.
    Tune the exception to throw when GDAL is not available.
---
 .../main/org/apache/sis/storage/gdal/package-info.java      |  7 +++++--
 .../main/org/apache/sis/storage/panama/LibraryStatus.java   | 13 +++++++++----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java b/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java
index 8ad298dee7..97e15ce179 100644
--- a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java
+++ b/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java
@@ -30,8 +30,11 @@
  * If a different <abbr>GDAL</abbr> library is desired, it can be specified explicitly
  * to the {@link org.apache.sis.storage.gdal.GDALStoreProvider} constructor.</p>
  *
- * <p>The current implementation can read rasters.
- * Write operations and support of vector data will be provided in a future version.</p>
+ * <h2>Limitations</h2>
+ * The current implementation can only read two-dimensional rasters.
+ * It does not yet support vector data, cannot write any data,
+ * and does not yet use the multi-dimensional <abbr>API</abbr> of <abbr>GDAL</abbr>.
+ * Those operations will be added progressively in future versions of this module.
  *
  * @author  Quentin Bialota (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java b/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java
index 775089e1cf..57b4c0952a 100644
--- a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java
+++ b/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.storage.panama;
 
+import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreClosedException;
 
 
@@ -72,13 +73,17 @@ public enum LibraryStatus {
      *
      * @param  library  the library name, of formatting the error message.
      * @param  cause    the cause of the error, or {@code null} if none.
-     * @throws DataStoreClosedException if this enumeration value is not {@link #LOADED}
-     *         or if the given cause is not null.
+     * @throws DataStoreException if this enumeration value is not {@link #LOADED} or if the given cause is not null.
      */
-    public void report(String library, Exception cause) throws DataStoreClosedException {
+    public void report(String library, Exception cause) throws DataStoreException {
         if (message != 0 || cause != null) {
             // Note: `NativeAccessNotAllowed` will ignore the `library` argument.
-            throw new DataStoreClosedException(Resources.format(message, library), cause);
+            String text = Resources.format(message, library);
+            if (cause != null) {
+                throw new DataStoreException(text, cause);
+            } else {
+                throw new DataStoreClosedException(text);
+            }
         }
     }
 }


(sis) 03/03: Move the GDAL module from "incubator" to "optional". The use of `optional` is temporary since the GDAL license is not a problem. This is because the module depends on Java 22, while the core library depends on Java 11.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 27465f381eead2554a852a1fe6f03e267ae4f7a8
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Oct 1 16:53:13 2024 +0200

    Move the GDAL module from "incubator" to "optional".
    The use of `optional` is temporary since the GDAL license is not a problem.
    This is because the module depends on Java 22, while the core library depends on Java 11.
---
 incubator/build.gradle.kts                           |  17 ++---------------
 optional/README.md                                   |   3 +++
 optional/build.gradle.kts                            |  19 +++++++++++++++++--
 optional/src/org.apache.sis.gui/bundle/README        |   5 +++--
 .../org.apache.sis.storage.DataStoreProvider         |   0
 .../main/module-info.java                            |   0
 .../main/org/apache/sis/storage/gdal/Band.java       |   0
 .../apache/sis/storage/gdal/ColorInterpretation.java |   0
 .../main/org/apache/sis/storage/gdal/DataType.java   |   0
 .../main/org/apache/sis/storage/gdal/Driver.java     |   0
 .../org/apache/sis/storage/gdal/ErrorHandler.java    |   0
 .../main/org/apache/sis/storage/gdal/GDAL.java       |   0
 .../main/org/apache/sis/storage/gdal/GDALStore.java  |   0
 .../apache/sis/storage/gdal/GDALStoreProvider.java   |   0
 .../main/org/apache/sis/storage/gdal/OpenFlag.java   |   0
 .../main/org/apache/sis/storage/gdal/Opener.java     |   0
 .../main/org/apache/sis/storage/gdal/SpatialRef.java |   0
 .../main/org/apache/sis/storage/gdal/Subdataset.java |   0
 .../org/apache/sis/storage/gdal/SubdatasetList.java  |   0
 .../org/apache/sis/storage/gdal/TiledCoverage.java   |   0
 .../org/apache/sis/storage/gdal/TiledResource.java   |   0
 .../org/apache/sis/storage/gdal/package-info.java    |   0
 .../org/apache/sis/storage/panama/LibraryLoader.java |   0
 .../org/apache/sis/storage/panama/LibraryStatus.java |   0
 .../apache/sis/storage/panama/NativeFunctions.java   |   0
 .../org/apache/sis/storage/panama/Resources.java     |   0
 .../apache/sis/storage/panama/Resources.properties   |   0
 .../org/apache/sis/storage/panama/Resources_en.java  |   0
 .../org/apache/sis/storage/panama/Resources_fr.java  |   0
 .../sis/storage/panama/Resources_fr.properties       |   0
 .../org/apache/sis/storage/panama/package-info.java  |   0
 .../org/apache/sis/storage/gdal/GDALStoreTest.java   |   0
 .../test/org/apache/sis/storage/gdal/test.tiff       | Bin
 33 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/incubator/build.gradle.kts b/incubator/build.gradle.kts
index 6a4a938e89..85c219f390 100644
--- a/incubator/build.gradle.kts
+++ b/incubator/build.gradle.kts
@@ -85,7 +85,7 @@ tasks.compileJava {
 }
 tasks.compileTestJava {
     options.compilerArgs.add("-source")         // "source", not "release", because we accept any target version.
-    options.compilerArgs.add("16")              // For consistency with the value set in the `endorsed` modules.
+    options.compilerArgs.add("22")
     srcDir.list().forEach {
         addRead(options.compilerArgs, it, "org.apache.sis.test.incubator,org.junit.jupiter.api")
     }
@@ -140,7 +140,7 @@ fun addExportForTests(args : MutableList<String>) {
 tasks.test {
     val args = mutableListOf("-enableassertions")
     args.add("--enable-native-access")
-    args.add("org.apache.sis.storage.gdal")
+    args.add("org.apache.sis.storage.gsf")
     addExportForTests(args)
     addExport(args, "org.apache.sis.cql", "org.apache.sis.cql", "ALL-UNNAMED")
     setAllJvmArgs(args)
@@ -206,19 +206,6 @@ publishing {
                 description = "Read and write files in the GeoPackage format."
             }
         }
-        create<MavenPublication>("storage.gdal") {
-            var module = "org.apache.sis.storage.gdal"
-            groupId    = "org.apache.sis.storage"
-            artifactId = "sis-gdal"
-            artifact(layout.buildDirectory.file("libs/${module}.jar"))
-            artifact(layout.buildDirectory.file("docs/${module}-sources.jar")) {classifier = "sources"}
-            artifact(layout.buildDirectory.file("docs/${module}-javadoc.jar")) {classifier = "javadoc"}
-            pom {
-                name        = "Apache SIS storage using GDAL through Panama"
-                description = "Read and write files using the GDAL library. " +
-                              "This module assumes that GDAL is pre-installed."
-            }
-        }
         create<MavenPublication>("storage.gsf") {
             var module = "org.apache.sis.storage.gsf"
             groupId    = "org.apache.sis.storage"
diff --git a/optional/README.md b/optional/README.md
index 87b33e8562..32cccd5bf5 100644
--- a/optional/README.md
+++ b/optional/README.md
@@ -7,6 +7,9 @@ SIS releases because they are under more restrictive licenses than Apache 2.
 If those dependencies are not provided, Apache SIS [endorsed](../endorsed)
 modules will still work but without Graphical User Interface (GUI).
 
+GDAL is temporarily provided as an optional module despite its permissive license
+because it requires Java 22, while the main Apache SIS modules target Java 11.
+
 ## Configuration
 
 Paths to dependencies are specified by the following environment variables.
diff --git a/optional/build.gradle.kts b/optional/build.gradle.kts
index 156e99e056..dbcd427a82 100644
--- a/optional/build.gradle.kts
+++ b/optional/build.gradle.kts
@@ -83,11 +83,11 @@ dependencies {
 var srcDir = file("src")            // Must be the same as the hard-coded value in `BuildHelper.java`.
 tasks.compileJava {
     dependsOn(":endorsed:compileJava")
-    options.release.set(16)         // The version of both Java source code and compiled byte code.
+    options.release.set(22)         // The version of both Java source code and compiled byte code.
 }
 tasks.compileTestJava {
     options.compilerArgs.add("-source")         // "source", not "release", because we accept any target version.
-    options.compilerArgs.add("16")
+    options.compilerArgs.add("22")
     patchForTests(options.compilerArgs);
     srcDir.list().forEach {
         addRead(options.compilerArgs, it, "org.apache.sis.test.optional,org.junit.jupiter.api")
@@ -187,6 +187,8 @@ fun addLicenseEPSG() {
  */
 tasks.test {
     val args = mutableListOf("-enableassertions")
+    args.add("--enable-native-access")
+    args.add("org.apache.sis.storage.gdal")
     patchForTests(args);
     addRead  (args, "org.apache.sis.util",                                "ALL-UNNAMED")
     addExport(args, "org.apache.sis.util", "org.apache.sis.test",         "ALL-UNNAMED")
@@ -293,6 +295,19 @@ publishing {
                               "See https://openjfx.io/openjfx-docs/#install-javafx for details."
             }
         }
+        create<MavenPublication>("storage.gdal") {
+            var module = "org.apache.sis.storage.gdal"
+            groupId    = "org.apache.sis.storage"
+            artifactId = "sis-gdal"
+            artifact(layout.buildDirectory.file("libs/${module}.jar"))
+            artifact(layout.buildDirectory.file("docs/${module}-sources.jar")) {classifier = "sources"}
+            artifact(layout.buildDirectory.file("docs/${module}-javadoc.jar")) {classifier = "javadoc"}
+            pom {
+                name        = "Apache SIS storage using GDAL through Panama"
+                description = "Read and write files using the GDAL library. " +
+                              "This module assumes that GDAL is pre-installed."
+            }
+        }
     }
     /* Following block is currently repeated in all sub-projects. */
     repositories {
diff --git a/optional/src/org.apache.sis.gui/bundle/README b/optional/src/org.apache.sis.gui/bundle/README
index 950807eb18..d7d8a71b87 100644
--- a/optional/src/org.apache.sis.gui/bundle/README
+++ b/optional/src/org.apache.sis.gui/bundle/README
@@ -14,8 +14,9 @@ Installation
 ============
 
 For developing applications using the SIS library or for using on command-line,
-the only requirement is Java 11 or later. For launching the desktop application,
-requirements are Java 16 or later and JavaFX 20 or later.
+the only requirement is Java 11 or later, except the GDAL module which requires
+Java 22. For launching the desktop application, requirements are Java 22 or later
+and JavaFX 20 or later.
 
 1) Unzip `apache-sis-1.4-bin.zip` in any directory.
 2) Invoke `./apache-sis-1.4/bin/sis` for the command-line.
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/META-INF.services/org.apache.sis.storage.DataStoreProvider b/optional/src/org.apache.sis.storage.gdal/main/META-INF.services/org.apache.sis.storage.DataStoreProvider
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/META-INF.services/org.apache.sis.storage.DataStoreProvider
rename to optional/src/org.apache.sis.storage.gdal/main/META-INF.services/org.apache.sis.storage.DataStoreProvider
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/module-info.java b/optional/src/org.apache.sis.storage.gdal/main/module-info.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/module-info.java
rename to optional/src/org.apache.sis.storage.gdal/main/module-info.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Band.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Band.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Band.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Band.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ColorInterpretation.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ColorInterpretation.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ColorInterpretation.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ColorInterpretation.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/DataType.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/DataType.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/DataType.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/DataType.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Driver.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Driver.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Driver.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Driver.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ErrorHandler.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ErrorHandler.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ErrorHandler.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/ErrorHandler.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDAL.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDAL.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDAL.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDAL.java
diff --git a/incubator/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
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStore.java
diff --git a/incubator/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
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStoreProvider.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/GDALStoreProvider.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/OpenFlag.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/OpenFlag.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/OpenFlag.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/OpenFlag.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Opener.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Opener.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Opener.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Opener.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SpatialRef.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SpatialRef.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SpatialRef.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SpatialRef.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Subdataset.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Subdataset.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Subdataset.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/Subdataset.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SubdatasetList.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SubdatasetList.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SubdatasetList.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/SubdatasetList.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledCoverage.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledCoverage.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledCoverage.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledCoverage.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledResource.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledResource.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledResource.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/TiledResource.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/gdal/package-info.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryLoader.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryLoader.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryLoader.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryLoader.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/LibraryStatus.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/NativeFunctions.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/NativeFunctions.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/NativeFunctions.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/NativeFunctions.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.properties b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.properties
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.properties
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources.properties
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_en.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_en.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_en.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_en.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.properties b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.properties
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.properties
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/Resources_fr.properties
diff --git a/incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/package-info.java b/optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/package-info.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/package-info.java
rename to optional/src/org.apache.sis.storage.gdal/main/org/apache/sis/storage/panama/package-info.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/GDALStoreTest.java b/optional/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/GDALStoreTest.java
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/GDALStoreTest.java
rename to optional/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/GDALStoreTest.java
diff --git a/incubator/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/test.tiff b/optional/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/test.tiff
similarity index 100%
rename from incubator/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/test.tiff
rename to optional/src/org.apache.sis.storage.gdal/test/org/apache/sis/storage/gdal/test.tiff