Author: desruisseaux
Date: Fri Feb 16 14:58:32 2018
New Revision: 1824503

URL: http://svn.apache.org/viewvc?rev=1824503&view=rev
Log:
Fix the namespace and element name of MI_PolarizationOrientationCode.
The difficulty in this case is that the CodeList name changed.
See https://issues.apache.org/jira/browse/SIS-398

Modified:
    
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_PolarizationOrientationCode.java
    
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/package-info.java
    
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java
    
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
    
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
    
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
    
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
    
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_PolarizationOrientationCode.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_PolarizationOrientationCode.java?rev=1824503&r1=1824502&r2=1824503&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_PolarizationOrientationCode.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_PolarizationOrientationCode.java
 [UTF-8] Fri Feb 16 14:58:32 2018
@@ -31,7 +31,10 @@ import org.apache.sis.xml.Namespaces;
  * @author  Cédric Briançon (Geomatys)
  * @author  Guilhem Legal (Geomatys)
  * @version 1.0
- * @since   0.3
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/SIS-398";>SIS-398</a>
+ *
+ * @since 0.3
  * @module
  */
 public final class MI_PolarizationOrientationCode
@@ -76,7 +79,7 @@ public final class MI_PolarizationOrient
      * @return the value to be marshalled.
      */
     @Override
-    @XmlElement(name = "MI_PolarizationOrientationCode", namespace = 
Namespaces.GMI)
+    @XmlElement(name = "MI_PolarisationOrientationCode", namespace = 
Namespaces.MRC)
     public CodeListUID getElement() {
         return identifier;
     }

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/package-info.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/package-info.java?rev=1824503&r1=1824502&r2=1824503&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/package-info.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/package-info.java
 [UTF-8] Fri Feb 16 14:58:32 2018
@@ -54,8 +54,7 @@
     @XmlNs(prefix = "cit", namespaceURI = Namespaces.CIT),      // Citation 
and responsible party information
     @XmlNs(prefix = "lan", namespaceURI = Namespaces.LAN),      // Language 
localization
     @XmlNs(prefix = "mcc", namespaceURI = Namespaces.MCC),      // Metadata 
Common Classes
-    @XmlNs(prefix = "gmd", namespaceURI = LegacyNamespaces.GMD),
-    @XmlNs(prefix = "gmi", namespaceURI = LegacyNamespaces.GMI)
+    @XmlNs(prefix = "gmd", namespaceURI = LegacyNamespaces.GMD)
 })
 package org.apache.sis.internal.jaxb.code;
 

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java?rev=1824503&r1=1824502&r2=1824503&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultMedium.java
 [UTF-8] Fri Feb 16 14:58:32 2018
@@ -182,6 +182,9 @@ public class DefaultMedium extends ISOMe
      * Returns the name of the medium on which the resource can be received.
      *
      * @return name of the medium, or {@code null}.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-389";>SIS-389</a>
+     *
      */
     @Override
     @XmlElement(name = "name")

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java?rev=1824503&r1=1824502&r2=1824503&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
 [UTF-8] Fri Feb 16 14:58:32 2018
@@ -58,6 +58,8 @@ import org.apache.sis.xml.NilReason;
  *   <li>Serialized objects of this class are not guaranteed to be compatible 
with future Apache SIS releases.
  *       Serialization support is appropriate for short term storage or RMI 
between applications running the
  *       same version of Apache SIS. For long term storage, use {@link 
org.apache.sis.xml.XML} instead.</li>
+ *   <li>Coordinate Reference System can not be specified by identifier only; 
they have to be specified in full.
+ *       See <a 
href="https://issues.apache.org/jira/browse/SIS-397";>SIS-397</a>.</li>
  * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
@@ -212,6 +214,8 @@ public class DefaultVerticalExtent exten
      * The CRS identification includes unit of measure.
      *
      * @return the vertical CRS, or {@code null}.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-397";>SIS-397</a>
      */
     @Override
     @XmlElement(name = "verticalCRS")

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java?rev=1824503&r1=1824502&r2=1824503&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
 [UTF-8] Fri Feb 16 14:58:32 2018
@@ -107,6 +107,7 @@
                 @XmlNs(prefix = "srv",  namespaceURI = Namespaces.SRV),        
// Metadata for Services 2.0
                 @XmlNs(prefix = "lan",  namespaceURI = Namespaces.LAN),        
// Language localization
                 @XmlNs(prefix = "mcc",  namespaceURI = Namespaces.MCC),        
// Metadata Common Classes
+                @XmlNs(prefix = "gco",  namespaceURI = Namespaces.GCO),        
// Geographic Common
                 @XmlNs(prefix = "gmd",  namespaceURI = LegacyNamespaces.GMD),  
// Metadata ISO 19139:2007
                 @XmlNs(prefix = "srv1", namespaceURI = LegacyNamespaces.SRV)   
// Metadata for Services 1.0
 })

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java?rev=1824503&r1=1824502&r2=1824503&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
 [UTF-8] Fri Feb 16 14:58:32 2018
@@ -111,7 +111,10 @@
  * @author  Guilhem Legal (Geomatys)
  * @author  Cullen Rombach (Image Matters)
  * @version 1.0
- * @since   0.3
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/SIS-394";>SIS-394</a>
+ *
+ * @since 0.3
  * @module
  */
 @XmlSchema(location="http://standards.iso.org/iso/19157/-2/mdq/1.0/mdq.xsd";,

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java?rev=1824503&r1=1824502&r2=1824503&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
 [UTF-8] Fri Feb 16 14:58:32 2018
@@ -372,6 +372,10 @@ public abstract strictfp class Annotatio
      */
     protected String getExpectedXmlRootElementName(final Stereotype 
stereotype, final UML uml) {
         String name = uml.identifier();
+        switch (name) {
+            // This case can be removed if 
https://issues.apache.org/jira/browse/SIS-398 is fixed.
+            case "MI_PolarizationOrientationCode": name = 
"MI_PolarisationOrientationCode"; break;
+        }
         if (Stereotype.ABSTRACT.equals(stereotype)) {
             name = "Abstract".concat(name);
         }
@@ -903,7 +907,7 @@ public abstract strictfp class Annotatio
                 assertFalse("Expected @XmlElementRef.", wrapper.isInherited);
                 final UML uml = type.getAnnotation(UML.class);
                 if (uml != null) {                  // 'assertNotNull' is 
'testInterfaceAnnotations()' job.
-                    assertEquals("Wrong @XmlElement.", uml.identifier(), 
element.name());
+                    assertEquals("Wrong @XmlElement.", 
getExpectedXmlRootElementName(null, uml), element.name());
                 }
                 final String namespace = 
assertExpectedNamespace(element.namespace(), wrapper.type, uml);
                 if (!ControlledVocabulary.class.isAssignableFrom(type)) {

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java?rev=1824503&r1=1824502&r2=1824503&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
 [UTF-8] Fri Feb 16 14:58:32 2018
@@ -19,10 +19,10 @@ package org.apache.sis.test.xml;
 import java.util.Map;
 import java.util.Set;
 import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Arrays;
+import java.util.Iterator;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.AbstractSet;
 import java.io.IOException;
 import java.lang.reflect.Type;
 import java.lang.reflect.Field;
@@ -42,6 +42,7 @@ import org.opengis.annotation.UML;
 import org.apache.sis.util.Classes;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.xml.Namespaces;
 
 
 /**
@@ -55,10 +56,38 @@ import org.apache.sis.internal.jaxb.Lega
  */
 final strictfp class PackageVerifier {
     /**
+     * Sentinel value used in {@link #LEGACY_NAMESPACES} for meaning "all 
properties in that namespace".
+     */
+    private static final Set<String> ALL = new AbstractSet<String>() {
+        @Override public boolean          contains(Object v) {return true;}
+        @Override public int              size()             {return 0;}
+        @Override public Iterator<String> iterator()         {return 
Collections.emptyIterator();}
+    };
+
+    /**
      * Classes or properties having a JAXB annotation in this namespace should 
be deprecated.
+     * Deprecated namespaces are enumerated as keys. If the associated value 
is {@link #ALL},
+     * the whole namespace is deprecated. If the value is not ALL, then only 
the enumerated
+     * properties are deprecated.
+     *
+     * <p>Non-ALL values are rare. They happen in a few cases where a property 
is legacy despite its namespace.
+     * Those "properties" are errors in the legacy ISO 19139:2007 schema; they 
were types without their property
+     * wrappers. For example in {@code SV_CoupledResource}, {@code 
<gco:ScopedName>} was marshalled without its
+     * {@code <srv:scopedName>} wrapper — note the upper and lower-case "s". 
Because {@code ScopedName} is a type,
+     * we had to keep the namespace declared in {@link 
org.apache.sis.util.iso.DefaultScopedName}
+     * (the replacement is performed by {@code 
org.apache.sis.xml.FilteredWriter}).
+     * </p>
      */
-    private static final Set<String> LEGACY_NAMESPACES = 
Collections.unmodifiableSet(new HashSet<>(
-            Arrays.asList(LegacyNamespaces.GMD, LegacyNamespaces.GMI, 
LegacyNamespaces.GMX, LegacyNamespaces.SRV)));
+    private static final Map<String, Set<String>> LEGACY_NAMESPACES;
+    static {
+        final Map<String, Set<String>> m = new HashMap<>(8);
+        m.put(LegacyNamespaces.GMD, ALL);
+        m.put(LegacyNamespaces.GMI, ALL);
+        m.put(LegacyNamespaces.GMX, ALL);
+        m.put(LegacyNamespaces.SRV, ALL);
+        m.put(Namespaces.GCO, Collections.singleton("ScopedName"));     // Not 
to be confused with standard <srv:scopedName>
+        LEGACY_NAMESPACES = Collections.unmodifiableMap(m);
+    }
 
     /**
      * Types declared in JAXB annotations to be considered as equivalent to 
types in XML schemas.
@@ -284,7 +313,7 @@ final strictfp class PackageVerifier {
          * is already available or not. However properties in other namespaces 
should not be deprecated.
          * Some validations of deprecated properties are skipped because we 
didn't loaded their schema.
          */
-        isDeprecatedClass = LEGACY_NAMESPACES.contains(classNS);
+        isDeprecatedClass = (LEGACY_NAMESPACES.get(classNS) == ALL);
         if (!isDeprecatedClass) {
             if (type.isAnnotationPresent(Deprecated.class)) {
                 throw new SchemaException(errorInClassMember(null)
@@ -382,7 +411,7 @@ final strictfp class PackageVerifier {
          * We do not verify fully the properties in legacy namespaces because 
we didn't loaded their schemas.
          * However we verify at least that those properties are not declared 
as required.
          */
-        if (LEGACY_NAMESPACES.contains(ns)) {
+        if (LEGACY_NAMESPACES.getOrDefault(ns, 
Collections.emptySet()).contains(name)) {
             if (!isDeprecatedClass && element.required()) {
                 throw new SchemaException(errorInClassMember(javaName)
                         .append("Legacy property should not be required."));


Reply via email to