sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1648819 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/internal/metadata/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/ sis-metadata/src/test/java/org/apache/sis/internal/metadata/ sis-metadata/src/test/j...
Date Thu, 01 Jan 2015 11:32:17 GMT
Author: desruisseaux
Date: Thu Jan  1 11:32:16 2015
New Revision: 1648819

URL: http://svn.apache.org/r1648819
Log:
Moved into a separated class (NameMeaning) the ReferencingUtilities methods related to assigning
a meaning to parts of OGC URN.

Added:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
      - copied, changed from r1648803, sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/NameMeaningTest.java
      - copied, changed from r1648803, sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java
Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java

Copied: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
(from r1648803, sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java?p2=sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java&p1=sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java&r1=1648803&r2=1648819&rev=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -16,11 +16,6 @@
  */
 package org.apache.sis.internal.metadata;
 
-import java.util.Collection;
-import java.util.logging.Logger;
-import javax.measure.unit.Unit;
-import org.opengis.annotation.UML;
-import org.opengis.annotation.Specification;
 import org.opengis.parameter.*;
 import org.opengis.referencing.*;
 import org.opengis.referencing.cs.*;
@@ -28,36 +23,29 @@ import org.opengis.referencing.crs.*;
 import org.opengis.referencing.datum.*;
 import org.opengis.referencing.operation.*;
 import org.apache.sis.util.Static;
-import org.apache.sis.util.logging.Logging;
-import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.jaxb.Context;
 
 
 /**
- * A set of static methods working on GeoAPI referencing objects.
- * Some of those methods may be useful, but not really rigorous.
- * This is why they do not appear in the public packages.
- *
- * <p><strong>Do not rely on this API!</strong> It may change in incompatible
way in any future release.</p>
+ * The meaning of some part of URN in the {@code "ogc"} namespace.
+ * The meaning are defined by <cite>OGC Naming Authority</cite> (OGCNA) or other
OGC sources.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @since   0.4 (derived from geotk-2.0)
+ * @since   0.5
  * @version 0.5
  * @module
+ *
+ * @see org.apache.sis.internal.util.DefinitionURI
+ * @see <a href="http://www.opengeospatial.org/ogcna">http://www.opengeospatial.org/ogcna</a>
+ * @see <a href="http://portal.opengeospatial.org/files/?artifact_id=24045">Definition
identifier URNs in OGC namespace</a>
  */
-public final class ReferencingUtilities extends Static {
-    /**
-     * The logger to use for messages related to the {@code sis-referencing} module.
-     */
-    public static final Logger LOGGER = Logging.getLogger("org.apache.sis.referencing");
-
+public final class NameMeaning extends Static {
     /**
-     * Subtypes of {@link IdentifiedObject} for which a URN type is defined.
-     * For each interface at index <var>i</var>, the URN type is {@code URN_TYPES[i]}.
+     * Subtypes of {@link IdentifiedObject} for which an object type is defined.
+     * For each interface at index <var>i</var>, the type is {@code TYPES[i]}.
      *
      * <p>For performance reasons, most frequently used types should be first.</p>
      */
-    private static final Class<?>[] TYPES = {
+    private static final Class<?>[] CLASSES = {
         CoordinateReferenceSystem.class,
         Datum.class,
         Ellipsoid.class,
@@ -71,10 +59,10 @@ public final class ReferencingUtilities
     };
 
     /**
-     * The URN types for instances of {@link #TYPES}.
-     * See {@link org.apache.sis.internal.util.DefinitionURI} javadoc for a list of URN types.
+     * The object types for instances of {@link #CLASSES}.
+     * See {@link org.apache.sis.internal.util.DefinitionURI} javadoc for a list of object
types in URN.
      */
-    private static final String[] URN_TYPES = {
+    private static final String[] TYPES = {
         "crs",
         "datum",
         "ellipsoid",
@@ -90,7 +78,7 @@ public final class ReferencingUtilities
     /**
      * Do not allow instantiation of this class.
      */
-    private ReferencingUtilities() {
+    private NameMeaning() {
     }
 
     /**
@@ -106,158 +94,18 @@ public final class ReferencingUtilities
     }
 
     /**
-     * Returns the URN type for the given class, or {@code null} if unknown.
-     * See {@link org.apache.sis.internal.util.DefinitionURI} javadoc for a list of URN types.
+     * Returns the "object type" part of an OGC URN for the given class, or {@code null}
if unknown.
+     * See {@link org.apache.sis.internal.util.DefinitionURI} javadoc for a list of object
types in URN.
      *
      * @param  type The class for which to get the URN type.
      * @return The URN type, or {@code null} if unknown.
-     *
-     * @see org.apache.sis.internal.util.DefinitionURI
-     */
-    public static String toURNType(final Class<?> type) {
-        for (int i=0; i<TYPES.length; i++) {
-            if (TYPES[i].isAssignableFrom(type)) {
-                return URN_TYPES[i];
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the WKT type of the given interface.
-     *
-     * For {@link CoordinateSystem} base type, the returned value shall be one of
-     * {@code affine}, {@code Cartesian}, {@code cylindrical}, {@code ellipsoidal}, {@code
linear},
-     * {@code parametric}, {@code polar}, {@code spherical}, {@code temporal} or {@code vertical}.
-     *
-     * @param  base The abstract base interface.
-     * @param  type The interface or classes for which to get the WKT type.
-     * @return The WKT type for the given class or interface, or {@code null} if none.
      */
-    public static String toWKTType(final Class<?> base, final Class<?> type)
{
-        if (type != base) {
-            final UML uml = type.getAnnotation(UML.class);
-            if (uml != null && uml.specification() == Specification.ISO_19111) {
-                String name = uml.identifier();
-                final int length = name.length() - 5; // Length without "CS_" and "CS".
-                if (length >= 1 && name.startsWith("CS_") && name.endsWith("CS"))
{
-                    final StringBuilder buffer = new StringBuilder(length).append(name, 3,
3 + length);
-                    if (!name.regionMatches(3, "Cartesian", 0, 9)) {
-                        buffer.setCharAt(0, Character.toLowerCase(buffer.charAt(0)));
-                    }
-                    name = buffer.toString();
-                    if (name.equals("time")) {
-                        name = "temporal";
-                    }
-                    return name;
-                }
-            }
-            for (final Class<?> c : type.getInterfaces()) {
-                if (base.isAssignableFrom(c)) {
-                    final String name = toWKTType(base, c);
-                    if (name != null) {
-                        return name;
-                    }
-                }
+    public static String toObjectType(final Class<?> type) {
+        for (int i=0; i<CLASSES.length; i++) {
+            if (CLASSES[i].isAssignableFrom(type)) {
+                return TYPES[i];
             }
         }
         return null;
     }
-
-    /**
-     * Returns the unit used for all axes in the given coordinate system.
-     * If not all axes use the same unit, then this method returns {@code null}.
-     *
-     * <p>This method is used either when the coordinate system is expected to contain
exactly one axis,
-     * or for operations that support only one units for all axes, for example Well Know
Text version 1
-     * (WKT 1) formatting.</p>
-     *
-     * @param cs The coordinate system for which to get the unit, or {@code null}.
-     * @return The unit for all axis in the given coordinate system, or {@code null}.
-     */
-    public static Unit<?> getUnit(final CoordinateSystem cs) {
-        Unit<?> unit = null;
-        if (cs != null) {
-            for (int i=cs.getDimension(); --i>=0;) {
-                final CoordinateSystemAxis axis = cs.getAxis(i);
-                if (axis != null) { // Paranoiac check.
-                    final Unit<?> candidate = axis.getUnit();
-                    if (candidate != null) {
-                        if (unit == null) {
-                            unit = candidate;
-                        } else if (!unit.equals(candidate)) {
-                            return null;
-                        }
-                    }
-                }
-            }
-        }
-        return unit;
-    }
-
-    /**
-     * Copies all {@link SingleCRS} components from the given source to the given collection.
-     * For each {@link CompoundCRS} element found in the iteration, this method replaces
the
-     * {@code CompoundCRS} by its {@linkplain CompoundCRS#getComponents() components}, which
-     * may themselves have other {@code CompoundCRS}. Those replacements are performed recursively
-     * until we obtain a flat view of CRS components.
-     *
-     * @param  source The collection of single or compound CRS.
-     * @param  addTo  Where to add the single CRS in order to obtain a flat view of {@code
source}.
-     * @return {@code true} if this method found only single CRS in {@code source}, in which
case {@code addTo}
-     *         got the same content (assuming that {@code addTo} was empty prior this method
call).
-     * @throws ClassCastException if a CRS is neither a {@link SingleCRS} or a {@link CompoundCRS}.
-     *
-     * @see org.apache.sis.referencing.CRS#getSingleComponents(CoordinateReferenceSystem)
-     */
-    public static boolean getSingleComponents(final Iterable<? extends CoordinateReferenceSystem>
source,
-            final Collection<? super SingleCRS> addTo) throws ClassCastException
-    {
-        boolean sameContent = true;
-        for (final CoordinateReferenceSystem candidate : source) {
-            if (candidate instanceof CompoundCRS) {
-                getSingleComponents(((CompoundCRS) candidate).getComponents(), addTo);
-                sameContent = false;
-            } else {
-                // Intentional CassCastException here if the candidate is not a SingleCRS.
-                addTo.add((SingleCRS) candidate);
-            }
-        }
-        return sameContent;
-    }
-
-    /**
-     * Ensures that the given argument value is {@code false}. This method is invoked by
private setter methods,
-     * which are themselves invoked by JAXB at unmarshalling time. Invoking this method from
those setter methods
-     * serves two purposes:
-     *
-     * <ul>
-     *   <li>Make sure that a singleton property is not defined twice in the XML document.</li>
-     *   <li>Protect ourselves against changes in immutable objects outside unmarshalling.
It should
-     *       not be necessary since the setter methods shall not be public, but we are paranoiac.</li>
-     *   <li>Be a central point where we can trace all setter methods, in case we want
to improve
-     *       warning or error messages in future SIS versions.</li>
-     * </ul>
-     *
-     * @param  classe    The caller class, used only in case of warning message to log.
-     * @param  method    The caller method, used only in case of warning message to log.
-     * @param  name      The property name, used only in case of error message to format.
-     * @param  isDefined Whether the property in the caller object is current defined.
-     * @return {@code true} if the caller can set the property.
-     * @throws IllegalStateException If {@code isDefined} is {@code true} and we are not
unmarshalling an object.
-     */
-    public static boolean canSetProperty(final Class<?> classe, final String method,
-            final String name, final boolean isDefined) throws IllegalStateException
-    {
-        if (!isDefined) {
-            return true;
-        }
-        final Context context = Context.current();
-        if (context != null) {
-            Context.warningOccured(context, LOGGER, classe, method, Errors.class, Errors.Keys.ElementAlreadyPresent_1,
name);
-            return false;
-        } else {
-            throw new IllegalStateException(Errors.format(Errors.Keys.ElementAlreadyPresent_1,
name));
-        }
-    }
 }

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java?rev=1648819&r1=1648818&r2=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -21,12 +21,8 @@ import java.util.logging.Logger;
 import javax.measure.unit.Unit;
 import org.opengis.annotation.UML;
 import org.opengis.annotation.Specification;
-import org.opengis.parameter.*;
-import org.opengis.referencing.*;
 import org.opengis.referencing.cs.*;
 import org.opengis.referencing.crs.*;
-import org.opengis.referencing.datum.*;
-import org.opengis.referencing.operation.*;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
@@ -52,78 +48,12 @@ public final class ReferencingUtilities
     public static final Logger LOGGER = Logging.getLogger("org.apache.sis.referencing");
 
     /**
-     * Subtypes of {@link IdentifiedObject} for which a URN type is defined.
-     * For each interface at index <var>i</var>, the URN type is {@code URN_TYPES[i]}.
-     *
-     * <p>For performance reasons, most frequently used types should be first.</p>
-     */
-    private static final Class<?>[] TYPES = {
-        CoordinateReferenceSystem.class,
-        Datum.class,
-        Ellipsoid.class,
-        PrimeMeridian.class,
-        CoordinateSystem.class,
-        CoordinateSystemAxis.class,
-        CoordinateOperation.class,
-        OperationMethod.class,
-        ParameterDescriptor.class,
-        ReferenceSystem.class
-    };
-
-    /**
-     * The URN types for instances of {@link #TYPES}.
-     * See {@link org.apache.sis.internal.util.DefinitionURI} javadoc for a list of URN types.
-     */
-    private static final String[] URN_TYPES = {
-        "crs",
-        "datum",
-        "ellipsoid",
-        "meridian",
-        "cs",
-        "axis",
-        "coordinateOperation",
-        "method",
-        "parameter",
-        "referenceSystem"
-    };
-
-    /**
      * Do not allow instantiation of this class.
      */
     private ReferencingUtilities() {
     }
 
     /**
-     * Returns {@code true} if codes in the given code space are often represented using
the URN syntax.
-     * Current implementation conservatively returns {@code true} only for {@code "EPSG"}.
-     * The list of accepted code spaces may be expanded in any future SIS version.
-     *
-     * @param  codeSpace The code space (can be {@code null}).
-     * @return {@code true} if the given code space is known to use the URN syntax.
-     */
-    public static boolean usesURN(final String codeSpace) {
-        return (codeSpace != null) && codeSpace.equalsIgnoreCase("EPSG");
-    }
-
-    /**
-     * Returns the URN type for the given class, or {@code null} if unknown.
-     * See {@link org.apache.sis.internal.util.DefinitionURI} javadoc for a list of URN types.
-     *
-     * @param  type The class for which to get the URN type.
-     * @return The URN type, or {@code null} if unknown.
-     *
-     * @see org.apache.sis.internal.util.DefinitionURI
-     */
-    public static String toURNType(final Class<?> type) {
-        for (int i=0; i<TYPES.length; i++) {
-            if (TYPES[i].isAssignableFrom(type)) {
-                return URN_TYPES[i];
-            }
-        }
-        return null;
-    }
-
-    /**
      * Returns the WKT type of the given interface.
      *
      * For {@link CoordinateSystem} base type, the returned value shall be one of

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1648819&r1=1648818&r2=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -29,8 +29,8 @@ import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.internal.metadata.ReferencingUtilities;
 import org.apache.sis.internal.util.DefinitionURI;
+import org.apache.sis.internal.metadata.NameMeaning;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.io.wkt.Convention;
@@ -618,8 +618,8 @@ public class ImmutableIdentifier extends
                      */
                     if (convention != Convention.INTERNAL && formatter.getEnclosingElement(2)
== null) {
                         final FormattableObject parent = formatter.getEnclosingElement(1);
-                        if (parent != null && ReferencingUtilities.usesURN(cs)) {
-                            final String type = ReferencingUtilities.toURNType(parent.getClass());
+                        if (parent != null && NameMeaning.usesURN(cs)) {
+                            final String type = NameMeaning.toObjectType(parent.getClass());
                             if (type != null) {
                                 formatter.append(new URI(type, cs, version, code));
                             }

Copied: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/NameMeaningTest.java
(from r1648803, sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/NameMeaningTest.java?p2=sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/NameMeaningTest.java&p1=sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java&r1=1648803&r2=1648819&rev=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/NameMeaningTest.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -24,53 +24,34 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-import static org.apache.sis.internal.metadata.ReferencingUtilities.*;
 
 
 /**
- * Tests {@link ReferencingUtilities}.
+ * Tests {@link NameMeaning}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @since   0.4
- * @version 0.4
+ * @since   0.5 (derived from 0.4)
+ * @version 0.5
  * @module
  */
-public final strictfp class ReferencingUtilitiesTest extends TestCase {
+public final strictfp class NameMeaningTest extends TestCase {
     /**
-     * Tests {@link ReferencingUtilities#toURNType(Class)}.
+     * Tests {@link NameMeaning#toObjectType(Class)}.
      */
     @Test
-    public void testToURNType() {
-        assertEquals("crs",             toURNType(GeographicCRS       .class));
-        assertEquals("crs",             toURNType(ProjectedCRS        .class));
-        assertEquals("crs",             toURNType(VerticalCRS         .class));
-        assertEquals("crs",             toURNType(TemporalCRS         .class));
-        assertEquals("datum",           toURNType(GeodeticDatum       .class));
-        assertEquals("datum",           toURNType(VerticalDatum       .class));
-        assertEquals("datum",           toURNType(TemporalDatum       .class));
-        assertEquals("ellipsoid",       toURNType(Ellipsoid           .class));
-        assertEquals("meridian",        toURNType(PrimeMeridian       .class));
-        assertEquals("cs",              toURNType(EllipsoidalCS       .class));
-        assertEquals("cs",              toURNType(CartesianCS         .class));
-        assertEquals("axis",            toURNType(CoordinateSystemAxis.class));
-        assertEquals("referenceSystem", toURNType(ReferenceSystem     .class));
-    }
-
-    /**
-     * Tests {@link ReferencingUtilities#toWKTType(Class, Class)}.
-     */
-    @Test
-    public void testType() {
-        assertNull  (               toWKTType(CoordinateSystem.class, CoordinateSystem.class));
-        assertEquals("affine",      toWKTType(CoordinateSystem.class, AffineCS        .class));
-        assertEquals("Cartesian",   toWKTType(CoordinateSystem.class, CartesianCS     .class));
-        assertEquals("cylindrical", toWKTType(CoordinateSystem.class, CylindricalCS   .class));
-        assertEquals("ellipsoidal", toWKTType(CoordinateSystem.class, EllipsoidalCS   .class));
-        assertEquals("linear",      toWKTType(CoordinateSystem.class, LinearCS        .class));
-//      assertEquals("parametric",  toWKTType(CoordinateSystem.class, ParametricCS    .class));
-        assertEquals("polar",       toWKTType(CoordinateSystem.class, PolarCS         .class));
-        assertEquals("spherical",   toWKTType(CoordinateSystem.class, SphericalCS     .class));
-        assertEquals("temporal",    toWKTType(CoordinateSystem.class, TimeCS          .class));
-        assertEquals("vertical",    toWKTType(CoordinateSystem.class, VerticalCS      .class));
+    public void testToObjectType() {
+        assertEquals("crs",             NameMeaning.toObjectType(GeographicCRS       .class));
+        assertEquals("crs",             NameMeaning.toObjectType(ProjectedCRS        .class));
+        assertEquals("crs",             NameMeaning.toObjectType(VerticalCRS         .class));
+        assertEquals("crs",             NameMeaning.toObjectType(TemporalCRS         .class));
+        assertEquals("datum",           NameMeaning.toObjectType(GeodeticDatum       .class));
+        assertEquals("datum",           NameMeaning.toObjectType(VerticalDatum       .class));
+        assertEquals("datum",           NameMeaning.toObjectType(TemporalDatum       .class));
+        assertEquals("ellipsoid",       NameMeaning.toObjectType(Ellipsoid           .class));
+        assertEquals("meridian",        NameMeaning.toObjectType(PrimeMeridian       .class));
+        assertEquals("cs",              NameMeaning.toObjectType(EllipsoidalCS       .class));
+        assertEquals("cs",              NameMeaning.toObjectType(CartesianCS         .class));
+        assertEquals("axis",            NameMeaning.toObjectType(CoordinateSystemAxis.class));
+        assertEquals("referenceSystem", NameMeaning.toObjectType(ReferenceSystem     .class));
     }
 }

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java?rev=1648819&r1=1648818&r2=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ReferencingUtilitiesTest.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -17,9 +17,6 @@
 package org.apache.sis.internal.metadata;
 
 import org.opengis.referencing.cs.*;
-import org.opengis.referencing.crs.*;
-import org.opengis.referencing.datum.*;
-import org.opengis.referencing.ReferenceSystem;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -37,26 +34,6 @@ import static org.apache.sis.internal.me
  */
 public final strictfp class ReferencingUtilitiesTest extends TestCase {
     /**
-     * Tests {@link ReferencingUtilities#toURNType(Class)}.
-     */
-    @Test
-    public void testToURNType() {
-        assertEquals("crs",             toURNType(GeographicCRS       .class));
-        assertEquals("crs",             toURNType(ProjectedCRS        .class));
-        assertEquals("crs",             toURNType(VerticalCRS         .class));
-        assertEquals("crs",             toURNType(TemporalCRS         .class));
-        assertEquals("datum",           toURNType(GeodeticDatum       .class));
-        assertEquals("datum",           toURNType(VerticalDatum       .class));
-        assertEquals("datum",           toURNType(TemporalDatum       .class));
-        assertEquals("ellipsoid",       toURNType(Ellipsoid           .class));
-        assertEquals("meridian",        toURNType(PrimeMeridian       .class));
-        assertEquals("cs",              toURNType(EllipsoidalCS       .class));
-        assertEquals("cs",              toURNType(CartesianCS         .class));
-        assertEquals("axis",            toURNType(CoordinateSystemAxis.class));
-        assertEquals("referenceSystem", toURNType(ReferenceSystem     .class));
-    }
-
-    /**
      * Tests {@link ReferencingUtilities#toWKTType(Class, Class)}.
      */
     @Test

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1648819&r1=1648818&r2=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -30,6 +30,7 @@ import org.junit.BeforeClass;
  * @module
  */
 @Suite.SuiteClasses({
+    org.apache.sis.internal.metadata.NameMeaningTest.class,
     org.apache.sis.internal.metadata.MetadataUtilitiesTest.class,
     org.apache.sis.internal.metadata.ReferencingUtilitiesTest.class,
     org.apache.sis.internal.metadata.OtherLocalesTest.class,

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java?rev=1648819&r1=1648818&r2=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -22,11 +22,10 @@ import javax.xml.bind.annotation.XmlAttr
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.apache.sis.internal.util.DefinitionURI;
+import org.apache.sis.internal.metadata.NameMeaning;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
 
-import static org.apache.sis.internal.metadata.ReferencingUtilities.toURNType;
-
 
 /**
  * The {@code gml:CodeType}, which is made of a code space and a code value.
@@ -154,7 +153,7 @@ public final class Code {
              */
             if (fallback != null) {
                 if (!isHTTP) {
-                    final String urn = DefinitionURI.format(toURNType(type), fallback);
+                    final String urn = DefinitionURI.format(NameMeaning.toObjectType(type),
fallback);
                     if (urn != null) {
                         final Code code = new Code();
                         code.codeSpace = Citations.getIdentifier(fallback.getAuthority());

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1648819&r1=1648818&r2=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -38,7 +38,7 @@ import org.opengis.metadata.citation.Cit
 import org.opengis.referencing.ObjectFactory;
 import org.opengis.referencing.AuthorityFactory;
 import org.opengis.referencing.IdentifiedObject;
-import org.apache.sis.internal.metadata.ReferencingUtilities;
+import org.apache.sis.internal.metadata.NameMeaning;
 import org.apache.sis.internal.jaxb.referencing.Code;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
@@ -466,7 +466,7 @@ public class AbstractIdentifiedObject ex
         if (identifiers != null) {
             for (final Identifier identifier : identifiers) {
                 if (appendUnicodeIdentifier(id, '-', identifier.getCodeSpace(), ":", true)
| // Really |, not ||
-                    appendUnicodeIdentifier(id, '-', ReferencingUtilities.toURNType(getClass()),
":", false) |
+appendUnicodeIdentifier(id, '-', NameMeaning.toObjectType(getClass()), ":", false) |
                     appendUnicodeIdentifier(id, '-', identifier.getCode(), ":", true))
                 {
                     /*

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java?rev=1648819&r1=1648818&r2=1648819&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
[UTF-8] Thu Jan  1 11:32:16 2015
@@ -49,7 +49,9 @@ import static org.apache.sis.internal.ut
  *   <li>an arbitrary amount of {@linkplain #parameters}</li>
  * </ul>
  *
- * The <cite>object type</cite> can be:
+ * The <cite>object type</cite> can be one of the following name.
+ * Mapping between those names and GeoAPI interfaces is provided by the
+ * {@link org.apache.sis.internal.metadata.NameMeaning} class.
  * <table class="sis">
  *   <caption>Recognized object types in URN</caption>
  *   <tr><th>Object type</th>         <th>Meaning</th></tr>



Mime
View raw message