sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1726717 [3/4] - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/s...
Date Tue, 26 Jan 2016 00:12:36 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -272,16 +272,16 @@ public class TransformSeparator {
      * Returns the input dimensions to keep or kept in the separated transform.
      * This method performs the first applicable action in the following list:
      *
-     * <ol>
-     *   <li><p>Source dimensions have been explicitly set by at least one call to {@link #addSourceDimensions(int...)}
+     * <ol class="verbose">
+     *   <li>Source dimensions have been explicitly set by at least one call to {@link #addSourceDimensions(int...)}
      *       or {@link #addSourceDimensionRange(int, int)} since construction or since last call to {@link #clear()}.
-     *       In such case, this method returns all specified source dimensions.</p></li>
+     *       In such case, this method returns all specified source dimensions.</li>
      *
-     *   <li><p>No source dimensions were set but {@link #separate()} has been invoked.
+     *   <li>No source dimensions were set but {@link #separate()} has been invoked.
      *       In such case, this method returns the sequence of source dimensions that {@code separate()} chooses to retain.
-     *       It is often, but not necessarily, all source dimensions of the transform given at construction time.</p></li>
+     *       It is often, but not necessarily, all source dimensions of the transform given at construction time.</li>
      *
-     *   <li><p>Otherwise an exception is thrown.</p></li>
+     *   <li>Otherwise an exception is thrown.</li>
      * </ol>
      *
      * @return The input dimension as a sequence of strictly increasing values.
@@ -333,16 +333,16 @@ public class TransformSeparator {
      * Returns the output dimensions to keep or kept in the separated transform.
      * This method performs the first applicable action in the following list:
      *
-     * <ol>
-     *   <li><p>Target dimensions have been explicitly set by at least one call to {@link #addTargetDimensions(int...)}
+     * <ol class="verbose">
+     *   <li>Target dimensions have been explicitly set by at least one call to {@link #addTargetDimensions(int...)}
      *       or {@link #addTargetDimensionRange(int, int)} since construction or since last call to {@link #clear()}.
-     *       In such case, this method returns all specified target dimensions.</p></li>
+     *       In such case, this method returns all specified target dimensions.</li>
      *
-     *   <li><p>No target dimensions were set but {@link #separate()} has been invoked.
+     *   <li>No target dimensions were set but {@link #separate()} has been invoked.
      *       In such case, the target dimensions are inferred automatically from the {@linkplain #getSourceDimensions()
-     *       source dimensions} and the transform.</p></li>
+     *       source dimensions} and the transform.</li>
      *
-     *   <li><p>Otherwise an exception is thrown.</p></li>
+     *   <li>Otherwise an exception is thrown.</li>
      * </ol>
      *
      * @return The output dimension as a sequence of strictly increasing values.
@@ -362,14 +362,14 @@ public class TransformSeparator {
      * source dimensions} and return only the {@linkplain #addTargetDimensions(int...) specified target dimensions}.
      * If the source or target dimensions were not specified, then they will be inferred as below:
      *
-     * <ul>
-     *   <li><p>If source dimensions were unspecified, then the returned transform will keep at least all source
+     * <ul class="verbose">
+     *   <li>If source dimensions were unspecified, then the returned transform will keep at least all source
      *       dimensions needed for computing the specified target dimensions. In many cases the returned transform
      *       unconditionally keep all source dimensions, but not necessarily. If all source dimensions need to be
-     *       kept, it is better to {@linkplain #addSourceDimensionRange(int, int) specify that explicitely}.</p></li>
+     *       kept, it is better to {@linkplain #addSourceDimensionRange(int, int) specify that explicitely}.</li>
      *
-     *   <li><p>If target dimensions were unspecified, then the returned transform will expect only the specified
-     *       source dimensions as inputs, and the target dimensions will be inferred automatically.</p></li>
+     *   <li>If target dimensions were unspecified, then the returned transform will expect only the specified
+     *       source dimensions as inputs, and the target dimensions will be inferred automatically.</li>
      * </ul>
      *
      * The source and target dimensions actually used can be queried by calls to {@link #getSourceDimensions()}
@@ -446,7 +446,7 @@ public class TransformSeparator {
      *
      * <p>Subclasses can override this method if they need to handle some {@code MathTransform} implementations
      * in a special way. However all implementations of this method shall obey to the following contract:</p>
-     * <ul>
+     * <ul class="verbose">
      *   <li>{@link #sourceDimensions} and {@link #targetDimensions} should not be assumed accurate
      *       since they may be temporarily outdated or modified during recursive calls to this method.</li>
      *   <li>{@link #sourceDimensions} should not be modified by this method.</li>

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -22,6 +22,10 @@ import org.opengis.referencing.crs.Singl
 import org.opengis.util.FactoryException;
 import org.apache.sis.referencing.crs.DefaultCompoundCRS;
 import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.Utilities;
+
+// Test imports
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -35,7 +39,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.7
  * @module
  */
 @DependsOn({
@@ -46,7 +50,7 @@ public final strictfp class CRSTest exte
      * Asserts that the result of {@link CRS#forCode(String)} is the given CRS.
      */
     private static void verifyForCode(final SingleCRS expected, final String code) throws FactoryException {
-        assertSame(code, expected, CRS.forCode(code));
+        assertTrue(code, Utilities.deepEquals(expected, CRS.forCode(code), ComparisonMode.IGNORE_METADATA));
     }
 
     /**
@@ -74,7 +78,13 @@ public final strictfp class CRSTest exte
         verifyForCode(CommonCRS.WGS72 .geographic3D(), "EPSG:4985");
         verifyForCode(CommonCRS.ETRS89.geographic3D(), "EPSG:4937");
         verifyForCode(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(), "EPSG:5714");
-        verifyForCode(CommonCRS.Vertical.DEPTH.crs(), "EPSG:5715");
+        /*
+         * Following test is skipped when using the EPSG factory because EPSG uses
+         * the "Gravity-related depth" axis name while ISO 19111 mandates "Depth".
+         */
+        if (AuthorityFactories.EPSG() instanceof EPSGFactoryFallback) {
+            verifyForCode(CommonCRS.Vertical.DEPTH.crs(), "EPSG:5715");
+        }
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -18,8 +18,6 @@ package org.apache.sis.referencing;
 
 import java.util.Date;
 import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.util.FactoryException;
-import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.GeographicCRS;
@@ -222,43 +220,4 @@ public final strictfp class CommonCRSTes
         assertSame("Expected a cached instance.", crs, CommonCRS.WGS72.UTM(-45, -122));
         assertNotSame("Expected a new instance.", crs, CommonCRS.WGS72.UTM(+45, -122));
     }
-
-    /**
-     * Tests {@link CommonCRS#forCode(String, String, FactoryException)}.
-     *
-     * @throws FactoryException If a CRS can not be constructed.
-     *
-     * @see CRSTest#testForEpsgCode()
-     * @see CRSTest#testForCrsCode()
-     *
-     * @since 0.5
-     */
-    @Test
-    public void testForCode() throws FactoryException {
-        verifyForCode(CommonCRS.WGS84 .geographic(),            Constants.EPSG, "4326");
-        verifyForCode(CommonCRS.WGS72 .geographic(),            Constants.EPSG, "4322");
-        verifyForCode(CommonCRS.SPHERE.geographic(),            Constants.EPSG, "4047");
-        verifyForCode(CommonCRS.NAD83 .geographic(),            Constants.EPSG, "4269");
-        verifyForCode(CommonCRS.NAD27 .geographic(),            Constants.EPSG, "4267");
-        verifyForCode(CommonCRS.ETRS89.geographic(),            Constants.EPSG, "4258");
-        verifyForCode(CommonCRS.ED50  .geographic(),            Constants.EPSG, "4230");
-        verifyForCode(CommonCRS.WGS84 .geocentric(),            Constants.EPSG, "4978");
-        verifyForCode(CommonCRS.WGS72 .geocentric(),            Constants.EPSG, "4984");
-        verifyForCode(CommonCRS.ETRS89.geocentric(),            Constants.EPSG, "4936");
-        verifyForCode(CommonCRS.WGS84 .geographic3D(),          Constants.EPSG, "4979");
-        verifyForCode(CommonCRS.WGS72 .geographic3D(),          Constants.EPSG, "4985");
-        verifyForCode(CommonCRS.ETRS89.geographic3D(),          Constants.EPSG, "4937");
-        verifyForCode(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(),  Constants.EPSG, "5714");
-        verifyForCode(CommonCRS.Vertical.DEPTH.crs(),           Constants.EPSG, "5715");
-        verifyForCode(CommonCRS.WGS84.normalizedGeographic(),   Constants.CRS,  "84");
-        verifyForCode(CommonCRS.NAD83.normalizedGeographic(),   Constants.CRS,  "83");
-        verifyForCode(CommonCRS.NAD27.normalizedGeographic(),   Constants.CRS,  "27");
-    }
-
-    /**
-     * Asserts that the result of {@link CommonCRS#forCode(String, String, FactoryException)} is the given CRS.
-     */
-    private static void verifyForCode(final SingleCRS expected, final String authority, final String code) throws FactoryException {
-        assertSame(code, expected, CommonCRS.forCode(authority, code, null));
-    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -32,7 +32,7 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.internal.util.Constants;
 
 // Test dependencies
-import org.apache.sis.test.mock.GeodeticDatumMock;
+import org.apache.sis.referencing.datum.GeodeticDatumMock;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -194,7 +194,7 @@ public final strictfp class StandardDefi
         crs = StandardDefinitions.createVerticalCRS(CommonCRS.Vertical.NAVD88.crs, datum);
         assertEquals("name", "NAVD88 height", crs.getName().getCode());
         assertEquals("identifier", "5703", IdentifiedObjects.getIdentifier(crs, Citations.EPSG).getCode());
-        assertEquals("identifier",   "88", IdentifiedObjects.getIdentifier(crs, Citations.OGC ).getCode());
+        assertEquals("identifier",   "88", IdentifiedObjects.getIdentifier(crs, Citations.WMS ).getCode());
         assertEquals("direction", AxisDirection.UP, crs.getCoordinateSystem().getAxis(0).getDirection());
 
         datum = StandardDefinitions.createVerticalDatum(CommonCRS.Vertical.MEAN_SEA_LEVEL.datum);

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -30,7 +30,6 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
-import static org.apache.sis.test.mock.GeodeticDatumMock.WGS84;
 
 
 /**
@@ -52,7 +51,7 @@ public final strictfp class BursaWolfPar
      * Area of validity is the World.
      */
     static BursaWolfParameters createWGS72_to_WGS84() {
-        final BursaWolfParameters bursaWolf = new BursaWolfParameters(WGS84, Extents.WORLD);
+        final BursaWolfParameters bursaWolf = new BursaWolfParameters(GeodeticDatumMock.WGS84, Extents.WORLD);
         bursaWolf.tZ = 4.5;
         bursaWolf.rZ = 0.554;
         bursaWolf.dS = 0.219;
@@ -67,7 +66,7 @@ public final strictfp class BursaWolfPar
      * Area of validity is the North Sea: 5.05°W to 11.13°E in longitude and 51.04°N to 62.0°N in latitude.
      */
     static BursaWolfParameters createED87_to_WGS84() {
-        final BursaWolfParameters bursaWolf = new BursaWolfParameters(WGS84, new DefaultExtent("Europe - North Sea",
+        final BursaWolfParameters bursaWolf = new BursaWolfParameters(GeodeticDatumMock.WGS84, new DefaultExtent("Europe - North Sea",
                 new DefaultGeographicBoundingBox(-5.05, 11.13, 51.04, 62.0), null, null));
         bursaWolf.tX =  -82.981;
         bursaWolf.tY =  -99.719;
@@ -88,7 +87,7 @@ public final strictfp class BursaWolfPar
      * This transformation uses only translation parameters.
      */
     static BursaWolfParameters createNTF_to_WGS84() {
-        final BursaWolfParameters bursaWolf = new BursaWolfParameters(WGS84, Extents.WORLD);
+        final BursaWolfParameters bursaWolf = new BursaWolfParameters(GeodeticDatumMock.WGS84, Extents.WORLD);
         bursaWolf.tX = -168;
         bursaWolf.tY =  -60;
         bursaWolf.tZ =  320;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -22,7 +22,6 @@ import javax.measure.unit.NonSI;
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -37,7 +37,6 @@ import org.apache.sis.test.TestStep;
 import org.junit.Test;
 
 import static org.apache.sis.test.MetadataAssert.*;
-import static org.apache.sis.test.mock.GeodeticDatumMock.*;
 import static org.apache.sis.referencing.GeodeticObjectVerifier.*;
 
 
@@ -105,7 +104,7 @@ public final strictfp class DefaultGeode
      */
     @Test
     public void testIsHeuristicMatchForName() {
-        final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(WGS84);
+        final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(GeodeticDatumMock.WGS84);
         assertFalse(datum.isHeuristicMatchForName("WGS72"));
         assertTrue (datum.isHeuristicMatchForName("WGS84"));
         assertTrue (datum.isHeuristicMatchForName("WGS 84"));
@@ -136,28 +135,29 @@ public final strictfp class DefaultGeode
          * Build the datum using WGS 72 ellipsoid (so at least one of the BursaWolfParameters is real).
          */
         final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(properties,
-                WGS72.getEllipsoid(), WGS72.getPrimeMeridian());
+                GeodeticDatumMock.WGS72.getEllipsoid(),
+                GeodeticDatumMock.WGS72.getPrimeMeridian());
         /*
          * Search for BursaWolfParameters around the North Sea area.
          */
         final DefaultGeographicBoundingBox areaOfInterest = new DefaultGeographicBoundingBox(-2, 8, 55, 60);
         final DefaultExtent extent = new DefaultExtent("Around the North Sea", areaOfInterest, null, null);
-        Matrix matrix = datum.getPositionVectorTransformation(NAD83, extent);
+        Matrix matrix = datum.getPositionVectorTransformation(GeodeticDatumMock.NAD83, extent);
         assertNull("No BursaWolfParameters for NAD83", matrix);
-        matrix = datum.getPositionVectorTransformation(WGS84, extent);
+        matrix = datum.getPositionVectorTransformation(GeodeticDatumMock.WGS84, extent);
         assertNotNull("BursaWolfParameters for WGS84", matrix);
         checkTransformationSignature(local, matrix, 0);
         /*
          * Expand the area of interest to something greater than North Sea, and test again.
          */
         areaOfInterest.setWestBoundLongitude(-8);
-        matrix = datum.getPositionVectorTransformation(WGS84, extent);
+        matrix = datum.getPositionVectorTransformation(GeodeticDatumMock.WGS84, extent);
         assertNotNull("BursaWolfParameters for WGS84", matrix);
         checkTransformationSignature(global, matrix, 0);
         /*
          * Search in the reverse direction.
          */
-        final DefaultGeodeticDatum targetDatum = new DefaultGeodeticDatum(WGS84);
+        final DefaultGeodeticDatum targetDatum = new DefaultGeodeticDatum(GeodeticDatumMock.WGS84);
         matrix = targetDatum.getPositionVectorTransformation(datum, extent);
         global.invert(); // Expected result is the inverse.
         checkTransformationSignature(global, matrix, 1E-6);
@@ -182,7 +182,7 @@ public final strictfp class DefaultGeode
      */
     @Test
     public void testToWKT() {
-        final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(WGS84);
+        final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(GeodeticDatumMock.WGS84);
         assertWktEquals(Convention.WKT2,
                 "DATUM[“WGS84”,\n" +
                 "  ELLIPSOID[“WGS84”, 6378137.0, 298.257223563, LENGTHUNIT[“metre”, 1]]]",
@@ -222,7 +222,7 @@ public final strictfp class DefaultGeode
                 "    </gml:Ellipsoid>\n" +
                 "  </gml:ellipsoid>\n" +
                 "</gml:GeodeticDatum>",
-                marshal(new DefaultGeodeticDatum(WGS84)), "xmlns:*");
+                marshal(new DefaultGeodeticDatum(GeodeticDatumMock.WGS84)), "xmlns:*");
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -36,7 +36,6 @@ import org.junit.Test;
 import static java.util.Collections.singletonMap;
 import static org.apache.sis.test.MetadataAssert.*;
 import static org.apache.sis.referencing.GeodeticObjectVerifier.*;
-import static org.apache.sis.test.mock.PrimeMeridianMock.GREENWICH;
 
 
 /**
@@ -59,7 +58,7 @@ public final strictfp class DefaultPrime
      */
     @Test
     public void testToWKT() {
-        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(GREENWICH);
+        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(PrimeMeridianMock.GREENWICH);
         assertIsGreenwich(pm);
         assertWktEquals(Convention.WKT2, "PRIMEM[“Greenwich”, 0.0, ANGLEUNIT[“degree”, 0.017453292519943295]]", pm);
         assertWktEquals(Convention.WKT2_SIMPLIFIED, "PrimeMeridian[“Greenwich”, 0.0]", pm);
@@ -123,7 +122,7 @@ public final strictfp class DefaultPrime
      */
     @Test
     public void testMarshall() throws JAXBException {
-        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(GREENWICH);
+        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(PrimeMeridianMock.GREENWICH);
         assertXmlEquals(getGreenwichXml(Namespaces.GML), marshal(pm), "xmlns:*");
     }
 
@@ -135,7 +134,7 @@ public final strictfp class DefaultPrime
     @Test
     @DependsOnMethod("testMarshall")
     public void testMarshallGML31() throws JAXBException {
-        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(GREENWICH);
+        final DefaultPrimeMeridian pm = new DefaultPrimeMeridian(PrimeMeridianMock.GREENWICH);
         final MarshallerPool pool = getMarshallerPool();
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.setProperty(XML.GML_VERSION, LegacyNamespaces.VERSION_3_0);

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -23,7 +23,6 @@ import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
 import org.opengis.referencing.datum.PixelInCell;
 import org.opengis.referencing.datum.VerticalDatumType;
-import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.internal.metadata.VerticalDatumTypes;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -28,7 +28,6 @@ import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
 import static org.apache.sis.test.TestUtilities.date;
-import static org.apache.sis.test.mock.GeodeticDatumMock.WGS84;
 import static org.apache.sis.internal.referencing.Formulas.JULIAN_YEAR_LENGTH;
 
 
@@ -48,7 +47,7 @@ public final strictfp class TimeDependen
      * For the purpose of this test, the target datum does not matter anyway.
      */
     private static TimeDependentBWP create() {
-        final TimeDependentBWP p = new TimeDependentBWP(WGS84, null, date("1994-01-01 00:00:00"));
+        final TimeDependentBWP p = new TimeDependentBWP(GeodeticDatumMock.WGS84, null, date("1994-01-01 00:00:00"));
         p.tX = -0.08468;    p.dtX = +1.42;
         p.tY = -0.01942;    p.dtY = +1.34;
         p.tZ = +0.03201;    p.dtZ = +0.90;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryProxyTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryProxyTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryProxyTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryProxyTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -21,10 +21,16 @@ import org.opengis.referencing.Identifie
 import org.opengis.referencing.AuthorityFactory;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.crs.*;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.datum.PrimeMeridian;
+import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.datum.Datum;
 import org.apache.sis.referencing.datum.DefaultGeodeticDatum;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.DefaultProjectedCRS;
 import org.apache.sis.referencing.crs.DefaultDerivedCRS;
+import org.apache.sis.referencing.crs.AbstractCRS;
 
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -61,13 +67,36 @@ public final strictfp class AuthorityFac
      * Tests {@link AuthorityFactoryProxy#getInstance(Class)}.
      */
     @Test
-    public void testType() {
-        assertEquals(ProjectedCRS.class,  AuthorityFactoryProxy.getInstance(ProjectedCRS.class)        .type);
-        assertEquals(ProjectedCRS.class,  AuthorityFactoryProxy.getInstance(DefaultProjectedCRS.class) .type);
-        assertEquals(GeographicCRS.class, AuthorityFactoryProxy.getInstance(GeographicCRS.class)       .type);
-        assertEquals(GeographicCRS.class, AuthorityFactoryProxy.getInstance(DefaultGeographicCRS.class).type);
-        assertEquals(DerivedCRS.class,    AuthorityFactoryProxy.getInstance(DefaultDerivedCRS.class)   .type);
-        assertEquals(GeodeticDatum.class, AuthorityFactoryProxy.getInstance(DefaultGeodeticDatum.class).type);
+    public void testGetInstance() {
+        assertEquals(ProjectedCRS.class,              AuthorityFactoryProxy.getInstance(ProjectedCRS.class)        .type);
+        assertEquals(ProjectedCRS.class,              AuthorityFactoryProxy.getInstance(DefaultProjectedCRS.class) .type);
+        assertEquals(GeographicCRS.class,             AuthorityFactoryProxy.getInstance(GeographicCRS.class)       .type);
+        assertEquals(GeographicCRS.class,             AuthorityFactoryProxy.getInstance(DefaultGeographicCRS.class).type);
+        assertEquals(DerivedCRS.class,                AuthorityFactoryProxy.getInstance(DefaultDerivedCRS.class)   .type);
+        assertEquals(GeodeticDatum.class,             AuthorityFactoryProxy.getInstance(DefaultGeodeticDatum.class).type);
+        assertEquals(CoordinateReferenceSystem.class, AuthorityFactoryProxy.getInstance(AbstractCRS.class)         .type);
+        assertEquals(CoordinateSystem.class,          AuthorityFactoryProxy.getInstance(CoordinateSystem.class)    .type);
+        assertEquals(CoordinateSystemAxis.class,      AuthorityFactoryProxy.getInstance(CoordinateSystemAxis.class).type);
+        assertEquals(PrimeMeridian.class,             AuthorityFactoryProxy.getInstance(PrimeMeridian.class)       .type);
+        assertEquals(Ellipsoid.class,                 AuthorityFactoryProxy.getInstance(Ellipsoid.class)           .type);
+        assertEquals(Datum.class,                     AuthorityFactoryProxy.getInstance(Datum.class)               .type);
+    }
+
+    /**
+     * Tests {@link AuthorityFactoryProxy#specialize(String)}.
+     */
+    @Test
+    public void testSpecialize() {
+        final AuthorityFactoryProxy<IdentifiedObject> base = AuthorityFactoryProxy.OBJECT;
+        assertEquals(CoordinateReferenceSystem.class, base.specialize("CRS")      .type);
+        assertEquals(CoordinateSystem.class,          base.specialize("CS")       .type);
+        assertEquals(CoordinateSystemAxis.class,      base.specialize("aXis")     .type);
+        assertEquals(PrimeMeridian.class,             base.specialize("Meridian") .type);
+        assertEquals(Ellipsoid.class,                 base.specialize("ellipsoid").type);
+        assertEquals(Datum.class,                     base.specialize("datum")    .type);
+
+        assertEquals(GeodeticDatum.class, AuthorityFactoryProxy.GEODETIC_DATUM.specialize("datum").type);
+        assertNull(AuthorityFactoryProxy.COORDINATE_SYSTEM.specialize("datum"));
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -112,12 +112,10 @@ public final strictfp class CommonAuthor
     @Test
     public void testAuthority() {
         final Citation authority = factory.getAuthority();
-        assertFalse(Citations.identifierMatches(authority, "CRS"));
-        assertTrue (Citations.identifierMatches(authority, "OGC"));
+        assertTrue (Citations.identifierMatches(authority, "WMS"));
         assertFalse(Citations.identifierMatches(authority, "OGP"));
         assertFalse(Citations.identifierMatches(authority, "EPSG"));
-        assertFalse(Citations.identifierMatches(authority, "AUTO"));
-        assertFalse(Citations.identifierMatches(authority, "AUTO2"));
+        assertEquals(Constants.OGC, org.apache.sis.internal.util.Citations.getCodeSpace(authority));
     }
 
     /**
@@ -355,6 +353,15 @@ public final strictfp class CommonAuthor
                 "    ANGLEUNIT[“degree”, 0.017453292519943295],\n" +
                 "  AREA[“World”],\n" +
                 "  BBOX[-90.00, -180.00, 90.00, 180.00],\n" +
-                "  ID[“CRS”, 84, CITATION[“OGC”]]]", crs);
+                "  ID[“CRS”, 84, CITATION[“OGC:WMS”], URI[“urn:ogc:def:crs:OGC:1.3:CRS84”]]]", crs);
+        /*
+         * Note: the WKT specification defines the ID element as:
+         *
+         *     ID[authority, code, (version), (authority citation), (URI)]
+         *
+         * where everything after the code is optional. The difference between "authority" and "authority citation"
+         * is unclear. The only example found in OGC 12-063r5 uses CITATION[…] as the source of an EPSG definition
+         * (so we could almost said "the authority of the authority").
+         */
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -23,7 +23,7 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.provider.Equirectangular;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.referencing.operation.transform.CoordinateDomain;
-import org.apache.sis.test.mock.MathTransformFactoryMock;
+import org.apache.sis.referencing.operation.transform.MathTransformFactoryMock;
 import org.apache.sis.test.ReferencingAssert;
 import org.junit.Test;
 

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -27,8 +27,8 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 import org.apache.sis.referencing.operation.transform.CoordinateDomain;
 import org.apache.sis.referencing.operation.transform.MathTransformTestCase;
-import org.apache.sis.test.mock.MathTransformFactoryMock;
-import org.apache.sis.test.mock.GeodeticDatumMock;
+import org.apache.sis.referencing.operation.transform.MathTransformFactoryMock;
+import org.apache.sis.referencing.datum.GeodeticDatumMock;
 
 import static java.lang.StrictMath.*;
 import static org.junit.Assert.*;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/NoOp.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -21,11 +21,11 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.operation.Matrix;
+import org.apache.sis.referencing.datum.GeodeticDatumMock;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.parameter.Parameters;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.util.Workaround;
 
 

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -26,10 +26,10 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.provider.PolarStereographicNorth;
 import org.apache.sis.internal.referencing.provider.PolarStereographicSouth;
 import org.apache.sis.referencing.operation.transform.CoordinateDomain;
+import org.apache.sis.referencing.operation.transform.MathTransformFactoryMock;
 import org.apache.sis.parameter.Parameters;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.test.mock.MathTransformFactoryMock;
 import org.junit.Test;
 
 import static java.lang.StrictMath.*;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -24,7 +24,7 @@ import static java.lang.StrictMath.*;
 import static org.apache.sis.internal.metadata.ReferencingServices.AUTHALIC_RADIUS;
 
 // Test imports
-import org.apache.sis.test.mock.GeodeticDatumMock;
+import org.apache.sis.referencing.datum.GeodeticDatumMock;
 
 
 /**

Copied: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java (from r1726714, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java?p2=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java&p1=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java&r1=1726714&r2=1726717&rev=1726717&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformFactoryMock.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -66,7 +66,7 @@ public final strictfp class MathTransfor
      */
     @Override
     public Set<OperationMethod> getAvailableMethods(Class<? extends SingleOperation> type) {
-        return type.isInstance(method) ? Collections.singleton(method) : Collections.emptySet();
+        return type.isInstance(method) ? Collections.<OperationMethod>singleton(method) : Collections.<OperationMethod>emptySet();
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -40,7 +40,6 @@ import static org.apache.sis.internal.me
 import org.apache.sis.internal.referencing.provider.FranceGeocentricInterpolationTest;
 import org.apache.sis.internal.referencing.provider.GeocentricTranslationTest;
 import org.apache.sis.referencing.datum.HardCodedDatum;
-import org.apache.sis.test.mock.MathTransformFactoryMock;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestUtilities;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -170,6 +170,7 @@ import org.junit.BeforeClass;
 
     org.apache.sis.referencing.StandardDefinitionsTest.class,
     org.apache.sis.referencing.CommonCRSTest.class,
+    org.apache.sis.referencing.EPSGFactoryFallbackTest.class,
     org.apache.sis.referencing.CRSTest.class,
     org.apache.sis.referencing.factory.GIGS3002.class,
     org.apache.sis.referencing.factory.GIGS3003.class,
@@ -179,6 +180,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.factory.CommonAuthorityFactoryTest.class,
     org.apache.sis.referencing.factory.AuthorityFactoryProxyTest.class,
     org.apache.sis.referencing.factory.IdentifiedObjectFinderTest.class,
+    org.apache.sis.referencing.factory.MultiAuthoritiesFactoryTest.class,
     org.apache.sis.referencing.factory.GIGS2001.class,
     org.apache.sis.referencing.factory.GIGS2002.class,
     org.apache.sis.referencing.factory.GIGS2003.class,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -23,7 +23,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.AbstractSet;
 import java.util.AbstractMap;
 import java.util.NoSuchElementException;
 import java.io.Serializable;
@@ -33,6 +32,7 @@ import org.apache.sis.util.Debug;
 import org.apache.sis.xml.XLink;
 import org.apache.sis.xml.IdentifierMap;
 import org.apache.sis.xml.IdentifierSpace;
+import org.apache.sis.internal.util.SetOfUnknownSize;
 
 import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
@@ -358,7 +358,7 @@ public class IdentifierMapAdapter extend
          * fields if the underlying list is thread-safe. Furthermore, IdentifierMapAdapter are temporary
          * objects anyway in the current ISOMetadata implementation.
          */
-        return new AbstractSet<Entry<Citation,String>>() {
+        return new SetOfUnknownSize<Entry<Citation,String>>() {
             /** Delegates to the enclosing class. */
             @Override public void clear() throws UnsupportedOperationException {
                 IdentifierMapAdapter.this.clear();

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/CitationConstant.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/CitationConstant.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/CitationConstant.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/CitationConstant.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -40,7 +40,7 @@ import org.apache.sis.internal.util.Meta
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  *
  * @see IdentifierSpace
@@ -82,7 +82,7 @@ public class CitationConstant extends Si
          * </ul>
          */
         @Override
-        public final String getName() {
+        public String getName() {
             return title;
         }
 
@@ -92,7 +92,7 @@ public class CitationConstant extends Si
         @Debug
         @Override
         public final String toString() {
-            return "IdentifierSpace[“" + getName() + "”]";
+            return "IdentifierSpace[" + title + ']';
         }
     }
 
@@ -136,7 +136,8 @@ public class CitationConstant extends Si
                 if (c == null) {
                     c = MetadataServices.getInstance().createCitation(title);
                     if (c == null) {
-                        // 'sis-metadata' module not on the classpath (should be very rare).
+                        // 'sis-metadata' module not on the classpath (should be very rare)
+                        // or no citation defined for the given primary key.
                         c = new SimpleCitation(title);
                     }
                     delegate = c;
@@ -173,7 +174,15 @@ public class CitationConstant extends Si
      * @return The instance to use, as an unique instance if possible.
      */
     protected Object readResolve() {
-        final Citation c = MetadataServices.getInstance().getCitationConstant(title);
-        return (c != null) ? c : this;
+        CitationConstant c = MetadataServices.getInstance().getCitationConstant(title);
+        if (c == null) {
+            /*
+             * Should happen only if the sis-metadata module is not on the classpath (should be rare)
+             * or if the Citation has been serialized on a more recent version of Apache SIS than the
+             * current version.
+             */
+            c = this;
+        }
+        return c;
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -102,9 +102,9 @@ public class SimpleIdentifier implements
     }
 
     /**
-     * Returns the name or identifier of the person or organization responsible for namespace,
-     * or {@code null} if none. The default implementation returns the shortest identifier of
-     * the {@linkplain #getAuthority() authority}, if any.
+     * Returns the identifier or namespace in which the code is valid, or {@code null} if none.
+     * The default implementation returns the shortest identifier of the {@linkplain #getAuthority() authority},
+     * if any.
      *
      * @return A code space inferred from the authority given at construction time, or {@code null} if none.
      */

Copied: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java (from r1726714, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java?p2=sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java&p1=sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java&r1=1726714&r2=1726717&rev=1726717&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractIterator.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -63,4 +63,12 @@ public abstract class AbstractIterator<E
         next = null;
         return value;
     }
+
+    /**
+     * Unsupported by default.
+     */
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractMap.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractMap.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/AbstractMap.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -21,7 +21,6 @@ import java.util.Set;
 import java.util.Iterator;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.AbstractSet;
 import java.util.AbstractCollection;
 import java.util.NoSuchElementException;
 import org.apache.sis.io.TableAppender;
@@ -69,7 +68,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public abstract class AbstractMap<K,V> implements Map<K,V> {
@@ -363,7 +362,7 @@ public abstract class AbstractMap<K,V> i
      */
     @Override
     public Set<K> keySet() {
-        return new AbstractSet<K>() {
+        return new SetOfUnknownSize<K>() {
             @Override public void        clear()            {       AbstractMap.this.clear();}
             @Override public boolean     isEmpty()          {return AbstractMap.this.isEmpty();}
             @Override public int         size()             {return AbstractMap.this.size();}
@@ -434,7 +433,7 @@ public abstract class AbstractMap<K,V> i
      */
     @Override
     public Set<Entry<K,V>> entrySet() {
-        return new AbstractSet<Entry<K,V>>() {
+        return new SetOfUnknownSize<Entry<K,V>>() {
             @Override public void    clear()   {       AbstractMap.this.clear();}
             @Override public boolean isEmpty() {return AbstractMap.this.isEmpty();}
             @Override public int     size()    {return AbstractMap.this.size();}

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -41,7 +41,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final class Citations extends Static {
@@ -106,7 +106,7 @@ public final class Citations extends Sta
      *
      * @param  s1 The first characters sequence to compare, or {@code null}.
      * @param  s2 The second characters sequence to compare, or {@code null}.
-     * @return {@code true}if both arguments are {@code null} or if the two given texts are equal,
+     * @return {@code true} if both arguments are {@code null} or if the two given texts are equal,
      *         ignoring case and any characters other than digits and letters.
      *
      * @since 0.6
@@ -139,7 +139,7 @@ public final class Citations extends Sta
                         return true;
                     }
                     final String localized = candidate.toString();
-                    if (!Objects.equals(localized, unlocalized) // Slight optimization for a common case.
+                    if (!Objects.equals(localized, unlocalized)             // Slight optimization for a common case.
                             && titleMatches(c1, localized))
                     {
                         return true;
@@ -178,7 +178,7 @@ public final class Citations extends Sta
                         return true;
                     }
                     final String localized = candidate.toString();
-                    if (!Objects.equals(localized, unlocalized) // Slight optimization for a common case.
+                    if (!Objects.equals(localized, unlocalized)             // Slight optimization for a common case.
                             && equalsFiltered(localized, title))
                     {
                         return true;
@@ -209,7 +209,7 @@ public final class Citations extends Sta
     public static boolean identifierMatches(Citation c1, Citation c2) {
         if (c1 != null && c2 != null) {
             if (c1 == c2) {
-                return true; // Optimisation for a common case.
+                return true;                            // Optimisation for a common case.
             }
             /*
              * If there is no identifier in both citations, fallback on title comparisons.
@@ -369,9 +369,9 @@ public final class Citations extends Sta
                     final String candidate = CharSequences.trimWhitespaces(id.getCode());
                     if (candidate != null && !candidate.isEmpty()) {
                         /*
-                         * For a non-empty identifier. Verify if both the code ans its codespace are valid
-                         * Unicode identifiers. If a codespace exist, the code does not need to begin with
-                         * a "Unicode identifier start" (it may be a "Unicode identifier part").
+                         * For a non-empty identifier, verify if both the code and its codespace are valid
+                         * Unicode identifiers. If a codespace exists, then the code does not need to begin
+                         * with a "Unicode identifier start" (it may be a "Unicode identifier part").
                          */
                         String cs = CharSequences.trimWhitespaces(id.getCodeSpace());
                         if (cs == null || cs.isEmpty()) {
@@ -381,7 +381,11 @@ public final class Citations extends Sta
                             isUnicode = CharSequences.isUnicodeIdentifier(cs);
                             if (isUnicode) for (int i = 0; i < candidate.length();) {
                                 final int c = candidate.codePointAt(i);
-                                if (!Character.isUnicodeIdentifierPart(c)) {
+                                if (!Character.isUnicodeIdentifierPart(c) &&
+                                        (strict || (c != '.' && c != '-')))
+                                {
+                                    // Above special case for '.' and '-' characters is documented
+                                    // in the public Citations.getIdentifier(Citation) method.
                                     isUnicode = false;
                                     break;
                                 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -19,6 +19,7 @@ package org.apache.sis.internal.util;
 import java.util.Map;
 import java.util.Collections;
 
+import org.apache.sis.util.CharSequences;
 import static org.apache.sis.util.CharSequences.*;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.internal.util.Utilities.appendUnicodeIdentifier;
@@ -35,9 +36,16 @@ import static org.apache.sis.internal.ut
  *   <li>{@code "urn:ogc:def:crs:EPSG::4326"} (version number is omitted)</li>
  *   <li>{@code "urn:ogc:def:crs:EPSG:8.2:4326"} (explicit version number, here 8.2)</li>
  *   <li>{@code "urn:x-ogc:def:crs:EPSG::4326"} (prior registration of {@code "ogc"} to IANA)</li>
+ *   <li>{@code "http://www.opengis.net/def/crs/EPSG/0/4326"}</li>
  *   <li>{@code "http://www.opengis.net/gml/srs/epsg.xml#4326"}</li>
  * </ul>
  *
+ * This class does not attempt to decode URL characters. For example a URL for "m/s" may be encoded as below,
+ * in which case the value in the {@code #code} field will be {@code "m%2Fs"} instead of {@code "m/s"}.
+ * <ul>
+ *   <li>{@code http://www.opengis.net/def/uom/SI/0/m%2Fs}</li>
+ * </ul>
+ *
  * <div class="section">Components or URN</div>
  * URN begins with {@code "urn:ogc:def:"} (formerly {@code "urn:x-ogc:def:"}) followed by:
  * <ul>
@@ -105,7 +113,7 @@ import static org.apache.sis.internal.ut
  */
 public final class DefinitionURI {
     /**
-     * The {@value} prefix used in all URI supported by this class.
+     * The {@value} prefix used in all URN supported by this class.
      */
     public static final String PREFIX = "urn:ogc:def";
 
@@ -115,22 +123,39 @@ public final class DefinitionURI {
     public static final char SEPARATOR = ':';
 
     /**
+     * The domain of URLs in the OGC namespace.
+     */
+    private static final String DOMAIN = "www.opengis.net";
+
+    /**
      * 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,
+     * If new entries are added, then see the TODO comment in the {@link #codeForGML(String, String, String, int,
      * DefinitionURI)} method.</p>
      */
-    private static final Map<String,String> PATHS = Collections.singletonMap("crs", "//www.opengis.net/gml/srs/");
+    private static final Map<String,String> PATHS = Collections.singletonMap("crs", "//" + DOMAIN + "/gml/srs/");
+
+    /**
+     * A version number to be considered as if no version were provided.
+     * This value is part of OGC specification (not a SIS-specific hack).
+     */
+    public static final String NO_VERSION = "0";
 
     /**
-     * {@code true} if the URI is a {@code "http://www.opengis.net/gml/…"} URL, or
+     * {@code true} if the URI is a {@code "http://www.opengis.net/…"} URL, or
      * {@code false} if the URI is a {@code "urn:ogc:def:…"} URN.
      */
     public boolean isHTTP;
 
     /**
+     * {@code true} if the URI is a {@code "http://www.opengis.net/gml/…"} URL.
+     * A value of {@code true} should imply that {@link #isHTTP} is also {@code true}.
+     */
+    public boolean isGML;
+
+    /**
      * The type part of a URI, or {@code null} if none (empty).
      * Note that the set of valid types in OGC namespace is restricted.
      * See class javadoc for more information.
@@ -156,6 +181,7 @@ public final class DefinitionURI {
 
     /**
      * The version part of a URI, or {@code null} if none (empty).
+     * This field is null if the version in the parsed string was {@value #NO_VERSION}.
      *
      * <div class="note"><b>Example:</b>
      * In the {@code "urn:ogc:def:crs:EPSG:8.2:4326"} URN, this is {@code "8.2"}.</div>
@@ -185,68 +211,99 @@ public final class DefinitionURI {
     }
 
     /**
-     * Parses the given URI.
+     * Attempts to parse the given URI, which may either a URN or URL.
+     * If this method does not recognize the given URI, then it returns {@code null}.
+     * If the given URI is incomplete, then the {@link #code} value will be {@code null}.
      *
      * @param  uri The URI to parse.
      * @return The parse result, or {@code null} if the given URI is not recognized.
      */
-    @SuppressWarnings("null")
     public static DefinitionURI parse(final String uri) {
         ensureNonNull("uri", uri);
         DefinitionURI result = null;
+        char separator = SEPARATOR;
         int upper = -1;
+        /*
+         * Loop on all parts that we expect in the URI. Those parts are:
+         *
+         *   0:  "urn" or "http://www.opengis.net"
+         *   1:  "ogc" or "x-ogc"
+         *   2:  "def"
+         *   3:  "crs", "datum" or other types. The value is not controlled by this method.
+         *   4:  "ogc", "epsg", or other authorities. The value is not controlled by this method.
+         *   5:  version, or null if none.
+         *   6:  code
+         *   7:  parameters, or null if none.
+         */
         for (int p=0; p<=6; p++) {
             final int lower = upper + 1;
-            upper = uri.indexOf(SEPARATOR, lower);
+            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.
+                 * Verifies that the 3 first components are "urn:ogc:def:" or "http://www.opengis.net/def/"
+                 * without storing them. In the particular case of second component, we also accept "x-ogc"
+                 * in addition to "ogc" in URN.
                  */
-                case 0: if (regionMatches("http", uri, lower, upper)) {
-                            result = new DefinitionURI();
-                            return codeForHTTP(null, null, uri, upper+1, result) != null ? result : null;
+                case 0: {
+                    if (regionMatches("http", uri, lower, upper)) {
+                        result = new DefinitionURI();
+                        result.isHTTP = true;
+                        if (codeForGML(null, null, uri, ++upper, result) != null) {
+                            return result;
                         }
-                        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;
+                        if (!uri.regionMatches(upper, "//", 0, 2)) {
+                            return null;
+                        }
+                        upper++;
+                        separator = '/';    // Separator for the HTTP namespace.
+                    } else if (!regionMatches("urn", uri, lower, upper)) {
+                        return null;
                     }
-                    switch (p) {
-                        case 3:  result = new DefinitionURI();
-                                 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);
+                    break;
+                }
+                case 1: {
+                    final boolean isHTTP = (separator != SEPARATOR);
+                    if (!regionMatches(isHTTP ? DOMAIN : "ogc", uri, lower, upper)) {
+                        if (isHTTP  ||  !regionMatches("x-ogc", uri, lower, upper)) {
+                            return null;
+                        }
+                    }
+                    break;
+                }
+                case 2: {
+                    if (!regionMatches("def", uri, lower, upper)) {
+                        return null;
+                    }
+                    break;
+                }
+                /*
+                 * For all components after the first 3 ones, trim whitespaces and store non-empty values.
+                 */
+                default: {
+                    final String value = trimWhitespaces(uri, lower, upper).toString();
+                    if (!value.isEmpty() && (p != 5 || !NO_VERSION.equals(value))) {
+                        if (result == null) {
+                            result = new DefinitionURI();
+                        }
+                        switch (p) {
+                            case 3:  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);
+        if (result != null && ++upper < uri.length()) {
+            result.parameters = (String[]) split(uri.substring(upper), separator);
         }
         return result;
     }
@@ -293,7 +350,7 @@ public final class DefinitionURI {
             // Ignore the version number (actually everything up to the first ':').
             fromIndex = skipLeadingWhitespaces(urn, s+1, length);
             if (fromIndex >= length || urn.indexOf(SEPARATOR, fromIndex) >= 0) {
-                return null; // Empty code, or the code is followed by parameters.
+                return null;    // Empty code, or the code is followed by parameters.
             }
         }
         return urn.substring(fromIndex, skipTrailingWhitespaces(urn, fromIndex, length));
@@ -357,7 +414,7 @@ public final class DefinitionURI {
             return null;
         }
         if (length == 4) {
-            return codeForHTTP(type, authority, uri, upper+1, null);
+            return codeForGML(type, authority, uri, upper+1, null);
         }
         /*
          * At this point we have determined that the protocol is URN. The next components after "urn"
@@ -387,7 +444,7 @@ public final class DefinitionURI {
     }
 
     /**
-     * Implementation of URI parser for the HTTP forms.
+     * Implementation of URI parser for the HTTP forms in GML namespace.
      * The current implementation recognizes the following types:
      *
      * <ul>
@@ -400,7 +457,7 @@ public final class DefinitionURI {
      * @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, String authority, final String url, int lower,
+    private static String codeForGML(final String type, String authority, final String url, int lower,
             final DefinitionURI result)
     {
         Map<String, String> paths = PATHS;
@@ -411,12 +468,12 @@ public final class DefinitionURI {
             }
             // 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.
+            //       a new Collections.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();
+                lower = CharSequences.skipLeadingWhitespaces(url, lower + path.length(), url.length());
                 if (authority == null) {
                     authority = url.substring(lower, skipIdentifierPart(url, lower));
                 } else if (!url.regionMatches(true, lower, authority, 0, authority.length())) {
@@ -429,7 +486,7 @@ public final class DefinitionURI {
                     if ((lower = url.indexOf('#', lower+1)) >= 0) {
                         final String code = trimWhitespaces(url, lower+1, upper).toString();
                         if (result != null) {
-                            result.isHTTP    = true;
+                            result.isGML     = true;
                             result.type      = entry.getKey();
                             result.authority = authority;
                             result.code      = code;
@@ -464,6 +521,8 @@ public final class DefinitionURI {
      * @param  version   The code version, or {@code null}. This is the only optional information.
      * @param  code      The code, or {@code null}.
      * @return An identifier using the URN syntax, or {@code null} if a mandatory information is missing.
+     *
+     * @see org.apache.sis.internal.metadata.NameMeaning#toURN(Class, String, String, String)
      */
     public static String format(final String type, final String authority, final String version, final String code) {
         final StringBuilder buffer = new StringBuilder(PREFIX);
@@ -477,8 +536,10 @@ public final class DefinitionURI {
                 default: throw new AssertionError(p);
             }
             if (!appendUnicodeIdentifier(buffer.append(SEPARATOR), '\u0000', component, ".-", false)) {
-                // Only the version (p = 2) is optional. All other fields are mandatory.
-                // If no character has been added for a mandatory field, we can not build a URN.
+                /*
+                 * Only the version (p = 2) is optional. All other fields are mandatory.
+                 * If no character has been added for a mandatory field, we can not build a URN.
+                 */
                 if (p != 2) {
                     return null;
                 }
@@ -488,12 +549,28 @@ public final class DefinitionURI {
     }
 
     /**
-     * Returns a URN representation of this URI.
+     * Returns a string representation of this URI. If the URI were originally a GML's URL, then this method formats
+     * the URI in the {@code "http://www.opengis.net/gml/srs/"} namespace. Otherwise the URI were originally an URL,
+     * then this method formats the URI in the {@code "http://www.opengis.net/"} namespace.
+     * Otherwise this method formats the URI as a URN.
      *
-     * @return A URN representation of this URI.
+     * @return The string representation of this URI.
      */
-    public String toURN() {
+    @Override
+    public String toString() {
+        if (isGML) {
+            final String path = PATHS.get(type);
+            if (path != null) {
+                return "http:" + path + authority + ".xml#" + code;
+            }
+        }
         final StringBuilder buffer = new StringBuilder(PREFIX);
+        char separator = SEPARATOR;
+        if (isHTTP) {
+            buffer.setLength(0);
+            buffer.append("http://").append(DOMAIN).append("/def");
+            separator = '/';
+        }
         int n = 4;
         if (parameters != null) {
             n += parameters.length;
@@ -507,28 +584,13 @@ public final class DefinitionURI {
                 case 3:  component = code;            break;
                 default: component = parameters[p-4]; break;
             }
-            buffer.append(SEPARATOR);
-            if (component != null) {
-                buffer.append(component);
+            buffer.append(separator);
+            if (component == null) {
+                if (!isHTTP) continue;
+                component = NO_VERSION;
             }
+            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/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -18,114 +18,154 @@ package org.apache.sis.internal.util;
 
 import java.util.Arrays;
 import java.util.Iterator;
-import java.util.AbstractSet;
 import java.util.NoSuchElementException;
 import org.apache.sis.util.Workaround;
 
+// Branch-specific imports
+import java.util.Objects;
+
 
 /**
  * An immutable set built from an iterator, which will be filled only when needed.
  * This implementation does <strong>not</strong> check if all elements in the iterator
  * are really unique; we assume that this condition was already verified by the caller.
  *
- * <p>One usage of {@code LazySet} is to workaround a {@link java.util.ServiceLoader} bug which block usage of two
+ * <p>One usage of {@code LazySet} is to workaround a {@link java.util.ServiceLoader} bug which blocks usage of two
  * {@link Iterator} instances together: the first iteration must be fully completed or abandoned before we can start
  * a new iteration. See
  * {@link org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#DefaultMathTransformFactory()}.</p>
  *
+ * <p>Another usage for this class is to prepend some values before the elements given by the source {@code Iterable}.</p>
+ *
  * <p>This class is not thread-safe. Synchronization, if desired, shall be done by the caller.</p>
  *
  * @param <E> The type of elements in the set.
  *
  * @author  Martin Desruisseaux (IRD)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @Workaround(library="JDK", version="1.8.0_31-b13")
-public final class LazySet<E> extends AbstractSet<E> {
+public class LazySet<E> extends SetOfUnknownSize<E> {
     /**
      * The original source of elements, or {@code null} if unknown.
      */
-    public final Iterable<? extends E> source;
+    private final Iterable<? extends E> source;
 
     /**
      * The iterator to use for filling this set, or {@code null} if the iteration did not started yet
-     * or is finished. Those two cases can be distinguished by looking whether the {@link #elements}
+     * or is finished. Those two cases can be distinguished by looking whether the {@link #cachedElements}
      * array is null or not.
+     *
+     * @see #sourceIterator()
      */
-    private Iterator<? extends E> iterator;
+    private Iterator<? extends E> sourceIterator;
 
     /**
-     * The elements in this set, or {@code null} if the iteration did not started yet.
+     * The elements that we cached so far, or {@code null} if the iteration did not started yet.
      * After the iteration started, this array will grow as needed.
+     *
+     * @see #createCache()
+     * @see #cache(Object)
      */
-    private E[] elements;
+    private E[] cachedElements;
 
     /**
-     * The current position in the iteration. This position will be incremented as long as
-     * there is some elements remaining in the iterator.
+     * The number of valid elements in the {@link #cachedElements} array.
+     * This counter will be incremented as long as there is more elements returned by {@link #sourceIterator}.
      */
-    private int position;
+    private int numCached;
 
     /**
      * Constructs a set to be filled by the elements from the specified source. Iteration will starts
      * only when first needed, and at most one iteration will be performed (unless {@link #reload()}
      * is invoked).
      *
-     * @param source The source of elements to use for filling the set.
+     * @param source The source of elements to use for filling this set.
      */
-    @SuppressWarnings("unchecked")
     public LazySet(final Iterable<? extends E> source) {
+        Objects.requireNonNull(source);
         this.source = source;
     }
 
     /**
      * Constructs a set to be filled using the specified iterator.
-     * Iteration in the given iterator will occurs only when needed.
+     * Iteration with the given iterator will occur only when needed.
      *
-     * @param iterator The iterator to use for filling the set.
+     * @param iterator The iterator to use for filling this set.
      */
-    @SuppressWarnings("unchecked")
     public LazySet(final Iterator<? extends E> iterator) {
+        Objects.requireNonNull(sourceIterator);
+        sourceIterator = iterator;
         source = null;
-        this.iterator = iterator;
-        elements = (E[]) new Object[4];
+        createCache();
     }
 
     /**
-     * Notify this {@code LazySet} that it should re-fetch the elements from the {@linkplain #source}.
+     * Notifies this {@code LazySet} that it should re-fetch the elements from the source given at construction time.
+     * This method does not verify if the source needs also to be reloaded; it is up to the caller to verify.
+     *
+     * @return The original source of elements, or {@code null} if unknown.
      */
-    public void reload() {
+    public Iterable<? extends E> reload() {
         if (source != null) {
-            iterator = null;
-            elements = null;
-            position = 0;
+            sourceIterator = null;
+            cachedElements = null;
+            numCached = 0;
         }
+        return source;
     }
 
     /**
-     * Returns the iterator over the source elements, or {@code null} if the iteration is finished.
+     * Hook for subclasses that want to prepend some values before the source {@code Iterable}.
+     * This method is invoked only when first needed. It is safe to return a shared array since
+     * {@code LazySet} will not write in that array ({@code LazySet} will create a new array if
+     * it needs to add more values).
+     *
+     * @return Values to prepend before the source {@code Iterable}, or {@code null} if none.
+     *
+     * @since 0.7
+     */
+    protected E[] initialValues() {
+        return null;
+    }
+
+    /**
+     * Creates the {@link #cachedElements} array. This array will contains the elements
+     * given by {@link #initialContent()} if that method returned a non-null and non-empty array.
+     *
+     * @return {@code true} if {@link #initialValues()} initialized the set with at least one value.
      */
     @SuppressWarnings("unchecked")
-    private Iterator<? extends E> sourceElements() {
-        if (iterator == null && elements == null && source != null) {
-            iterator = source.iterator();
-            elements = (E[]) new Object[4];
+    private boolean createCache() {
+        cachedElements = initialValues();   // No need to clone.
+        if (cachedElements != null) {
+            numCached = cachedElements.length;
+            if (numCached != 0) {
+                return true;
+            }
         }
-        return iterator;
+        cachedElements = (E[]) new Object[4];
+        return false;
     }
 
     /**
-     * Returns {@code true} if the {@link #iterator} is non-null and have more elements to return.
+     * Returns {@code true} if the {@link #sourceIterator} is non-null and have more elements to return,
+     * or if we initialized the cache with some elements declared by {@link #initialValues()}.
      */
-    private boolean hasNext() {
-        final Iterator<? extends E> it = sourceElements();
-        if (it != null) {
-            if (it.hasNext()) {
+    private boolean canPullMore() {
+        if (sourceIterator == null && cachedElements == null) {
+            sourceIterator = source.iterator();
+            if (createCache()) {
                 return true;
             }
-            iterator = null;
+        }
+        if (sourceIterator != null) {
+            if (sourceIterator.hasNext()) {
+                return true;
+            }
+            sourceIterator = null;
         }
         return false;
     }
@@ -136,8 +176,8 @@ public final class LazySet<E> extends Ab
      * @return {@code true} if this set has no element.
      */
     @Override
-    public boolean isEmpty() {
-        return (position == 0) && !hasNext();
+    public final boolean isEmpty() {
+        return (numCached == 0) && !canPullMore();
     }
 
     /**
@@ -147,25 +187,26 @@ public final class LazySet<E> extends Ab
      * @return Number of elements in the iterator.
      */
     @Override
-    public int size() {
-        final Iterator<? extends E> it = sourceElements();
-        if (it != null) {
-            while (it.hasNext()) {
-                cache(it.next());
+    public final int size() {
+        if (canPullMore()) {
+            while (sourceIterator.hasNext()) {
+                cache(sourceIterator.next());
             }
-            iterator = null;
+            sourceIterator = null;
         }
-        return position;
+        return numCached;
     }
 
     /**
-     * Adds the given element to the {@link #elements} array.
+     * Adds the given element to the {@link #cachedElements} array.
+     *
+     * @param element The element to add to the cache.
      */
     private void cache(final E element) {
-        if (position >= elements.length) {
-            elements = Arrays.copyOf(elements, position*2);
+        if (numCached >= cachedElements.length) {
+            cachedElements = Arrays.copyOf(cachedElements, numCached << 1);
         }
-        elements[position++] = element;
+        cachedElements[numCached++] = element;
     }
 
     /**
@@ -177,7 +218,7 @@ public final class LazySet<E> extends Ab
      * negative index and for skipped elements.</p>
      */
     final boolean exists(final int index) {
-        return (index < position) || hasNext();
+        return (index < numCached) || canPullMore();
     }
 
     /**
@@ -187,14 +228,14 @@ public final class LazySet<E> extends Ab
      * @return The element at the requested index.
      */
     final E get(final int index) {
-        if (index >= position) {
-            if (hasNext()) {
-                cache(iterator.next());
+        if (index >= numCached) {
+            if (canPullMore()) {
+                cache(sourceIterator.next());
             } else {
                 throw new NoSuchElementException();
             }
         }
-        return elements[index];
+        return cachedElements[index];
     }
 
     /**
@@ -204,7 +245,7 @@ public final class LazySet<E> extends Ab
      * @return An iterator over the elements in this set.
      */
     @Override
-    public Iterator<E> iterator() {
+    public final Iterator<E> iterator() {
         return new Iterator<E>() {
             private int cursor;
 

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java?rev=1726717&r1=1726716&r2=1726717&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/MetadataServices.java [UTF-8] Tue Jan 26 00:12:35 2016
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.util;
 
 import org.opengis.metadata.citation.Citation;
+import org.apache.sis.internal.simple.CitationConstant;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.OptionalDependency;
 
@@ -28,7 +29,7 @@ import org.apache.sis.internal.system.Op
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public class MetadataServices extends OptionalDependency {
@@ -95,7 +96,7 @@ public class MetadataServices extends Op
      * @param  name The name of one of the citation constants defined in the {@code Citations} class.
      * @return The requested citation, or {@code null} if the {@code sis-metadata} module is not available.
      */
-    public Citation getCitationConstant(final String name) {
+    public CitationConstant getCitationConstant(final String name) {
         return null;
     }
 




Mime
View raw message