sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1550857 [3/3] - in /sis/trunk: ./ application/sis-console/src/test/java/org/apache/sis/console/ core/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/ core/sis-build-helper/src/site/apt/ core/sis-metadata/src/main/java/org/apa...
Date Sat, 14 Dec 2013 00:15:39 GMT
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -16,16 +16,21 @@
  */
 package org.apache.sis.referencing;
 
+import java.util.Set;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Locale;
+import java.util.Collections;
 import org.opengis.test.Validators;
+import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
 import static org.apache.sis.metadata.iso.citation.HardCodedCitations.EPSG;
 
 
@@ -37,29 +42,49 @@ import static org.apache.sis.metadata.is
  * @version 0.4
  * @module
  */
-@DependsOn({IdentifiedObjectsTest.class, NamedIdentifierTest.class})
+@DependsOn({
+    IdentifiedObjectsTest.class, NamedIdentifierTest.class,
+    org.apache.sis.internal.jaxb.referencing.RS_IdentifierTest.class
+})
 public final strictfp class AbstractIdentifiedObjectTest extends TestCase {
     /**
      * Tests the {@link AbstractIdentifiedObject#AbstractIdentifiedObject(Map)} constructor.
      */
     @Test
     public void testCreateFromMap() {
-        final Map<String,Object> properties = new HashMap<String,Object>(10);
-        assertNull(properties.put("name",       "This is a name"));
-        assertNull(properties.put("remarks",    "There is remarks"));
-        assertNull(properties.put("remarks_fr", "Voici des remarques"));
+        final Map<String,Object> properties = new HashMap<String,Object>(8);
+        assertNull(properties.put("name",       "GRS 1980"));
+        assertNull(properties.put("codespace",  "EPSG"));
+        assertNull(properties.put("version",    "8.3"));
+        assertNull(properties.put("alias",      "International 1979"));//7019
+        assertNull(properties.put("remarks",    "Adopted by IUGG 1979 Canberra"));
+        assertNull(properties.put("remarks_fr", "Adopté par IUGG 1979 Canberra"));
+        validate(new AbstractIdentifiedObject(properties), Collections.<ReferenceIdentifier>emptySet(), "GRS1980");
+        /*
+         * Adds an identifier. This should change the choice made by AbstractIdentifiedObject.getID().
+         */
+        final ReferenceIdentifier identifier = new ImmutableIdentifier(null, "EPSG", "4326");
+        assertNull(properties.put("identifiers", identifier));
+        validate(new AbstractIdentifiedObject(properties), Collections.singleton(identifier), "EPSG4326");
+    }
 
-        final AbstractIdentifiedObject object = new AbstractIdentifiedObject(properties);
+    /**
+     * Validates the given object created by {@link #testCreateFromMap()}.
+     */
+    private static void validate(final AbstractIdentifiedObject object,
+            final Set<ReferenceIdentifier> identifiers, final String gmlID)
+    {
         Validators.validate(object);
-
-        assertEquals("name",       "This is a name",      object.getName().getCode());
-        assertNull  ("codeSpace",                         object.getName().getCodeSpace());
-        assertNull  ("version",                           object.getName().getVersion());
-        assertTrue  ("aliases",                           object.getAlias().isEmpty());
-        assertTrue  ("identifiers",                       object.getIdentifiers().isEmpty());
-        assertEquals("ID",         "Thisisaname",         object.getID());
-        assertEquals("remarks",    "There is remarks",    object.getRemarks().toString(Locale.ENGLISH));
-        assertEquals("remarks_fr", "Voici des remarques", object.getRemarks().toString(Locale.FRENCH));
+        final ReferenceIdentifier name = object.getName();
+        assertEquals("name",        "GRS 1980",                      name.getCode());
+        assertEquals("codespace",   "EPSG",                          name.getCodeSpace());
+        assertEquals("version",     "8.3",                           name.getVersion());
+        assertEquals("aliases",     "International 1979",            getSingleton(object.getAlias()).toString());
+//      assertEquals("names",       Collections.singletonList(name), object.getNames());
+        assertEquals("identifiers", identifiers,                     object.getIdentifiers());
+        assertEquals("ID",          gmlID,                           object.getID());
+        assertEquals("remarks",     "Adopted by IUGG 1979 Canberra", object.getRemarks().toString(Locale.ENGLISH));
+        assertEquals("remarks_fr",  "Adopté par IUGG 1979 Canberra", object.getRemarks().toString(Locale.FRENCH));
     }
 
     /**
@@ -67,7 +92,6 @@ public final strictfp class AbstractIden
      *
      * <ul>
      *   <li>{@link AbstractIdentifiedObject#getIdentifiers()}</li>
-     *   <li>{@link AbstractIdentifiedObject#getIdentifier()}</li>
      *   <li>{@link AbstractIdentifiedObject#getID()}</li>
      * </ul>
      *

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -139,10 +139,10 @@ public final strictfp class DefaultPrime
         assertEquals("greenwichLongitude", 2.33722917, pm.getGreenwichLongitude(NonSI.DEGREE_ANGLE), 1E-12);
         assertEquals("Equivalent to 2°20′14.025″.", pm.getRemarks().toString());
         assertNull("name.codeSpace", pm.getName().getCodeSpace());
-        assertWktEquals(pm, "PRIMEM[“Paris”, 2.33722917, AUTHORITY[“OGP”, “urn:ogc:def:meridian:EPSG::8903”]]");
+        assertWktEquals(pm, "PRIMEM[“Paris”, 2.33722917, AUTHORITY[“EPSG”, “8903”]]");
         assertXmlEquals(
                 "<gml:PrimeMeridian xmlns:gml=\"" + Namespaces.GML + "\">\n" +
-                "  <gml:identifier codeSpace=\"OGP\">urn:ogc:def:meridian:EPSG::8903</gml:identifier>" +
+                "  <gml:identifier codeSpace=\"EPSG\">8903</gml:identifier>" +
                 "  <gml:name>Paris</gml:name>\n" +
                 "  <gml:remarks>Equivalent to 2°20′14.025″.</gml:remarks>\n" +
                 "  <gml:greenwichLongitude uom=\"urn:ogc:def:uom:EPSG::9105\">2.5969213</gml:greenwichLongitude>\n" +

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -47,6 +47,7 @@ import org.junit.BeforeClass;
     org.apache.sis.io.wkt.ConventionTest.class,
     org.apache.sis.io.wkt.SymbolsTest.class,
     org.apache.sis.io.wkt.FormatterTest.class,
+    org.apache.sis.internal.jaxb.referencing.RS_IdentifierTest.class,
     org.apache.sis.referencing.IdentifiedObjectsTest.class,
     org.apache.sis.referencing.NamedIdentifierTest.class,
     org.apache.sis.referencing.AbstractIdentifiedObjectTest.class,

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/LegacyNamespaces.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -37,6 +37,13 @@ public final class LegacyNamespaces {
                                 VERSION_3_2 = new Version("3.2");
 
     /**
+     * First GML version of the new {@code xmlns}.
+     * GML 3.2.0 schemas are defined in the namespace {@code http://www.opengis.net/gml} whereas
+     * GML 3.2.1 schemas are defined in the namespace {@code http://www.opengis.net/gml/3.2}.
+     */
+    public static final Version VERSION_3_2_1 = new Version("3.2.1");
+
+    /**
      * The {@value} URL, which was used for all GML versions before 3.2.
      * This URL should not be used in JAXB annotations, even if the annotated element is really for that
      * legacy GML version. Instead, namespace replacements are applied on-the-fly at marshalling time.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -49,6 +49,8 @@ public final class GO_Boolean extends Pr
 
     /**
      * Returns the Java type which is bound by this adapter.
+     *
+     * @return {@code Boolean.class}
      */
     @Override
     protected Class<Boolean> getBoundType() {
@@ -75,7 +77,7 @@ public final class GO_Boolean extends Pr
      */
     @XmlElement(name = "Boolean")
     public Boolean getElement() {
-        return skip() ? null : metadata;
+        return metadata;
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -269,6 +269,8 @@ public class GO_CharacterString {
      * {@note Returning <code>null</code> is unusual and not a recommended practice.
      * But precedents exist (for example Swing <code>DefaultMutableTreeNode</code>)
      * and this class is not for public usage.}
+     *
+     * @return The text as a string (may be null).
      */
     @Override
     public final String toString() {

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -58,6 +58,8 @@ public final class GO_Decimal extends Pr
 
     /**
      * Returns the Java type which is bound by this adapter.
+     *
+     * @return {@code Double.class}
      */
     @Override
     protected Class<Double> getBoundType() {
@@ -84,7 +86,7 @@ public final class GO_Decimal extends Pr
      */
     @XmlElement(name = "Decimal")
     public Double getElement() {
-        return skip() ? null : metadata;
+        return metadata;
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal32.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal32.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal32.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal32.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -48,6 +48,8 @@ public final class GO_Decimal32 extends 
 
     /**
      * Returns the Java type which is bound by this adapter.
+     *
+     * @return {@code Float.class}
      */
     @Override
     protected Class<Float> getBoundType() {
@@ -74,7 +76,7 @@ public final class GO_Decimal32 extends 
      */
     @XmlElement(name = "Decimal")
     public Float getElement() {
-        return skip() ? null : metadata;
+        return metadata;
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -51,6 +51,8 @@ public final class GO_Integer extends Pr
 
     /**
      * Returns the Java type which is bound by this adapter.
+     *
+     * @return {@code Integer.class}
      */
     @Override
     protected Class<Integer> getBoundType() {
@@ -77,7 +79,7 @@ public final class GO_Integer extends Pr
      */
     @XmlElement(name = "Integer")
     public Integer getElement() {
-        return skip() ? null : metadata;
+        return metadata;
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer64.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer64.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer64.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer64.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -48,6 +48,8 @@ public final class GO_Integer64 extends 
 
     /**
      * Returns the Java type which is bound by this adapter.
+     *
+     * @return {@code Long.class}
      */
     @Override
     protected Class<Long> getBoundType() {
@@ -74,7 +76,7 @@ public final class GO_Integer64 extends 
      */
     @XmlElement(name = "Integer")
     public Long getElement() {
-        return skip() ? null : metadata;
+        return metadata;
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -53,6 +53,8 @@ public final class GO_Real extends Prope
 
     /**
      * Returns the Java type which is bound by this adapter.
+     *
+     * @return {@code Double.class}
      */
     @Override
     protected Class<Double> getBoundType() {
@@ -79,7 +81,7 @@ public final class GO_Real extends Prope
      */
     @XmlElement(name = "Real")
     public Double getElement() {
-        return skip() ? null : metadata;
+        return metadata;
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -59,6 +59,8 @@ public final class GO_RecordType extends
 
     /**
      * Returns the GeoAPI interface which is bound by this adapter.
+     *
+     * @return {@code RecordType.class}
      */
     @Override
     protected Class<RecordType> getBoundType() {
@@ -73,7 +75,7 @@ public final class GO_RecordType extends
      */
     @XmlElement(name = "RecordType")
     public DefaultRecordType getElement() {
-        return skip() ? null : DefaultRecordType.castOrCopy(metadata);
+        return DefaultRecordType.castOrCopy(metadata);
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -105,7 +105,7 @@ import org.apache.sis.util.iso.SimpleInt
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.4
  * @module
  *
  * @see XmlAdapter
@@ -114,7 +114,8 @@ public abstract class PropertyType<Value
         extends XmlAdapter<ValueType,BoundType>
 {
     /**
-     * The wrapped GeoAPI metadata instance.
+     * The wrapped GeoAPI metadata instance, or {@code null} if the metadata shall not be marshalled.
+     * Metadata are not marshalled when replaced by {@code xlink:href} or {@code uuidref} attributes.
      */
     protected BoundType metadata;
 
@@ -140,8 +141,8 @@ public abstract class PropertyType<Value
     }
 
     /**
-     * Builds an adapter for the given primitive wrapper. This constructor checks for nil reasons
-     * only if {@code check} is {@code true}.
+     * Builds a {@code PropertyType} wrapper for the given primitive type wrapper.
+     * This constructor checks for nil reasons only if {@code check} is {@code true}.
      *
      * @param value The primitive type wrapper.
      * @param mayBeNil {@code true} if we should check for nil reasons.
@@ -152,31 +153,33 @@ public abstract class PropertyType<Value
             final Object property = PrimitiveTypeProperties.property(value);
             if (property instanceof NilReason) {
                 reference = property.toString();
+                metadata  = null;
             }
         }
     }
 
     /**
-     * Builds an adapter for the given GeoAPI interface. This constructor checks if the given metadata
+     * Builds a wrapper for the given GeoAPI interface. This constructor checks if the given metadata
      * implements the {@link NilObject} or {@link IdentifiedObject} interface. If the object implements
      * both of them (should not happen, but we never know), then the identifiers will have precedence.
      *
-     * @param metadata The interface to wrap.
+     * @param value The interface to wrap.
      */
-    protected PropertyType(final BoundType metadata) {
-        this.metadata = metadata;
+    protected PropertyType(final BoundType value) {
+        metadata = value;
         /*
          * Do not invoke NilReason.forObject(metadata) in order to avoid unnecessary synchronization.
          * Subclasses will use the PropertyType(BoundType, boolean) constructor instead when a check
          * for primitive type is required.
          */
-        if (metadata instanceof NilObject) {
-            final NilReason reason = ((NilObject) metadata).getNilReason();
+        if (value instanceof NilObject) {
+            final NilReason reason = ((NilObject) value).getNilReason();
             if (reason != null) {
                 reference = reason.toString();
+                metadata  = null;
             }
         }
-        if (metadata instanceof IdentifiedObject) {
+        if (value instanceof IdentifiedObject) {
             /*
              * Get the identifiers as full UUID or XLink objects. We do not use the more permissive methods
              * working with arbitrary strings -- e.g. map.get(IdentifierSpace.HREF) -- because we are going
@@ -197,7 +200,7 @@ public abstract class PropertyType<Value
              * We do not try to parse UUID or XLink objects from String because it should be the job of
              * org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases.put(Citation, String).
              */
-            final IdentifierMap map = ((IdentifiedObject) metadata).getIdentifierMap();
+            final IdentifierMap map = ((IdentifiedObject) value).getIdentifierMap();
             XLink  link = map.getSpecialized(IdentifierSpace.XLINK);
             UUID   uuid = map.getSpecialized(IdentifierSpace.UUID);
             if (uuid != null || link != null) {
@@ -209,11 +212,20 @@ public abstract class PropertyType<Value
                  * If not, forget them in order to avoid marshalling the identifiers twice (see the
                  * example in the above comment).
                  */
-                if (uuid != null && !resolver.canSubstituteByReference(context, type, metadata, uuid)) {
-                    uuid = null;
+                if (uuid != null) {
+                    if (resolver.canSubstituteByReference(context, type, value, uuid)) {
+                        metadata = null;
+                    } else {
+                        uuid = null;
+                    }
                 }
-                if (link != null && !resolver.canSubstituteByReference(context, type, metadata, link)) {
-                    link = null;
+                /*
+                 * There is no risk of duplication for 'xlink' because there is no such attribute in ISOMetadata.
+                 * So if the user does not allow us to omit the metadata object, we will still keep the xlink for
+                 * informative purpose.
+                 */
+                if (link != null && resolver.canSubstituteByReference(context, type, value, link)) {
+                    metadata = null;
                 }
                 if (uuid != null || link != null) {
                     reference = new ObjectReference(uuid, link);
@@ -287,18 +299,6 @@ public abstract class PropertyType<Value
     }
 
     /**
-     * Returns {@code true} if the wrapped metadata should not be marshalled. It may be because
-     * a non-null "{@code uuidref}" attribute has been specified (in which case the UUID reference
-     * will be marshalled in place of the full metadata), or any other reason that may be added in
-     * future implementations.
-     *
-     * @return {@code true} if the wrapped metadata should not be marshalled.
-     */
-    protected final boolean skip() {
-        return reference != null;
-    }
-
-    /**
      * A URN to an external resources, or to an other part of a XML document, or an identifier.
      * The {@code uuidref} attribute is used to refer to an XML element that has a corresponding
      * {@code uuid} attribute.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -26,6 +26,7 @@ import org.opengis.metadata.citation.Cit
 import org.opengis.metadata.extent.Extent;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.internal.util.Citations;
 import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.ComparisonMode;
@@ -243,7 +244,7 @@ public class SimpleIdentifiedObject impl
         }
         buffer.append(code).append('"');
         if (authority != null) {
-            buffer.append(", AUTHORITY[\"").append(authority.getTitle()).append("\"]");
+            buffer.append(", AUTHORITY[\"").append(Citations.getIdentifier(authority)).append("\"]");
         }
         if (deprecated) {
             buffer.append(", DEPRECATED");

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/URIParser.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/URIParser.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/URIParser.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/URIParser.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -16,7 +16,11 @@
  */
 package org.apache.sis.internal.util;
 
+import java.util.Map;
+import java.util.Collections;
+
 import static org.apache.sis.util.CharSequences.*;
+import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
 
 /**
@@ -36,11 +40,11 @@ import static org.apache.sis.util.CharSe
  * {@section Components or URN}
  * URN begins with {@code "urn:ogc:def:"} (formerly {@code "urn:x-ogc:def:"}) followed by:
  * <ul>
- *   <li>an <cite>object type</cite></li>
- *   <li>an <cite>authority</cite></li>
- *   <li>an optional version number (often omitted)</li>
- *   <li>the code</li>
- *   <li>an arbitrary amount of parameters</li>
+ *   <li>an object {@linkplain #type}</li>
+ *   <li>an {@linkplain #authority}</li>
+ *   <li>an optional {@linkplain #version} number (often omitted)</li>
+ *   <li>the {@linkplain #code}</li>
+ *   <li>an arbitrary amount of {@linkplain #parameters}</li>
  * </ul>
  *
  * The <cite>object type</cite> can be:
@@ -97,26 +101,133 @@ public final class URIParser {
     /**
      * The URN separator.
      */
-    private static final char SEPARATOR = ':';
+    public static final char SEPARATOR = ':';
+
+    /**
+     * Server and path portions of HTTP URL for various types (currently {@code "crs"}).
+     * For each URL, value starts after the protocol part and finishes before the authority filename.
+     *
+     * <p>As of Apache SIS 0.4, this map has a single entry. However more entries may be added in future SIS versions.
+     * If new entries are added, then see the TODO comment in the {@link #codeForHTTP(String, String, String, int)}
+     * method.</p>
+     */
+    private static final Map<String,String> PATHS = Collections.singletonMap("crs", "//www.opengis.net/gml/srs/");
+
+    /**
+     * {@code true} if the URI is a {@code "http://www.opengis.net/gml/…"} URL, or
+     * {@code false} if the URI is a {@code "urn:ogc:def:…"} URN.
+     */
+    public boolean isHTTP;
+
+    /**
+     * The type part of a URI, or {@code null} if none (empty).
+     *
+     * {@example In the <code>"urn:ogc:def:crs:EPSG:8.2:4326"</code> URN, this is <code>"crs"</code>}.
+     */
+    public String type;
+
+    /**
+     * The authority part of a URI, or {@code null} if none (empty).
+     *
+     * {@example In the <code>"urn:ogc:def:crs:EPSG:8.2:4326"</code> URN, this is <code>"EPSG"</code>}.
+     */
+    public String authority;
+
+    /**
+     * The version part of a URI, or {@code null} if none (empty).
+     *
+     * {@example In the <code>"urn:ogc:def:crs:EPSG:8.2:4326"</code> URN, this is <code>"8.2"</code>}.
+     */
+    public String version;
 
     /**
-     * A URL portion of HTTP URL for Coordinate Reference System identifiers.
-     * Portion starts after the protocol part, and finishes before the authority
+     * The code part of a URI, or {@code null} if none (empty).
+     *
+     * {@example In the <code>"urn:ogc:def:crs:EPSG:8.2:4326"</code> URN, this is <code>"4326"</code>}.
      */
-    private static final String SRS_PATH = "//www.opengis.net/gml/srs/";
+    public String code;
 
-    /*
-     * Current version contains only static methods. However a future version may contain
-     * some fields like 'type', 'version' and 'authority' for storing the parsing result.
+    /**
+     * The parameters, or {@code null} if none.
+     *
+     * {@example In the <code>"urn:ogc:def:crs:OGC:1.3:AUTO42003:1:-100:45"</code> URN,
+     *           this is <code>{"1", "-100", "45"}</code>}.
      */
+    public String[] parameters;
 
     /**
-     * Do not allow instantiation of this class.
+     * For {@link #parse(String)} usage only.
      */
     private URIParser() {
     }
 
     /**
+     * Parses the given URI.
+     *
+     * @param  uri The URI to parse.
+     * @return The parse result, or {@code null} if the given URI is not recognized.
+     */
+    public static URIParser parse(final String uri) {
+        ensureNonNull("uri", uri);
+        URIParser result = null;
+        int upper = -1;
+        for (int p=0; p<=6; p++) {
+            final int lower = upper + 1;
+            upper = uri.indexOf(SEPARATOR, lower);
+            if (upper < 0) {
+                if (p != 6) {
+                    return null; // No more components.
+                }
+                upper = uri.length();
+            }
+            final String require;
+            switch (p) {
+                /*
+                 * Verifies that the 3 first components are ""urn:ogc:def:" without storing them.
+                 * In the particular case of second component, we also accept "x-ogc" in addition
+                 * to "ogc". The actual verification is performed after the 'switch' case.
+                 */
+                case 0: if (regionMatches("http", uri, lower, upper)) {
+                            result = new URIParser();
+                            return codeForHTTP(null, null, uri, upper+1, result) != null ? result : null;
+                        }
+                        require = "urn";   break;
+                case 1: if (regionMatches("ogc", uri, lower, upper)) continue;
+                        require = "x-ogc"; break;
+                case 2: require = "def";   break;
+                default: {
+                    /*
+                     * For all components after the first 3 ones, trim whitespaces and store non-empty values.
+                     */
+                    String value = trimWhitespaces(uri, lower, upper).toString();
+                    if (value.isEmpty()) {
+                        value = null;
+                    }
+                    switch (p) {
+                        case 3:  result = new URIParser();
+                                 result.type      = value; break;
+                        case 4:  result.authority = value; break;
+                        case 5:  result.version   = value; break;
+                        case 6:  result.code      = value; break;
+                        default: throw new AssertionError(p);
+                    }
+                    continue;
+                }
+            }
+            if (!regionMatches(require, uri, lower, upper)) {
+                return null;
+            }
+        }
+        /*
+         * Take every remaining components as parameters.
+         */
+        if (++upper < uri.length()) {
+            result.parameters = (String[]) split(uri.substring(upper), SEPARATOR);
+        }
+        return result;
+    }
+
+    /**
      * Returns {@code true} if a sub-region of {@code urn} matches the given {@code component},
      * ignoring case, leading and trailing whitespaces.
      *
@@ -184,13 +295,16 @@ public final class URIParser {
      *   <li>The HTTP form (e.g. {@code "http://www.opengis.net/gml/srs/epsg.xml#4326"}).</li>
      * </ul>
      *
-     * @param  type      The expected object type (e.g. {@code "crs"}). See class javadoc for a list of types.
+     * @param  type      The expected object type (e.g. {@code "crs"}) in lower cases. See class javadoc for a list of types.
      * @param  authority The expected authority, typically {@code "epsg"}. See class javadoc for a list of authorities.
      * @param  uri       The URI to parse.
      * @return The code part of the given URI, or {@code null} if the codespace does not match the given type
      *         and authority, the code is empty, or the code is followed by parameters.
      */
     public static String codeOf(final String type, final String authority, final String uri) {
+        ensureNonNull("type",      type);
+        ensureNonNull("authority", authority);
+        ensureNonNull("uri",       uri);
         /*
          * Get the part before the first ':' character. If none, assume that the given URI is already the code.
          * Otherwise the part may be either "http" or "urn" protocol, or the given authority (typically "EPSG").
@@ -219,7 +333,7 @@ public final class URIParser {
             return null;
         }
         if (length == 4) {
-            return codeForHTTP(type, authority, uri, upper+1);
+            return codeForHTTP(type, authority, uri, upper+1, null);
         }
         /*
          * At this point we have determined that the protocol is URN. The next components after "urn"
@@ -256,23 +370,47 @@ public final class URIParser {
      *   <li>{@code crs} for Coordinate Reference System objects
      *       (example: {@code "http://www.opengis.net/gml/srs/epsg.xml#4326"})</li>
      * </ul>
+     *
+     * @param type      The expected type in lower cases, or {@code null} for any.
+     * @param authority The expected authority, or {@code null} for any.
+     * @param url       The URL to parse.
+     * @param result    If non-null, store the type, authority and code in that object.
      */
-    private static String codeForHTTP(final String type, final String authority, final String url, int lower) {
-        if (type.equals("crs")) {
-            if (url.regionMatches(true, lower, SRS_PATH, 0, SRS_PATH.length())) {
-                lower += SRS_PATH.length();
-                if (url.regionMatches(true, lower, authority, 0, authority.length())) {
-                    lower += authority.length();
-                    int upper = url.length();
-                    if (lower < upper && url.charAt(lower) == '.') {
-                        // Ignore the extension (typically ".xml", but we accept anything).
-                        if ((lower = url.indexOf('#', lower+1)) >= 0) {
-                            lower = skipLeadingWhitespaces(url, lower+1, upper);
-                            upper = skipTrailingWhitespaces(url, lower, upper);
-                            if (lower < upper) {
-                                return url.substring(lower, upper);
-                            }
+    private static String codeForHTTP(final String type, String authority, final String url, int lower,
+            final URIParser result)
+    {
+        Map<String, String> paths = PATHS;
+        if (type != null) {
+            final String path = paths.get(type);
+            if (path == null) {
+                return null;
+            }
+            // TODO: For now do nothing since PATHS is a singleton. However if a future SIS version
+            //       defines more PATHS entries, then we should replace here the 'paths' reference by
+            //       a new Collection.singletonMap containing only the entry of interest.
+        }
+        for (final Map.Entry<String,String> entry : paths.entrySet()) {
+            final String path = entry.getValue();
+            if (url.regionMatches(true, lower, path, 0, path.length())) {
+                lower += path.length();
+                if (authority == null) {
+                    authority = url.substring(lower, skipIdentifierPart(url, lower));
+                } else if (!url.regionMatches(true, lower, authority, 0, authority.length())) {
+                    continue;
+                }
+                lower += authority.length();
+                int upper = url.length();
+                if (lower < upper && url.charAt(lower) == '.') {
+                    // Ignore the extension (typically ".xml", but we accept anything).
+                    if ((lower = url.indexOf('#', lower+1)) >= 0) {
+                        final String code = trimWhitespaces(url, lower+1, upper).toString();
+                        if (result != null) {
+                            result.isHTTP    = true;
+                            result.type      = entry.getKey();
+                            result.authority = authority;
+                            result.code      = code;
                         }
+                        return code;
                     }
                 }
             }
@@ -281,6 +419,18 @@ public final class URIParser {
     }
 
     /**
+     * Returns the index after the last identifier character.
+     */
+    private static int skipIdentifierPart(final String text, int i) {
+        while (i < text.length()) {
+            final int c = text.codePointAt(i);
+            if (!Character.isUnicodeIdentifierPart(c)) break;
+            i += Character.charCount(c);
+        }
+        return i;
+    }
+
+    /**
      * Parses a URL which contains a pointer to a XML fragment.
      * The current implementation recognizes the following types:
      *
@@ -319,16 +469,61 @@ public final class URIParser {
                             if (c == '\'' || c == '"') {
                                 final int s = url.indexOf(c, ++i);
                                 if (s >= 0) {
-                                    return (String) trimWhitespaces(url, i, s);
+                                    return trimWhitespaces(url, i, s).toString();
                                 }
                             }
                         }
                     } else {
-                        return (String) trimWhitespaces(url, f+1, url.length());
+                        return trimWhitespaces(url, f+1, url.length()).toString();
                     }
                 }
             }
         }
         return null;
     }
+
+    /**
+     * Returns a URN representation of this URI.
+     *
+     * @return A URN representation of this URI.
+     */
+    public String toURN() {
+        final StringBuilder buffer = new StringBuilder("urn:ogc:def");
+        int n = 4;
+        if (parameters != null) {
+            n += parameters.length;
+        }
+        for (int p=0; p<n; p++) {
+            String component;
+            switch (p) {
+                case 0:  component = type;            break;
+                case 1:  component = authority;       break;
+                case 2:  component = version;         break;
+                case 3:  component = code;            break;
+                default: component = parameters[p-4]; break;
+            }
+            buffer.append(SEPARATOR);
+            if (component != null) {
+                buffer.append(component);
+            }
+        }
+        return buffer.toString();
+    }
+
+    /**
+     * Returns a string representation of this URI. If the URI were originally a HTTP URL,
+     * then this method format the URI as such. Otherwise this method returns {@link #toURN()}.
+     *
+     * @return The string representation of this URI.
+     */
+    @Override
+    public String toString() {
+        if (isHTTP) {
+            final String path = PATHS.get(type);
+            if (path != null) {
+                return "http:" + path + authority + ".xml#" + code;
+            }
+        }
+        return toURN();
+    }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -24,6 +24,7 @@ import javax.measure.unit.Unit;
 import org.apache.sis.internal.util.Utilities;
 import org.apache.sis.util.collection.CheckedContainer;
 import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.Emptiable;
 import org.apache.sis.util.Immutable;
 import org.apache.sis.util.Numbers;
 
@@ -87,7 +88,7 @@ import org.apache.sis.internal.jdk7.Obje
  * @see org.apache.sis.util.collection.RangeSet
  */
 @Immutable
-public class Range<E extends Comparable<? super E>> implements CheckedContainer<E>, Formattable, Serializable {
+public class Range<E extends Comparable<? super E>> implements CheckedContainer<E>, Formattable, Emptiable, Serializable {
     /**
      * For cross-version compatibility.
      */
@@ -262,6 +263,7 @@ public class Range<E extends Comparable<
      *
      * @return {@code true} if this range is empty.
      */
+    @Override
     public final boolean isEmpty() {
         if (minValue == null || maxValue == null) {
             return false; // Unbounded: can't be empty.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -78,7 +78,7 @@ import org.apache.sis.util.resources.Err
  * being checked. This programmatic name is used for building an error message localized
  * in the {@linkplain java.util.Locale#getDefault() default locale} if the check failed.
  *
- * @author Martin Desruisseaux (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.17)
  * @version 0.4
  * @module

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -643,7 +643,7 @@ search:     for (; fromIndex <= toIndex;
         }
         // 'excludeEmpty' must use the same criterion than trimWhitespaces(…).
         final boolean excludeEmpty = isWhitespace(separator);
-        CharSequence[] strings = new CharSequence[4];
+        CharSequence[] strings = (text instanceof String) ? new String[4] : new CharSequence[4];
         final int length = text.length();
         int count = 0, last  = 0, i = 0;
         while ((i = indexOf(text, separator, i, length)) >= 0) {

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -18,7 +18,7 @@ package org.apache.sis.util;
 
 
 /**
- * Indicates that this object can be compared for equality using different levels of strictness.
+ * Interfaces of classes for which instances can be compared for equality using different levels of strictness.
  * For example {@link org.opengis.referencing.operation.MathTransform} implementations can be
  * compared ignoring some properties (remarks, <i>etc.</i>) that are not relevant to the
  * coordinates calculation.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Localized.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Localized.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Localized.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Localized.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -20,7 +20,8 @@ import java.util.Locale;
 
 
 /**
- * Interface of localized services (parser, formatter, codes, …).
+ * Interface of classes for which each instance is configured for a particular locale.
+ * Those classes are often parsers or formatters.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.05)

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -24,7 +24,7 @@ import org.apache.sis.internal.converter
 
 
 /**
- * Creates {@link ObjectConverter} instances, or uses them for creating collection views.
+ * Static methods for creating {@link ObjectConverter} instances or collection views based on converters.
  * Converters are created by the following methods:
  *
  * <ul>

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -257,6 +257,9 @@ public class Cache<K,V> extends Abstract
 
     /**
      * Returns {@code true} if this map contains the specified key.
+     *
+     * @param  key The key to check for existence.
+     * @return {@code true} if the given key still exist in this cache.
      */
     @Override
     public boolean containsKey(final Object key) {
@@ -848,6 +851,8 @@ public class Cache<K,V> extends Abstract
     /**
      * Returns the set of keys in this cache. The returned set is subjects to the same caution
      * than the ones documented in the {@link ConcurrentHashMap#keySet()} method.
+     *
+     * @return The set of keys in this cache.
      */
     @Override
     public Set<K> keySet() {

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -57,7 +57,7 @@ import org.apache.sis.internal.jdk7.Obje
  * @version 0.3
  * @module
  */
-@XmlType(name = "GenericName")
+@XmlType(name = "GenericName") // Actually 'gml:CodeType', but the later is used elsewhere.
 public abstract class AbstractName implements GenericName, Serializable {
     /**
      * Serial number for inter-operability with different versions.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -20,6 +20,7 @@ import java.util.List;
 import java.util.Collections;
 import java.util.Locale;
 import java.io.ObjectStreamException;
+import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -58,6 +59,7 @@ import org.apache.sis.internal.jdk7.Obje
  * @module
  */
 @Immutable
+@XmlType(name = "LocalName") // Actually 'gml:CodeType', but the later is used elsewhere.
 @XmlRootElement(name = "LocalName")
 public class DefaultLocalName extends AbstractName implements LocalName {
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -20,6 +20,7 @@ import java.util.List;
 import java.util.Iterator;
 import java.util.ConcurrentModificationException;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
 import org.opengis.util.NameSpace;
 import org.opengis.util.LocalName;
 import org.opengis.util.ScopedName;
@@ -48,6 +49,7 @@ import org.apache.sis.internal.util.Unmo
  * @module
  */
 @Immutable
+@XmlType(name = "ScopedName") // Actually 'gml:CodeType', but the later is used elsewhere.
 @XmlRootElement(name = "ScopedName")
 public class DefaultScopedName extends AbstractName implements ScopedName {
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -122,7 +122,7 @@ abstract class Pooled {
      * Whether {@link FilteredNamespaces} shall be used of not. Values can be:
      *
      * <ul>
-     *   <li>0 for the default behavior, which is apply namespace replacements only if the {@link XML#GML_VERSION}
+     *   <li>0 for the default behavior, which applies namespace replacements only if the {@link XML#GML_VERSION}
      *       property is set to an older value than the one supported natively by SIS.</li>
      *   <li>1 for forcing namespace replacements at unmarshalling time. This is useful for reading a XML document
      *       of unknown GML version.</li>
@@ -132,7 +132,7 @@ abstract class Pooled {
      *
      * @see LegacyNamespaces#APPLY_NAMESPACE_REPLACEMENTS
      */
-    private byte applyNamespaceReplacements;
+    private byte xmlnsReplaceCode;
 
     /**
      * The GML version to be marshalled or unmarshalled, or {@code null} if unspecified.
@@ -217,15 +217,16 @@ abstract class Pooled {
             reset(entry.getKey(), entry.getValue());
         }
         initialProperties.clear();
-        bitMasks        = template.bitMasks;
-        locale          = template.locale;
-        timezone        = template.timezone;
-        schemas         = template.schemas;
-        gmlVersion      = template.gmlVersion;
-        resolver        = template.resolver;
-        converter       = template.converter;
-        warningListener = template.warningListener;
-        resetTime       = System.nanoTime();
+        bitMasks         = template.bitMasks;
+        locale           = template.locale;
+        timezone         = template.timezone;
+        schemas          = template.schemas;
+        xmlnsReplaceCode = template.xmlnsReplaceCode;
+        gmlVersion       = template.gmlVersion;
+        resolver         = template.resolver;
+        converter        = template.converter;
+        warningListener  = template.warningListener;
+        resetTime        = System.nanoTime();
         if (this instanceof Marshaller) {
             bitMasks |= Context.MARSHALLING;
         }
@@ -254,11 +255,11 @@ abstract class Pooled {
      * @see FilteredNamespaces
      */
     final FilterVersion getFilterVersion() {
-        switch (applyNamespaceReplacements) {
+        switch (xmlnsReplaceCode) {
             case 0: {
                 // Apply namespace replacements only for older versions than the one supported natively by SIS.
                 if (gmlVersion != null) {
-                    if (gmlVersion.compareTo(LegacyNamespaces.VERSION_3_2, 2) < 0) {
+                    if (gmlVersion.compareTo(LegacyNamespaces.VERSION_3_2_1, 2) < 0) {
                         return FilterVersion.GML31;
                     }
                 }
@@ -389,9 +390,9 @@ abstract class Pooled {
                     return;
                 }
                 if (name.equals(LegacyNamespaces.APPLY_NAMESPACE_REPLACEMENTS)) {
-                    applyNamespaceReplacements = 0;
+                    xmlnsReplaceCode = 0;
                     if (value != null) {
-                        applyNamespaceReplacements = ((Boolean) value) ? (byte) 1 : (byte) 2;
+                        xmlnsReplaceCode = ((Boolean) value) ? (byte) 1 : (byte) 2;
                     }
                     return;
                 }
@@ -436,7 +437,7 @@ abstract class Pooled {
                 return (n != 0) ? ArraysExt.resize(substitutes, n) : null;
             }
             if (name.equals(LegacyNamespaces.APPLY_NAMESPACE_REPLACEMENTS)) {
-                switch (applyNamespaceReplacements) {
+                switch (xmlnsReplaceCode) {
                     case 1:  return Boolean.TRUE;
                     case 2:  return Boolean.FALSE;
                     default: return null;

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -19,6 +19,7 @@ package org.apache.sis.xml;
 import java.util.UUID;
 import java.lang.reflect.Proxy;
 import org.opengis.metadata.Identifier;
+import org.apache.sis.util.Emptiable;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.internal.jaxb.gmx.Anchor;
@@ -38,7 +39,7 @@ import static org.apache.sis.util.Argume
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.18)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public class ReferenceResolver {
@@ -60,7 +61,7 @@ public class ReferenceResolver {
      *
      * <ul>
      *   <li>Implements the given {@code type} interface.</li>
-     *   <li>Implements the {@link IdentifiedObject} interface.</li>
+     *   <li>Implements the {@link NilObject} and {@link IdentifiedObject} interfaces from this package.</li>
      *   <li>{@link IdentifiedObject#getIdentifiers()} will return the given identifiers.</li>
      *   <li>{@link IdentifiedObject#getIdentifierMap()} will return a {@link java.util.Map}
      *       view over the given identifiers.</li>
@@ -130,9 +131,13 @@ public class ReferenceResolver {
      * SIS can not know if the metadata shall be fully marshalled or not.
      * Such information needs to be provided by the application.
      *
-     * <p>The default implementation conservatively returns {@code false} in every cases except for instances of
-     * {@link NilObject}, since the later exist only for carrying the {@code gco} and {@code xlink} attributes.
-     * Subclasses can override this method if they know whether the receiver will be able to resolve the reference.</p>
+     * <p>The default implementation returns {@code true} in the following cases:</p>
+     * <ul>
+     *   <li>If {@code object} implements {@link NilObject}.</li>
+     *   <li>If {@code object} implements {@link Emptiable} and its {@code isEmpty()} method returns {@code true}.</li>
+     * </ul>
+     *
+     * Subclasses can override this method if they know whether the receiver will be able to resolve the reference.
      *
      * @param  <T>     The compile-time type of the {@code type} argument.
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
@@ -144,7 +149,7 @@ public class ReferenceResolver {
      *         instead than marshalling the given metadata.
      */
     public <T> boolean canSubstituteByReference(final MarshalContext context, final Class<T> type, final T object, final UUID uuid) {
-        return (object instanceof NilObject);
+        return (object instanceof NilObject) || (object instanceof Emptiable && ((Emptiable) object).isEmpty());
     }
 
     /**
@@ -154,9 +159,13 @@ public class ReferenceResolver {
      * SIS can not know if the metadata shall be fully marshalled or not.
      * Such information needs to be provided by the application.
      *
-     * <p>The default implementation conservatively returns {@code false} in every cases except for instances of
-     * {@link NilObject}, since the later exist only for carrying the {@code gco} and {@code xlink} attributes.
-     * Subclasses can override this method if they know whether the receiver will be able to resolve the reference.</p>
+     * <p>The default implementation returns {@code true} in the following cases:</p>
+     * <ul>
+     *   <li>If {@code object} implements {@link NilObject}.</li>
+     *   <li>If {@code object} implements {@link Emptiable} and its {@code isEmpty()} method returns {@code true}.</li>
+     * </ul>
+     *
+     * Subclasses can override this method if they know whether the receiver will be able to resolve the reference.
      *
      * @param  <T>     The compile-time type of the {@code type} argument.
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
@@ -168,7 +177,7 @@ public class ReferenceResolver {
      *         instead than marshalling the given metadata.
      */
     public <T> boolean canSubstituteByReference(final MarshalContext context, final Class<T> type, final T object, final XLink link) {
-        return (object instanceof NilObject);
+        return (object instanceof NilObject) || (object instanceof Emptiable && ((Emptiable) object).isEmpty());
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -147,10 +147,11 @@ public final class XML extends Static {
 
     /**
      * Specifies the GML version of the document to be marshalled or unmarshalled.
-     * The GML version may affect the set of XML elements to be marshalled.
-     * Newer versions typically have more elements, but not always.
-     * For example in {@code gml:VerticalDatum}, the {@code gml:verticalDatumType} property
-     * presents in GML 3.0 and 3.1 has been removed in GML 3.2.
+     * The GML version may affect the set of XML elements to be marshalled and their namespaces.
+     *
+     * {@note Newer versions typically have more elements, but not always.
+     * For example in <code>gml:VerticalDatum</code>, the <code>gml:verticalDatumType</code> property
+     * presents in GML 3.0 and 3.1 has been removed in GML 3.2.}
      *
      * <p>The value can be {@link String} or {@link Version} objects.
      * If no version is specified, then the most recent GML version is assumed.</p>

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeTest.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeTest.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -56,14 +56,18 @@ public final strictfp class PropertyType
     }
 
     /**
-     * Creates a dummy XLink.
+     * Asserts that the given property has the given UUID value, which may be null.
+     * All other properties are expected to be null for this test.
      */
-    private static XLink createXLink() {
-        final XLink link = new XLink();
-        link.setShow(XLink.Show.REPLACE);
-        link.setActuate(XLink.Actuate.ON_LOAD);
-        link.setTitle(new SimpleInternationalString("myResult"));
-        return link;
+    private static void assertReferenceEqualsUUID(final String uuidref, final PropertyType<?,?> property) {
+        assertNull  ("nilReason",          property.getNilReason());
+        assertEquals("uuidref",   uuidref, property.getUUIDREF());
+        assertNull  ("href",               property.getHRef());
+        assertNull  ("role",               property.getRole());
+        assertNull  ("arcrole",            property.getArcRole());
+        assertNull  ("title",              property.getTitle());
+        assertNull  ("show",               property.getShow());
+        assertNull  ("actuate",            property.getActuate());
     }
 
     /**
@@ -75,69 +79,79 @@ public final strictfp class PropertyType
     public void testWithNoReference() throws Exception {
         final PropertyTypeMock property = marshal();
         assertSame(metadata, property.metadata);
-        assertNoReference(property);
+        assertReferenceEqualsUUID(null, property);
     }
 
     /**
-     * Asserts that the given property has no UUID, XLink or other references.
-     */
-    private static void assertNoReference(final PropertyType<?,?> property) {
-        assertNull ("nilReason", property.getNilReason());
-        assertNull ("uuidref",   property.getUUIDREF());
-        assertNull ("href",      property.getHRef());
-        assertNull ("role",      property.getRole());
-        assertNull ("arcrole",   property.getArcRole());
-        assertNull ("title",     property.getTitle());
-        assertNull ("show",      property.getShow());
-        assertNull ("actuate",   property.getActuate());
-        assertFalse("skip",      property.skip());
-    }
-
-    /**
-     * Tests the construction of an object containing {@code UUID} and {@code XLink} references,
-     * but in a context where the user didn't gave us the authorization to use them.
+     * Tests the construction of an object containing {@code UUID} reference,
+     * but in a context where the user didn't gave us the authorization to use it.
      *
      * @throws Exception Should never happen.
      */
     @Test
-    @DependsOnMethod({"testWithUUID", "testWithXLink"})
-    public void testWithDiscardedReferences() throws Exception {
-        final UUID  uuid = UUID.randomUUID();
-        final XLink link = createXLink();
-        metadata.getIdentifierMap().putSpecialized(IdentifierSpace.UUID,  uuid);
-        metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
-        final PropertyTypeMock property = marshal();
-        assertSame(metadata, property.metadata);
-        assertNoReference(property);
+    @DependsOnMethod("testWithUUID")
+    public void testWithDiscardedUUID() throws Exception {
+        testWithUUID(false);
     }
 
     /**
      * Tests the construction of an object containing a {@link UUID}.
-     * The {@code XLink} is allowed to replace the object definition in the XML to be marshalled.
+     * The {@code UUID} is allowed to replace the object definition in the XML to be marshalled.
      *
      * @throws Exception Should never happen.
      */
     @Test
     @DependsOnMethod("testWithNoReference")
     public void testWithUUID() throws Exception {
+        testWithUUID(true);
+    }
+
+    /**
+     * Implementation of the public {@code test*UUID()} methods.
+     *
+     * <ul>
+     *   <li>If {@code useReferenceResolverMock} is {@code false}, then this test behaves like
+     *       {@link #testWithNoReference()} because the default SIS behavior is to not replace
+     *       XML elements by their {@code uuidref} attributes, since SIS does not know if the
+     *       client who is going to read the XML file will be able to find object definitions
+     *       from their UUID.</li>
+     *
+     *   <li>If {@code useReferenceResolverMock} is {@code true}, then the metadata object shall be replaced
+     *       by the UUID because the {@link ReferenceResolverMock#canSubstituteByReference(MarshalContext,
+     *       Class, Object, UUID)} method returns {@code true}.</li>
+     * </ul>
+     */
+    private void testWithUUID(final boolean useReferenceResolverMock) throws Exception {
         final UUID uuid = UUID.randomUUID();
         metadata.getIdentifierMap().putSpecialized(IdentifierSpace.UUID, uuid);
-        context = ReferenceResolverMock.begin(true);
+        if (useReferenceResolverMock) {
+            context = ReferenceResolverMock.begin(true);
+            // XMLTestCase.clearContext() will dispose the context.
+        }
         final PropertyTypeMock property = marshal();
-        assertSame  (metadata,        property.metadata);
-        assertNull  ("nilReason",     property.getNilReason());
-        assertEquals(uuid.toString(), property.getUUIDREF());
-        assertNull  ("href",          property.getHRef());
-        assertNull  ("role",          property.getRole());
-        assertNull  ("arcrole",       property.getArcRole());
-        assertNull  ("title",         property.getTitle());
-        assertNull  ("show",          property.getShow());
-        assertNull  ("actuate",       property.getActuate());
-        assertTrue  ("skip",          property.skip());
+        if (!useReferenceResolverMock) {
+            assertSame(metadata, property.metadata);
+            assertReferenceEqualsUUID(null, property);
+        } else {
+            assertNull("metadata", property.metadata);
+            assertReferenceEqualsUUID(uuid.toString(), property);
+        }
     }
 
     /**
-     * Tests the construction of an object containing a {@link XLink}.
+     * Tests the construction of an object containing a {@link XLink} while keeping the metadata.
+     * The {@code XLink} is provided for information purpose.
+     *
+     * @throws Exception Should never happen.
+     */
+    @Test
+    @DependsOnMethod("testWithXLink")
+    public void testWithInformativeXLink() throws Exception {
+        testWithXLink(false);
+    }
+
+    /**
+     * Tests the construction of an object containing a {@link XLink} replacing the metadata.
      * The {@code XLink} is allowed to replace the object definition in the XML to be marshalled.
      *
      * @throws Exception Should never happen.
@@ -145,19 +159,44 @@ public final strictfp class PropertyType
     @Test
     @DependsOnMethod("testWithNoReference")
     public void testWithXLink() throws Exception {
-        final XLink link = createXLink();
+        testWithXLink(true);
+    }
+
+    /**
+     * Implementation of the public {@code test*XLink()} methods.
+     *
+     * <ul>
+     *   <li>If {@code useReferenceResolverMock} is {@code false}, then this test uses the default SIS behavior,
+     *       which is to not omit the metadata and still write the XLink for informative purpose.</li>
+     *
+     *   <li>If {@code useReferenceResolverMock} is {@code true}, then the metadata object shall be replaced
+     *       by the XLink because the {@link ReferenceResolverMock#canSubstituteByReference(MarshalContext,
+     *       Class, Object, Xlink)} method returns {@code true}.</li>
+     * </ul>
+     */
+    private void testWithXLink(final boolean useReferenceResolverMock) {
+        final XLink link = new XLink();
+        link.setShow(XLink.Show.REPLACE);
+        link.setActuate(XLink.Actuate.ON_LOAD);
+        link.setTitle(new SimpleInternationalString("myLinkTitle"));
         metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
-        context = ReferenceResolverMock.begin(true);
+        if (useReferenceResolverMock) {
+            context = ReferenceResolverMock.begin(true);
+            // XMLTestCase.clearContext() will dispose the context.
+        }
         final PropertyTypeMock property = marshal();
-        assertSame  (metadata,              property.metadata);
-        assertNull  ("nilReason",           property.getNilReason());
-        assertNull  ("uuidref",             property.getUUIDREF());
-        assertNull  ("href",                property.getHRef());
-        assertNull  ("role",                property.getRole());
-        assertNull  ("arcrole",             property.getArcRole());
-        assertEquals("myResult",            property.getTitle());
-        assertEquals(XLink.Show.REPLACE,    property.getShow());
-        assertEquals(XLink.Actuate.ON_LOAD, property.getActuate());
-        assertTrue  ("skip",                property.skip());
+        if (!useReferenceResolverMock) {
+            assertSame(metadata, property.metadata);
+        } else {
+            assertNull("metadata", property.metadata);
+        }
+        assertNull  ("nilReason",                      property.getNilReason());
+        assertNull  ("uuidref",                        property.getUUIDREF());
+        assertNull  ("href",                           property.getHRef());
+        assertNull  ("role",                           property.getRole());
+        assertNull  ("arcrole",                        property.getArcRole());
+        assertEquals("title",   "myLinkTitle",         property.getTitle());
+        assertEquals("show",    XLink.Show.REPLACE,    property.getShow());
+        assertEquals("actuate", XLink.Actuate.ON_LOAD, property.getActuate());
     }
 }

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/URIParserTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/URIParserTest.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/URIParserTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/URIParserTest.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.util;
 
+import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -32,6 +33,71 @@ import static org.junit.Assert.*;
  */
 public final strictfp class URIParserTest extends TestCase {
     /**
+     * Tests {@link URIParser#parse(String)} on {@code "urn:ogc:def:crs:EPSG:8.2:4326"}.
+     * This is a URN without parameters defined by EPSG.
+     */
+    @Test
+    public void testParse() {
+        assertNull(URIParser.parse("EPSG:4326"));
+
+        URIParser parsed = URIParser.parse(" urn:ogc:def: crs : EPSG: 8.2 :4326 ");
+        assertNotNull("URIParser", parsed);
+        assertEquals ("isHTTP",    false,   parsed.isHTTP);
+        assertEquals ("type",      "crs",   parsed.type);
+        assertEquals ("authority", "EPSG",  parsed.authority);
+        assertEquals ("version",   "8.2",   parsed.version);
+        assertEquals ("code",      "4326",  parsed.code);
+        assertNull   ("parameters",         parsed.parameters);
+        assertEquals ("toString()", "urn:ogc:def:crs:EPSG:8.2:4326", parsed.toString());
+
+        parsed = URIParser.parse("URN :X-OGC: Def:crs:EPSG::4326");
+        assertNotNull("URIParser", parsed);
+        assertEquals ("isHTTP",    false,   parsed.isHTTP);
+        assertEquals ("type",      "crs",   parsed.type);
+        assertEquals ("authority", "EPSG",  parsed.authority);
+        assertNull   ("version",            parsed.version);
+        assertEquals ("code",      "4326",  parsed.code);
+        assertNull   ("parameters",         parsed.parameters);
+        assertEquals ("toString()", "urn:ogc:def:crs:EPSG::4326", parsed.toString());
+    }
+
+    /**
+     * Tests {@link URIParser#parse(String)} on {@code "urn:ogc:def:crs:OGC:1.3:AUTO42003:1:-100:45"}.
+     * This is a URN with parameters defined in WMS specification.
+     */
+    @Test
+    @DependsOnMethod("testParse")
+    public void testParseWithParameters() {
+        final URIParser parsed = URIParser.parse("urn:ogc:def:crs:OGC:1.3:AUTO42003:1:-100:45");
+        assertNotNull("URIParser", parsed);
+        assertEquals ("isHTTP",    false,       parsed.isHTTP);
+        assertEquals ("type",      "crs",       parsed.type);
+        assertEquals ("authority", "OGC",       parsed.authority);
+        assertEquals ("version",   "1.3",       parsed.version);
+        assertEquals ("code",      "AUTO42003", parsed.code);
+        assertNotNull("parameters",             parsed.parameters);
+        assertArrayEquals("parameters", new String[] {"1", "-100", "45"}, parsed.parameters);
+        assertEquals("toString()", "urn:ogc:def:crs:OGC:1.3:AUTO42003:1:-100:45", parsed.toString());
+    }
+
+    /**
+     * Tests {@link URIParser#parse(String)} on {@code "http://www.opengis.net/gml/srs/epsg.xml#4326"}.
+     */
+    @Test
+    @DependsOnMethod("testParse")
+    public void testParseHTTP() {
+        final URIParser parsed = URIParser.parse("http://www.opengis.net/gml/srs/epsg.xml#4326");
+        assertNotNull("URIParser", parsed);
+        assertEquals ("isHTTP",    true,   parsed.isHTTP);
+        assertEquals ("type",      "crs",  parsed.type);
+        assertEquals ("authority", "epsg", parsed.authority);
+        assertNull   ("version",           parsed.version);
+        assertEquals ("code",      "4326", parsed.code);
+        assertNull   ("parameters",        parsed.parameters);
+        assertEquals ("toString()", "http://www.opengis.net/gml/srs/epsg.xml#4326", parsed.toString());
+    }
+
+    /**
      * Tests {@link URIParser#codeOf(String, String, String)} with URI like {@code "EPSG:4326"}.
      */
     @Test

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/ReferenceResolverMock.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/ReferenceResolverMock.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/ReferenceResolverMock.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/ReferenceResolverMock.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -53,8 +53,8 @@ public final strictfp class ReferenceRes
      *     }
      * }
      *
-     * Alternatively, the {@code finally} block can be replaced by a call to {@code context.finish()}
-     * in a method annotated by {@link org.junit.After}.
+     * Alternatively, the {@code finally} block can be replaced by a call to {@code context.finish()} in a method
+     * annotated by {@link org.junit.After}. This is done automatically by {@link org.apache.sis.test.XMLTestCase}.
      *
      * @param  marshalling {@code true} for marshalling, or {@code false} for unmarshalling.
      * @return The (un)marshalling context.
@@ -66,6 +66,8 @@ public final strictfp class ReferenceRes
 
     /**
      * Unconditionally returns {@code true}.
+     *
+     * @return {@code true}.
      */
     @Override
     public <T> boolean canSubstituteByReference(final MarshalContext context, final Class<T> type, final T object, final UUID uuid) {
@@ -74,6 +76,8 @@ public final strictfp class ReferenceRes
 
     /**
      * Unconditionally returns {@code true}.
+     *
+     * @return {@code true}.
      */
     @Override
     public <T> boolean canSubstituteByReference(final MarshalContext context, final Class<T> type, final T object, final XLink link) {

Modified: sis/trunk/ide-project/NetBeans/nbproject/project.xml
URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/nbproject/project.xml?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/nbproject/project.xml (original)
+++ sis/trunk/ide-project/NetBeans/nbproject/project.xml Sat Dec 14 00:15:36 2013
@@ -59,6 +59,7 @@
             <word>initially</word>
             <word>javadoc</word>
             <word>loggings</word>
+            <word>maintainance</word>
             <word>marshallable</word>
             <word>marshalled</word>
             <word>marshaller</word>

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java?rev=1550857&r1=1550856&r2=1550857&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java [UTF-8] Sat Dec 14 00:15:36 2013
@@ -19,7 +19,7 @@ package org.apache.sis.internal.storage.
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
-import org.apache.sis.xml.MetadataMarshallingTest;
+import org.apache.sis.metadata.iso.extent.DefaultExtentTest;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -65,8 +65,7 @@ public final strictfp class MimeTypeDete
     @Test
     @DependsOnMethod("testGMDFromString")
     public void testGMDFromInputStream() throws IOException {
-        final InputStream in = MetadataMarshallingTest.class.getResourceAsStream("Extent.xml");
-        assertNotNull("Can not read Extent.xml", in);
+        final InputStream in = DefaultExtentTest.getResource("Extent.xml").openStream();
         assertEquals('<', in.read());
         assertEquals('?', in.read());
         final MimeTypeDetector detector = new MimeTypeDetector() {



Mime
View raw message