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 08710309d39c6da9a7c5a2a1435db99040117176
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Sun Dec 8 16:13:07 2024 +0100

    Upgrade GeoAPI snapshot version.
    Contains the addition of `getReferenceSystemType()` method.
    This upgrade fixes https://issues.apache.org/jira/browse/SIS-470
---
 .../org/apache/sis/buildtools/book/OGC.lst         |  1 +
 .../metadata/code/MD_ReferenceSystemTypeCode.java  | 86 ++++++++++++++++++++++
 .../metadata/replace/ReferenceSystemMetadata.java  | 29 +++++---
 .../xml/bind/metadata/replace/package-info.java    |  2 +
 .../apache/sis/metadata/PropertyAccessorTest.java  | 21 +++---
 geoapi/snapshot                                    |  2 +-
 6 files changed, 122 insertions(+), 19 deletions(-)

diff --git a/buildSrc/src/main/resources/org/apache/sis/buildtools/book/OGC.lst 
b/buildSrc/src/main/resources/org/apache/sis/buildtools/book/OGC.lst
index f9449cb40b..c045d4a504 100644
--- a/buildSrc/src/main/resources/org/apache/sis/buildtools/book/OGC.lst
+++ b/buildSrc/src/main/resources/org/apache/sis/buildtools/book/OGC.lst
@@ -157,6 +157,7 @@ MD_PixelOrientationCode
 MD_PortrayalCatalogueReference
 MD_ProgressCode
 MD_RangeDimension
+MD_ReferenceSystem
 MD_ReferenceSystemTypeCode
 MD_Releasability
 MD_RepresentativeFraction
diff --git 
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/code/MD_ReferenceSystemTypeCode.java
 
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/code/MD_ReferenceSystemTypeCode.java
new file mode 100644
index 0000000000..afc1148ada
--- /dev/null
+++ 
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/code/MD_ReferenceSystemTypeCode.java
@@ -0,0 +1,86 @@
+/*
+ * 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.xml.bind.metadata.code;
+
+import jakarta.xml.bind.annotation.XmlElement;
+import org.opengis.referencing.ReferenceSystemType;
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.xml.bind.cat.CodeListAdapter;
+import org.apache.sis.xml.bind.cat.CodeListUID;
+
+
+/**
+ * JAXB adapter for {@link ReferenceSystemTypeCode}
+ * in order to wrap the value in an XML element as specified by ISO 19115-3 
standard.
+ * See package documentation for more information about the handling of {@code 
CodeList} in ISO 19115-3.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ */
+public final class MD_ReferenceSystemTypeCode extends 
CodeListAdapter<MD_ReferenceSystemTypeCode, ReferenceSystemType> {
+    /**
+     * Empty constructor for JAXB only.
+     */
+    public MD_ReferenceSystemTypeCode() {
+    }
+
+    /**
+     * Creates a new adapter for the given value.
+     */
+    private MD_ReferenceSystemTypeCode(final CodeListUID value) {
+        super(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @return the wrapper for the code list value.
+     */
+    @Override
+    protected MD_ReferenceSystemTypeCode wrap(final CodeListUID value) {
+        return new MD_ReferenceSystemTypeCode(value);
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @return the code list class.
+     */
+    @Override
+    protected Class<ReferenceSystemType> getCodeListClass() {
+        return ReferenceSystemType.class;
+    }
+
+    /**
+     * Invoked by JAXB on marshalling.
+     *
+     * @return the value to be marshalled.
+     */
+    @Override
+    @XmlElement(name = "MD_ReferenceSystemTypeCode", namespace = 
Namespaces.MSR)
+    public CodeListUID getElement() {
+        return identifier;
+    }
+
+    /**
+     * Invoked by JAXB on unmarshalling.
+     *
+     * @param  value  the unmarshalled value.
+     */
+    public void setElement(final CodeListUID value) {
+        identifier = value;
+    }
+}
diff --git 
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/ReferenceSystemMetadata.java
 
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/ReferenceSystemMetadata.java
index ae167e3808..05a508d813 100644
--- 
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/ReferenceSystemMetadata.java
+++ 
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/ReferenceSystemMetadata.java
@@ -28,6 +28,7 @@ import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.Utilities;
 
 // Specific to the geoapi-3.1 and geoapi-4.0 branches:
+import org.opengis.referencing.ReferenceSystemType;
 import org.apache.sis.util.collection.Containers;
 
 // Specific to the geoapi-4.0 branch:
@@ -45,9 +46,6 @@ import org.opengis.metadata.Identifier;
  *   ├─mrs:referenceSystemIdentifier  :  mcc:MD_Identifier
  *   └─mrs:referenceSystemType        :  mrs:MD_ReferenceSystemTypeCode</pre>
  *
- * The {@code referenceSystemType} attribute is currently missing.
- * See <a href="https://issues.apache.org/jira/browse/SIS-470";>SIS-470</a>.
- *
  * <p>Note that this implementation is very simple and serves no other purpose 
than being
  * a container for XML parsing or formatting. For real referencing service, 
consider using
  * {@link org.apache.sis.referencing.AbstractReferenceSystem} subclasses 
instead.</p>
@@ -59,7 +57,10 @@ import org.opengis.metadata.Identifier;
  * @see org.apache.sis.referencing.AbstractReferenceSystem
  * @see <a href="https://issues.apache.org/jira/browse/SIS-431";>SIS-431</a>
  */
-@XmlType(name = "MD_ReferenceSystem_Type", namespace = Namespaces.MRS)
+@XmlType(name = "MD_ReferenceSystem_Type", namespace = Namespaces.MRS, 
propOrder = {
+    "name",
+    "referenceSystemType"
+})
 @XmlRootElement(name = "MD_ReferenceSystem", namespace = Namespaces.MRS)
 public class ReferenceSystemMetadata extends SimpleIdentifiedObject implements 
ReferenceSystem {
     /**
@@ -72,6 +73,13 @@ public class ReferenceSystemMetadata extends 
SimpleIdentifiedObject implements R
      */
     private boolean isLegacyMetadata;
 
+    /**
+     * The type of the reference system, or {@code null} if unknown.
+     * This type is inferred from the interfaces implemented by the CRS.
+     */
+    @XmlElement(name = "referenceSystemType")
+    public ReferenceSystemType referenceSystemType;
+
     /**
      * Creates a reference system without identifier.
      * This constructor is mainly for JAXB.
@@ -86,6 +94,7 @@ public class ReferenceSystemMetadata extends 
SimpleIdentifiedObject implements R
      */
     public ReferenceSystemMetadata(final ReferenceSystem crs) {
         super(crs);
+        referenceSystemType = crs.getReferenceSystemType().orElse(null);
     }
 
     /**
@@ -141,12 +150,14 @@ public class ReferenceSystemMetadata extends 
SimpleIdentifiedObject implements R
     @Override
     public boolean equals(final Object object, final ComparisonMode mode) {
         if (super.equals(object, mode) && (object instanceof ReferenceSystem)) 
{
-            final ReferenceSystem that = (ReferenceSystem) object;
-            if (mode.isIgnoringMetadata()) {
-                // Compare the name because it was ignored by super.equals(…) 
in "ignore metadata" mode.
-                return Utilities.deepEquals(getName(), that.getName(), mode);
+            final var that = (ReferenceSystem) object;
+            if (that.getReferenceSystemType().orElse(null) == 
referenceSystemType) {
+                if (mode.isIgnoringMetadata()) {
+                    // Compare the name because it was ignored by 
super.equals(…) in "ignore metadata" mode.
+                    return Utilities.deepEquals(getName(), that.getName(), 
mode);
+                }
+                return Containers.isNullOrEmpty(that.getDomains());
             }
-            return Containers.isNullOrEmpty(that.getDomains());
         }
         return false;
     }
diff --git 
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/package-info.java
 
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/package-info.java
index ddcd041557..a796576d9a 100644
--- 
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/package-info.java
+++ 
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/metadata/replace/package-info.java
@@ -46,6 +46,7 @@
     @XmlJavaTypeAdapter(DQM_Description.class),
     @XmlJavaTypeAdapter(DQM_ValueStructure.class),
     @XmlJavaTypeAdapter(SV_ParameterDirection.class),
+    @XmlJavaTypeAdapter(MD_ReferenceSystemTypeCode.class),
 
     // Java types, primitive types and basic OGC types handling
     @XmlJavaTypeAdapter(StringAdapter.class),
@@ -68,5 +69,6 @@ import org.apache.sis.xml.bind.metadata.DQM_Description;
 import org.apache.sis.xml.bind.gco.*;
 
 // Specific to the geoapi-3.1 and geoapi-4.0 branches:
+import org.apache.sis.xml.bind.metadata.code.MD_ReferenceSystemTypeCode;
 import org.apache.sis.xml.bind.metadata.code.SV_ParameterDirection;
 import org.apache.sis.xml.bind.metadata.code.DQM_ValueStructure;
diff --git 
a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java
 
b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java
index 100e3278a7..74886f5a02 100644
--- 
a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java
+++ 
b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java
@@ -38,6 +38,8 @@ import org.opengis.metadata.identification.*;                 
      // Really us
 import org.opengis.metadata.maintenance.MaintenanceInformation;
 import org.opengis.metadata.spatial.SpatialRepresentationType;
 import org.opengis.referencing.IdentifiedObject;
+import org.opengis.referencing.ReferenceSystem;
+import org.opengis.referencing.ReferenceSystemType;
 import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.datum.GeodeticDatum;
@@ -240,15 +242,16 @@ public final class PropertyAccessorTest extends TestCase {
     @Test
     public void testConstructorWithCovariantReturnType() {
         assertMappingEquals(new PropertyAccessor(GeographicCRS.class, 
GeographicCRSMock.class, GeographicCRSMock.class),
-        //……Declaring 
type……………………………Method……………………………………………JavaBeans……………………………UML 
identifier……………………Sentence………………………………Type…………………………………………………………
-            GeographicCRS.class,    "getCoordinateSystem", "coordinateSystem", 
"coordinateSystem",   "Coordinate system", EllipsoidalCS.class,       // 
Covariant return type
-            GeodeticCRS.class,      "getDatum",            "datum",            
"datum",              "Datum",             GeodeticDatum.class,       // 
Covariant return type
-            GeodeticCRS.class,      "getDatumEnsemble",    "datumEnsemble",    
"datumEnsemble",      "Datum ensemble",    DatumEnsemble.class,       // 
Covariant return type
-            IdentifiedObject.class, "getName",             "name",             
"name",               "Name",              Identifier.class,
-            IdentifiedObject.class, "getAlias",            "alias",            
"alias",              "Alias",             GenericName[].class,
-            IdentifiedObject.class, "getIdentifiers",      "identifiers",      
"identifier",         "Identifiers",       Identifier[].class,
-            IdentifiedObject.class, "getDomains",          "domains",          
"ObjectUsage.domain", "Domains",           ObjectDomain[].class,
-            IdentifiedObject.class, "getRemarks",          "remarks",          
"remarks",            "Remarks",           InternationalString.class);
+        //……Declaring 
type……………………………Method……………………………………………………JavaBeans……………………………………UML 
identifier………………………Sentence…………………………………………Type…………………………………………………………
+            GeographicCRS.class,    "getCoordinateSystem",    
"coordinateSystem",    "coordinateSystem",    "Coordinate system",     
EllipsoidalCS.class,       // Covariant return type
+            GeodeticCRS.class,      "getDatum",               "datum",         
      "datum",               "Datum",                 GeodeticDatum.class,      
 // Covariant return type
+            GeodeticCRS.class,      "getDatumEnsemble",       "datumEnsemble", 
      "datumEnsemble",       "Datum ensemble",        DatumEnsemble.class,      
 // Covariant return type
+            IdentifiedObject.class, "getName",                "name",          
      "name",                "Name",                  Identifier.class,
+            IdentifiedObject.class, "getAlias",               "alias",         
      "alias",               "Alias",                 GenericName[].class,
+            IdentifiedObject.class, "getIdentifiers",         "identifiers",   
      "identifier",          "Identifiers",           Identifier[].class,
+            IdentifiedObject.class, "getDomains",             "domains",       
      "ObjectUsage.domain",  "Domains",               ObjectDomain[].class,
+            IdentifiedObject.class, "getRemarks",             "remarks",       
      "remarks",             "Remarks",               InternationalString.class,
+            ReferenceSystem.class,  "getReferenceSystemType", 
"referenceSystemType", "referenceSystemType", "Reference system type", 
ReferenceSystemType.class);
     }
 
     /**
diff --git a/geoapi/snapshot b/geoapi/snapshot
index c830770c8c..ecbef84482 160000
--- a/geoapi/snapshot
+++ b/geoapi/snapshot
@@ -1 +1 @@
-Subproject commit c830770c8c13ea9219a9eefd98cf08e18a01c33c
+Subproject commit ecbef844820fb0f47dcfbd2af70a73ff3691a3a6

Reply via email to