sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1831468 - in /sis/branches/JDK8/core/sis-metadata/src: main/java/org/apache/sis/xml/ test/java/org/apache/sis/internal/jaxb/lan/ test/java/org/apache/sis/test/ test/java/org/apache/sis/util/iso/
Date Sat, 12 May 2018 11:31:27 GMT
Author: desruisseaux
Date: Sat May 12 11:31:27 2018
New Revision: 1831468

URL: http://svn.apache.org/viewvc?rev=1831468&view=rev
Log:
Make XML.LENIENT_UNMARSHAL public with improved documentation.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java?rev=1831468&r1=1831467&r2=1831468&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java [UTF-8]
(original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java [UTF-8]
Sat May 12 11:31:27 2018
@@ -230,11 +230,25 @@ public final class XML extends Static {
     public static final String METADATA_VERSION = "org.apache.sis.xml.version.metadata";
 
     /**
-     * Whether the unmarshalling process should accept any metadata or GML version if the
user did not
-     * specified an explicit version. Accepting any version may have surprising results since
namespace
-     * substitutions may be performed on the fly.
+     * Specifies whether the unmarshalling process should accept any metadata or GML supported
version
+     * if the user did not specified an explicit version. The value can be a {@link Boolean}
instance,
+     * or {@code "true"} or {@code "false"} as a {@link String}. If this value is not specified,
then
+     * the default is {@code true} for all {@code XML.unmarshal} methods and {@code false}
otherwise.
+     *
+     * <p>Metadata and Geographic Markup Language have slightly different XML encoding
depending on the
+     * OGC/ISO version in use. Often the namespaces are different, but not only. Internally,
Apache SIS
+     * supports only the schema versions documented in this {@linkplain XML class javadoc},
for example
+     * the ISO 19115-3:2016 version of metadata schema.  For unmarshalling a document encoded
according
+     * an older metadata schema (e.g. ISO 19139:2007), a transformation is applied on-the-fly.
 However
+     * this transformation may sometime produce undesirable results or make debugging more
difficult.
+     * For this reason {@link MarshallerPool} applies the transformation only if explicitely
requested,
+     * either by setting a {@link #METADATA_VERSION} or {@link #GML_VERSION} explicitely,
or by setting
+     * this {@code LENIENT_UNMARSHAL} property to {@code true} if the version to unmarshal
is not known
+     * in advance.</p>
+     *
+     * @since 1.0
      */
-    static final String LENIENT_UNMARSHAL = "org.apache.sis.xml.version.lenient";
+    public static final String LENIENT_UNMARSHAL = "org.apache.sis.xml.lenient";
 
     /**
      * Allows client code to replace {@code xlink} or {@code uuidref} attributes by the actual
objects to use.

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java?rev=1831468&r1=1831467&r2=1831468&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
[UTF-8] Sat May 12 11:31:27 2018
@@ -92,7 +92,7 @@ public final strictfp class LanguageCode
         final Map<String,Object> properties = new HashMap<>(4);
         assertNull(properties.put(XML.LOCALE, Locale.UK));
         assertNull(properties.put(XML.TIMEZONE, UTC));
-        assertNull(properties.put("org.apache.sis.xml.version.lenient", Boolean.TRUE)); 
 // XML.LENIENT_UNMARSHAL
+        assertNull(properties.put(XML.LENIENT_UNMARSHAL, Boolean.TRUE));
         pool = new MarshallerPool(JAXBContext.newInstance(MetadataMock.class), properties);
     }
 

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java?rev=1831468&r1=1831467&r2=1831468&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] Sat May 12 11:31:27 2018
@@ -138,7 +138,7 @@ public abstract strictfp class XMLTestCa
             final Map<String,Object> properties = new HashMap<>(4);
             assertNull(properties.put(XML.LOCALE, Locale.UK));
             assertNull(properties.put(XML.TIMEZONE, TIMEZONE));
-            assertNull(properties.put("org.apache.sis.xml.version.lenient", Boolean.TRUE));
  // XML.LENIENT_UNMARSHAL
+            assertNull(properties.put(XML.LENIENT_UNMARSHAL, Boolean.TRUE));
             defaultPool = new MarshallerPool(properties);
         }
         return defaultPool;

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java?rev=1831468&r1=1831467&r2=1831468&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java
[UTF-8] Sat May 12 11:31:27 2018
@@ -66,7 +66,7 @@ public final strictfp class NameMarshall
     private String marshal(final GenericName name) throws JAXBException {
         if (pool == null) {
             pool = new MarshallerPool(JAXBContext.newInstance(IdentifiedObjectMock.class),
-                    Collections.singletonMap("org.apache.sis.xml.version.lenient", Boolean.TRUE));
+                    Collections.singletonMap(XML.LENIENT_UNMARSHAL, Boolean.TRUE));
         }
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.setProperty(XML.METADATA_VERSION, VERSION_2007);



Mime
View raw message