sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1641226 - in /sis/branches/JDK8/core/sis-metadata/src: main/java/org/apache/sis/metadata/ main/java/org/apache/sis/metadata/iso/ test/java/org/apache/sis/metadata/ test/java/org/apache/sis/metadata/iso/ test/java/org/apache/sis/metadata/is...
Date Sun, 23 Nov 2014 17:28:00 GMT
Author: desruisseaux
Date: Sun Nov 23 17:28:00 2014
New Revision: 1641226

URL: http://svn.apache.org/r1641226
Log:
Removed the hack about the "defaultLocale+otherLocale" UML identifier,
which does not exist anymore since GeoAPI now provide the version number
of specifications used.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1641226&r1=1641225&r2=1641226&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
[UTF-8] Sun Nov 23 17:28:00 2014
@@ -283,12 +283,7 @@ class PropertyAccessor {
             addMappingWithLowerCase(names[i] = toPropertyName(name, base), index);
             final UML annotation = getter.getAnnotation(UML.class);
             if (annotation != null) {
-                final String identifier = annotation.identifier().intern();
-                addMappingWithLowerCase(identifier, index);
-                final String alt = SpecialCases.rename(type, annotation.identifier().intern());
-                if (alt != identifier) { // Identity comparison is okay here.
-                    addMappingWithLowerCase(alt, index);
-                }
+                addMappingWithLowerCase(annotation.identifier().intern(), index);
             }
             /*
              * Now try to infer the setter from the getter. We replace the "get" prefix by

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java?rev=1641226&r1=1641225&r2=1641226&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/SpecialCases.java
[UTF-8] Sun Nov 23 17:28:00 2014
@@ -16,10 +16,8 @@
  */
 package org.apache.sis.metadata;
 
-import org.opengis.metadata.Metadata;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.extent.GeographicBoundingBox;
-import org.opengis.metadata.identification.DataIdentification;
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.util.collection.BackingStoreException;
@@ -70,23 +68,6 @@ final class SpecialCases extends Propert
     }
 
     /**
-     * Other special cases: rename particular UML identifiers found in
-     * {@link org.opengis.metadata.identification.DataIdentification#getLanguages()} and
-     * {@link org.opengis.metadata.Metadata#getLanguages()}.
-     *
-     * @param  identifier The UML identifier.
-     * @return The identifier to use.
-     */
-    static String rename(final Class<?> type, String identifier) {
-        if ((type == Metadata.class || type == DataIdentification.class)
-                && identifier.equals("defaultLocale+otherLocale"))
-        {
-            identifier = "language";
-        }
-        return identifier;
-    }
-
-    /**
      * Delegates to {@link PropertyAccessor#type(int)}, then substitutes the type for the
properties
      * handled in a special way.
      */

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java?rev=1641226&r1=1641225&r2=1641226&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java
[UTF-8] Sun Nov 23 17:28:00 2014
@@ -324,7 +324,7 @@ class TreeNode implements Node {
          */
         @Override
         CharSequence getName() {
-            return CharSequences.camelCaseToSentence(SpecialCases.rename(accessor.type, getIdentifier())).toString();
+            return CharSequences.camelCaseToSentence(getIdentifier()).toString();
         }
 
         /**

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java?rev=1641226&r1=1641225&r2=1641226&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
[UTF-8] Sun Nov 23 17:28:00 2014
@@ -42,8 +42,8 @@
  * {@code  ├─} {@linkplain org.apache.sis.metadata.iso.DefaultFeatureTypeList      
       Feature type list}<br>
  * {@code  └─} {@linkplain org.apache.sis.metadata.iso.DefaultIdentifier           
       Identifier}<br>
  * {@linkplain org.opengis.util.CodeList Code list}<br>
- * {@code  ├─} {@linkplain org.opengis.metadata.Datatype   Data type}<br>
- * {@code  └─} {@linkplain org.opengis.metadata.Obligation Obligation}<br>
+ * {@code  ├─} {@linkplain org.opengis.metadata.Datatype     Data type}<br>
+ * {@code  └─} {@linkplain org.opengis.annotation.Obligation Obligation}<br>
  * </td><td class="sep" style="width: 50%; white-space: nowrap">
  *                     {@linkplain org.apache.sis.metadata.iso.DefaultMetadata          
          Metadata}<br>
  * {@code  ├─}         {@linkplain org.apache.sis.metadata.iso.DefaultMetadataScope
               Metadata scope}<br>
@@ -52,7 +52,7 @@
  * {@code  ├─}         {@linkplain org.apache.sis.metadata.iso.DefaultMetadataExtensionInformation
Metadata extension information}<br>
  * {@code  │   └─}     {@linkplain org.apache.sis.metadata.iso.DefaultExtendedElementInformation
  Extended element information}<br>
  * {@code  │       ├─} {@linkplain org.opengis.metadata.Datatype          
                        Data type} «code list»<br>
- * {@code  │       └─} {@linkplain org.opengis.metadata.Obligation        
                        Obligation} «code list»<br>
+ * {@code  │       └─} {@linkplain org.opengis.annotation.Obligation      
                        Obligation} «code list»<br>
  * {@code  ├─}         {@linkplain org.apache.sis.metadata.iso.DefaultFeatureTypeList
             Feature type list}<br>
  * {@code  └─}         {@linkplain org.apache.sis.metadata.iso.DefaultIdentifier   
               Identifier}<br>
  * </td></tr></table>

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1641226&r1=1641225&r2=1641226&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
[UTF-8] Sun Nov 23 17:28:00 2014
@@ -215,7 +215,7 @@ public final strictfp class PropertyAcce
             Identification.class, "getResourceConstraints",        "resourceConstraints",
       "resourceConstraints",       "Resource constraints",         Constraints[].class,
             Identification.class, "getSpatialRepresentationTypes", "spatialRepresentationTypes",
"spatialRepresentationType", "Spatial representation types", SpatialRepresentationType[].class,
             Identification.class, "getSpatialResolutions",         "spatialResolutions",
        "spatialResolution",         "Spatial resolutions",          Resolution[].class,
-        DataIdentification.class, "getLanguages",                  "languages",         
        "defaultLocale+otherLocale", "Languages",                    Locale[].class,
+        DataIdentification.class, "getLanguages",                  "languages",         
        "language",                  "Languages",                    Locale[].class,
         DataIdentification.class, "getCharacterSets",              "characterSets",     
        "characterSet",              "Character sets",               Charset[].class,
             Identification.class, "getTopicCategories",            "topicCategories",   
        "topicCategory",             "Topic categories",             TopicCategory[].class,
         DataIdentification.class, "getEnvironmentDescription",     "environmentDescription",
    "environmentDescription",    "Environment description",      InternationalString.class,

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java?rev=1641226&r1=1641225&r2=1641226&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/SpecialCasesTest.java
[UTF-8] Sun Nov 23 17:28:00 2014
@@ -16,12 +16,9 @@
  */
 package org.apache.sis.metadata;
 
-import org.opengis.annotation.UML;
 import org.opengis.util.InternationalString;
-import org.opengis.metadata.Metadata;
 import org.opengis.metadata.ExtendedElementInformation;
 import org.opengis.metadata.extent.GeographicBoundingBox;
-import org.opengis.metadata.identification.DataIdentification;
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.measure.NumberRange;
@@ -205,21 +202,4 @@ public final strictfp class SpecialCases
         assertEquals(-180, range.getMinDouble(), STRICT);
         assertEquals(+180, range.getMaxDouble(), STRICT);
     }
-
-    /**
-     * Verifies that the need for {@link SpecialCases#rename(String)} still apply.
-     * If this test fails, it does not necessarily means that the {@code rename} method is
wrong.
-     * It may mean that the GeoAPI interface changed, in which case the {@code rename} method
or
-     * this test should be adapted.
-     *
-     * @throws NoSuchMethodException If the methods for which {@code rename} were designed
do not exists anymore.
-     */
-    @Test
-    public void testRename() throws NoSuchMethodException {
-        String identifier = Metadata.class.getMethod("getLanguages").getAnnotation(UML.class).identifier();
-        assertFalse(identifier, identifier.equals(SpecialCases.rename(Metadata.class, identifier)));
-
-        identifier = DataIdentification.class.getMethod("getLanguages").getAnnotation(UML.class).identifier();
-        assertFalse(identifier, identifier.equals(SpecialCases.rename(DataIdentification.class,
identifier)));
-    }
 }

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1641226&r1=1641225&r2=1641226&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] Sun Nov 23 17:28:00 2014
@@ -239,9 +239,7 @@ public final strictfp class AllMetadataT
             name = "DCP";
         } else if (name.equals("stepDateTime")) {
             name = "dateTime";
-        } else if (name.equals("defaultLocale+otherLocale") ||
-                type == FeatureCatalogueDescription.class && name.equals("locale"))
-        {
+        } else if (type == FeatureCatalogueDescription.class && name.equals("locale"))
{
             name = "language";
         }
         return name;

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java?rev=1641226&r1=1641225&r2=1641226&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
[UTF-8] Sun Nov 23 17:28:00 2014
@@ -167,8 +167,7 @@ public final strictfp class DefaultDataI
 
     /**
      * Tests {@link DefaultDataIdentification#asMap()}, in particular on the {@code "language"}
property.
-     * This property is handle in a special way since the declared UML identifier is
-     * {@code "defaultLocale+otherLocale"}.
+     * This property still use the UML identifier of ISO 19115:2003.
      */
     @Test
     public void testValueMap() {
@@ -177,9 +176,8 @@ public final strictfp class DefaultDataI
         assertEquals("abstract", "NCEP SST Global 5.0 x 2.5 degree model data", map.get("abstract").toString());
         assertEquals("title", "Sea Surface Temperature Analysis Model", ((Citation) map.get("citation")).getTitle().toString());
         assertEquals("spatialRepresentationType", singleton(SpatialRepresentationType.GRID),
map.get("spatialRepresentationType"));
-        assertArrayEquals("language",                  LOCALES, ((Collection<?>) map.get("language")).toArray());
-        assertArrayEquals("languages",                 LOCALES, ((Collection<?>) map.get("languages")).toArray());
-        assertArrayEquals("getLanguages",              LOCALES, ((Collection<?>) map.get("getLanguages")).toArray());
-        assertArrayEquals("defaultLocale+otherLocale", LOCALES, ((Collection<?>) map.get("defaultLocale+otherLocale")).toArray());
+        assertArrayEquals("language",     LOCALES, ((Collection<?>) map.get("language")).toArray());
+        assertArrayEquals("languages",    LOCALES, ((Collection<?>) map.get("languages")).toArray());
+        assertArrayEquals("getLanguages", LOCALES, ((Collection<?>) map.get("getLanguages")).toArray());
     }
 }



Mime
View raw message