sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1791995 [2/2] - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/main/java/org/apache/sis/feature/builder/ core/sis-feature/src/main/java/org/apache/sis/internal/feature/ core/sis-feature/src/te...
Date Wed, 19 Apr 2017 21:57:12 GMT
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/ScalarTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/ScalarTest.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/ScalarTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/ScalarTest.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -82,7 +82,7 @@ public final strictfp class ScalarTest e
 
     /**
      * Tests {@link Scalar#multiply(Quantity)}, {@link Scalar#divide(Quantity)} and {@link Quantity#inverse()}.
-     * Those tests depend on proper working of {@link Units#quantity(double, Unit)}, which depends in turn on
+     * Those tests depend on proper working of {@link Quantities#create(double, Unit)}, which depends in turn on
      * proper declarations of {@link ScalarFactory} in {@link Units} initialization.
      */
     @Test

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -265,6 +265,7 @@ public final strictfp class UnitFormatTe
         assertSame(Units.DEGREE,        f.parse("degree"));
         assertSame(Units.DEGREE,        f.parse("degrees"));
         assertSame(Units.DEGREE,        f.parse("decimal degrees"));
+        assertSame(Units.DEGREE,        f.parse("Degrees North"));
         assertSame(Units.DEGREE,        f.parse("degrees north"));
         assertSame(Units.DEGREE,        f.parse("degree north"));
         assertSame(Units.DEGREE,        f.parse("degrees_east"));

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NamesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NamesTest.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NamesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/iso/NamesTest.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -27,6 +27,7 @@ import org.opengis.util.NameSpace;
 import org.opengis.util.ScopedName;
 import org.apache.sis.util.UnknownNameException;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -38,13 +39,28 @@ import static org.junit.Assert.*;
  * Tests the {@link Names} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 0.8
  * @since   0.5
  * @module
  */
 @DependsOn(DefaultNameFactoryTest.class)
 public final strictfp class NamesTest extends TestCase {
     /**
+     * Tests {@link Names#createScopedName(GenericName, String, CharSequence)}.
+     */
+    @Test
+    @DependsOnMethod("testCreateLocalName")
+    public void testCreateScopedName() {
+        final LocalName scope = Names.createLocalName("Apache", null, "sis");
+        final ScopedName name = Names.createScopedName(scope, null, "identifier");
+        assertSame  ("path()",      scope,                   name.path());
+        assertEquals("tail()",      "identifier",            name.tail().toString());
+        assertEquals("toString()",  "sis:identifier",        name.toString());
+        assertEquals("full",        "Apache:sis:identifier", name.toFullyQualifiedName().toString());
+        assertEquals("tail().full", "Apache:sis:identifier", name.tail().toFullyQualifiedName().toString());
+    }
+
+    /**
      * Tests {@link Names#createLocalName(CharSequence, String, CharSequence)}.
      */
     @Test

Modified: sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Wed Apr 19 21:57:11 2017
@@ -610,7 +610,7 @@ Apache SIS is a free software, Java lang
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.19.1</version>
+        <version>2.20</version>
         <configuration>
           <includes>
             <include>**/*TestSuite.java</include>

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureNaming.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -103,11 +103,12 @@ import org.apache.sis.internal.jdk8.JDK8
 public class FeatureNaming<E> {
     /**
      * All aliases found for all names given to the {@link #add(DataStore, GenericName, Object)} method.
-     * Keys are aliases (never the explicitely given names) and values are names for which the key is an alias.
+     * Keys are aliases and values are the complete names for which the key is an alias.
      * Each {@code List<String>} instance contains exactly one name if there is no ambiguity.
      * If the list contains more than one name, this means that the alias is ambiguous.
      *
-     * <p>Note that this map always have less entries than {@link #values} map.</p>
+     * <p>For saving space in common cases, a missing entry in this map is interpreted as synonymous of
+     * {@code (name, Collections.singletonList(name))} entry.</p>
      */
     private final Map<String, List<String>> aliases;
 
@@ -188,27 +189,47 @@ public class FeatureNaming<E> {
         ArgumentChecks.ensureNonNull("name",  name);
         ArgumentChecks.ensureNonNull("value", value);
         final String key = name.toString();
-        if (JDK8.putIfAbsent(values, key, value) != null) {
-            throw new IllegalNameException(locale(store), Resources.Keys.FeatureAlreadyPresent_2, name(store), key);
+        final E previous = values.put(key, value);
+        if (previous != null) {
+            final List<String> fullNames = aliases.get(key);            // Null is synonymous of singletonList(key).
+            if (fullNames == null || fullNames.contains(key)) {
+                /*
+                 * If we already had a value for the given name and if that value was associated to a user-specified
+                 * name (not to an alias of that name), then we have a name collision. Restore the previous value.
+                 */
+                if (values.put(key, previous) != value) {
+                    throw new ConcurrentModificationException(name(store).toString());              // Paranoiac check.
+                }
+                throw new IllegalNameException(locale(store), Resources.Keys.FeatureAlreadyPresent_2, name(store), key);
+            }
+            CollectionsExt.addToMultiValuesMap(aliases, key, key);
         }
+        /*
+         * At this point we associated the value to the given name. Now try to associate the same value to all aliases.
+         * In this process, we may discover that some slots are already filled by other values.
+         */
         while (name instanceof ScopedName) {
             name = ((ScopedName) name).tail();
             final String alias = name.toString();
-            if (CollectionsExt.addToMultiValuesMap(aliases, alias, key).size() > 1) {
+            final List<String> fullNames = CollectionsExt.addToMultiValuesMap(aliases, alias, key);
+            if (fullNames.size() > 1) {
                 /*
                  * If there is more than one GenericName for the same alias, we have an ambiguity.
-                 * Remove any value associated to that alias. The 'get' method in this class will
-                 * know that the value is missing because of ambiguous name.
+                 * Remove any value associated to that alias, unless the value was associated to
+                 * exactly the user-specified name (not an alias). The 'get' method in this class
+                 * will know when the value is missing because of ambiguous name.
                  */
-                values.remove(alias);
-            } else if (values.put(alias, value) != null) {
+                if (!fullNames.contains(alias)) {
+                    values.remove(alias);
+                }
+            } else if (JDK8.putIfAbsent(values, alias, value) != null) {
                 /*
-                 * If no previous GenericName existed for that alias, then no value should exist for that alias.
-                 * If a previous value existed, then (assuming that we do not have a bug in our algorithm) this
-                 * object changed in a concurrent thread during this method execution.  We do not try to detect
-                 * all such errors, but this check is an easy one to perform opportunistically.
+                 * If a value already existed for that alias but the alias was not declared in the 'aliases' map,
+                 * this means that the list was implicitly Collections.singletonList(key). Since we now have an
+                 * additional value, we need to add explicitly the previously implicit value.
                  */
-                throw new ConcurrentModificationException(name(store).toString());
+                assert !fullNames.contains(alias) : alias;
+                CollectionsExt.addToMultiValuesMap(aliases, alias, alias);
             }
         }
     }
@@ -225,16 +246,28 @@ public class FeatureNaming<E> {
      *         representation, but for which {@link ScopedName#tail()} returns different values.
      */
     public boolean remove(final DataStore store, GenericName name) throws IllegalNameException {
-        ArgumentChecks.ensureNonNull("name",  name);
+        ArgumentChecks.ensureNonNull("name", name);
         final String key = name.toString();
         if (values.remove(key) == null) {
             return false;
         }
+        List<String> remaining = CollectionsExt.removeFromMultiValuesMap(aliases, key, key);
+        if (remaining != null && remaining.size() == 1) {
+            /*
+             * If there is exactly one remaining element, that element is a non-ambiguous alias.
+             * So we can associate the value to that alias.
+             */
+            final String select = remaining.get(0);
+            assert !select.equals(key) : select;     // Should have been removed by removeFromMultiValuesMap(…).
+            if (values.put(key, values.get(select)) != null) {
+                throw new ConcurrentModificationException(name(store).toString());          // Paranoiac check.
+            }
+        }
         boolean error = false;
         while (name instanceof ScopedName) {
             name = ((ScopedName) name).tail();
             final String alias = name.toString();
-            final List<String> remaining = CollectionsExt.removeFromMultiValuesMap(aliases, alias, key);
+            remaining = CollectionsExt.removeFromMultiValuesMap(aliases, alias, key);
             /*
              * The list of remaining GenericNames may be empty but should never be null unless the tail
              * is inconsistent with the one found by the 'add(…) method.  Otherwise if there is exactly

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureNamingTest.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -23,6 +23,7 @@ import org.apache.sis.util.iso.Names;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
+import org.opengis.util.LocalName;
 
 
 /**
@@ -125,6 +126,39 @@ public final strictfp class FeatureNamin
     }
 
     /**
+     * Tests two names having the same tip, but where only one of the two names have a namespace.
+     *
+     * @throws IllegalNameException if an unexpected error occurred while adding or getting an element.
+     */
+    @Test
+    @DependsOnMethod("testAmbiguity")
+    public void testQualifiedAndUnqualifiedName() throws IllegalNameException {
+        final DataStoreMock store = new DataStoreMock("testDataStore");
+        final LocalName local = Names.createLocalName(null, null, "A");
+        FeatureNaming<Integer> map = new FeatureNaming<>();
+        map.add(store, local,  3);
+        map.add(store, A,      2);
+        map.add(store, B,      5);
+        map.add(store, otherA, 7);
+        assertEquals("B",       Integer.valueOf(5), map.get(store, "B"));
+        assertEquals("A",       Integer.valueOf(3), map.get(store, "A"));
+        assertEquals("myNS:A",  Integer.valueOf(2), map.get(store, "myNS:A"));
+        assertEquals("other:A", Integer.valueOf(7), map.get(store, "other:A"));
+        /*
+         * Same tests, but with elements added in different order.
+         */
+        map = new FeatureNaming<>();
+        map.add(store, otherA, 7);
+        map.add(store, B,      5);
+        map.add(store, A,      2);
+        map.add(store, local,  3);
+        assertEquals("B",       Integer.valueOf(5), map.get(store, "B"));
+        assertEquals("A",       Integer.valueOf(3), map.get(store, "A"));
+        assertEquals("myNS:A",  Integer.valueOf(2), map.get(store, "myNS:A"));
+        assertEquals("other:A", Integer.valueOf(7), map.get(store, "other:A"));
+    }
+
+    /**
      * Tests removing an entry. It should change the state about whether an alias is ambiguous or not.
      *
      * @throws IllegalNameException if an unexpected error occurred while adding or getting an element.

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/GroupAsPolylineOperation.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -164,7 +164,7 @@ class GroupAsPolylineOperation extends A
                 boolean isFirst = true;
                 geometry = new Polyline();
                 for (final Object child : (Collection<?>) feature.getPropertyValue(association)) {
-                    addGeometry(geometry, ((AbstractFeature) child).getPropertyValue("@geometry"), isFirst);
+                    addGeometry(geometry, ((AbstractFeature) child).getPropertyValue("sis:geometry"), isFirst);
                     isFirst = false;
                 }
             }

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Reader.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -109,7 +109,7 @@ final class Reader extends StaxStreamRea
      * Returns {@code true} if the given namespace is a GPX namespace or is null.
      */
     private static boolean isGPX(final String ns) {
-        return (ns == null) || ns.startsWith(Tags.NAMESPACE + "/GPX/");
+        return (ns == null) || ns.startsWith(Tags.NAMESPACE);
     }
 
     /**
@@ -414,8 +414,8 @@ parse:  while (reader.hasNext()) {
                     (lat == null) ? Attributes.LATITUDE : Attributes.LONGITUDE, tagName));
         }
         final AbstractFeature feature = ((Store) owner).types.wayPoint.newInstance();
-        feature.setPropertyValue("@identifier", index);
-        feature.setPropertyValue("@geometry", new Point(parseDouble(lon), parseDouble(lat)));
+        feature.setPropertyValue("sis:identifier", index);
+        feature.setPropertyValue("sis:geometry", new Point(parseDouble(lon), parseDouble(lat)));
         List<Link> links = null;
         while (true) {
             /*
@@ -479,7 +479,7 @@ parse:  while (reader.hasNext()) {
     private AbstractFeature parseRoute(final int index) throws Exception {
         assert reader.isStartElement() && Tags.ROUTES.equals(reader.getLocalName());
         final AbstractFeature feature = ((Store) owner).types.route.newInstance();
-        feature.setPropertyValue("@identifier", index);
+        feature.setPropertyValue("sis:identifier", index);
         List<AbstractFeature> wayPoints = null;
         List<Link> links = null;
         while (true) {
@@ -535,7 +535,7 @@ parse:  while (reader.hasNext()) {
     private AbstractFeature parseTrackSegment(final int index) throws Exception {
         assert reader.isStartElement() && Tags.TRACK_SEGMENTS.equals(reader.getLocalName());
         final AbstractFeature feature = ((Store) owner).types.trackSegment.newInstance();
-        feature.setPropertyValue("@identifier", index);
+        feature.setPropertyValue("sis:identifier", index);
         List<AbstractFeature> wayPoints = null;
         while (true) {
             /*
@@ -578,7 +578,7 @@ parse:  while (reader.hasNext()) {
     private AbstractFeature parseTrack(final int index) throws Exception {
         assert reader.isStartElement() && Tags.TRACKS.equals(reader.getLocalName());
         final AbstractFeature feature = ((Store) owner).types.track.newInstance();
-        feature.setPropertyValue("@identifier", index);
+        feature.setPropertyValue("sis:identifier", index);
         List<AbstractFeature> segments = null;
         List<Link> links = null;
         while (true) {

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Tags.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Tags.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Tags.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Tags.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -33,17 +33,22 @@ final class Tags extends Static {
     /**
      * GPX scope name used for feature type names.
      */
-    static final String NAMESPACE = "http://www.topografix.com";
+    static final String PREFIX = "gpx";
+
+    /**
+     * GPX XML namespace (common root to all versions).
+     */
+    static final String NAMESPACE = "http://www.topografix.com/GPX/";
 
     /**
      * GPX 1.0 XML namespace (v1.0).
      */
-    static final String NAMESPACE_V10 = "http://www.topografix.com/GPX/1/0";
+    static final String NAMESPACE_V10 = NAMESPACE + "1/0";
 
     /**
      * GPX 1.1 XML namespace (v1.1).
      */
-    static final String NAMESPACE_V11 = "http://www.topografix.com/GPX/1/1";
+    static final String NAMESPACE_V11 = NAMESPACE + "1/1";
 
     /** Main GPX XML tags.              */  static final String GPX             = "gpx";
     /** A tag used a bit everywhere.    */  static final String NAME            = "name";

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Types.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -21,7 +21,7 @@ import java.util.Collections;
 import java.util.Locale;
 import java.util.Map;
 import com.esri.core.geometry.Point;
-import org.opengis.util.LocalName;
+import org.opengis.util.ScopedName;
 import org.opengis.util.NameFactory;
 import org.opengis.util.FactoryException;
 import org.opengis.metadata.citation.OnlineResource;
@@ -108,55 +108,55 @@ final class Types extends Static {
      * @throws FactoryException if an error occurred while creating an "envelope bounds" operation.
      */
     Types(final NameFactory factory, final Locale locale) throws FactoryException, IllegalNameException {
-        final LocalName     geomName = AttributeConvention.GEOMETRY_PROPERTY;
+        final ScopedName    geomName = AttributeConvention.GEOMETRY_PROPERTY;
         final Map<String,?> geomInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY, geomName);
         final Map<String,?> envpInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY, AttributeConvention.ENVELOPE_PROPERTY);
         /*
          * The parent of all FeatureTypes to be created in this constructor.
-         * This parent has a single property, "@identifier" of type Integer,
+         * This parent has a single property, "sis:identifier" of type Integer,
          * which is not part of GPX specification.
          *
-         * http://www.topografix.com/GPX/GPXEntity
-         * ┌─────────────┬─────────┬─────────────┐
-         * │ Name        │ Type    │ Cardinality │
-         * ├─────────────┼─────────┼─────────────┤
-         * │ @identifier │ Integer │   [1 … 1]   │      SIS-specific property
-         * └─────────────┴─────────┴─────────────┘
+         * GPXEntity
+         * ┌────────────────┬─────────┬─────────────┐
+         * │ Name           │ Type    │ Cardinality │
+         * ├────────────────┼─────────┼─────────────┤
+         * │ sis:identifier │ Integer │   [1 … 1]   │      SIS-specific property
+         * └────────────────┴─────────┴─────────────┘
          */
         FeatureTypeBuilder builder = new FeatureTypeBuilder(null, factory, locale);
-        builder.setDefaultScope(Tags.NAMESPACE).setName("GPXEntity").setAbstract(true);
+        builder.setNameSpace(Tags.PREFIX).setName("GPXEntity").setAbstract(true);
         builder.addAttribute(Integer.class).setName(AttributeConvention.IDENTIFIER_PROPERTY);
         final DefaultFeatureType parent = builder.build();
         /*
-         * http://www.topografix.com/GPX/WayPoint ⇾ GPXEntity
-         * ┌───────────────┬────────────────┬────────────────────────┬─────────────┐
-         * │ Name          │ Type           │ XML type               │ Cardinality │
-         * ├───────────────┼────────────────┼────────────────────────┼─────────────┤
-         * │ @identifier   │ Integer        │                        │   [1 … 1]   │
-         * │ @envelope     │ Envelope       │                        │   [1 … 1]   │
-         * │ @geometry     │ Point          │ (lat,lon) attributes   │   [1 … 1]   │
-         * │ ele           │ Double         │ xsd:decimal            │   [0 … 1]   │
-         * │ time          │ Temporal       │ xsd:dateTime           │   [0 … 1]   │
-         * │ magvar        │ Double         │ gpx:degreesType        │   [0 … 1]   │
-         * │ geoidheight   │ Double         │ xsd:decimal            │   [0 … 1]   │
-         * │ name          │ String         │ xsd:string             │   [0 … 1]   │
-         * │ cmt           │ String         │ xsd:string             │   [0 … 1]   │
-         * │ desc          │ String         │ xsd:string             │   [0 … 1]   │
-         * │ src           │ String         │ xsd:string             │   [0 … 1]   │
-         * │ link          │ OnlineResource │ gpx:linkType           │   [0 … ∞]   │
-         * │ sym           │ String         │ xsd:string             │   [0 … 1]   │
-         * │ type          │ String         │ xsd:string             │   [0 … 1]   │
-         * │ fix           │ Fix            │ gpx:fixType            │   [0 … 1]   │
-         * │ sat           │ Integer        │ xsd:nonNegativeInteger │   [0 … 1]   │
-         * │ hdop          │ Double         │ xsd:decimal            │   [0 … 1]   │
-         * │ vdop          │ Double         │ xsd:decimal            │   [0 … 1]   │
-         * │ pdop          │ Double         │ xsd:decimal            │   [0 … 1]   │
-         * │ ageofdgpsdata │ Double         │ xsd:decimal            │   [0 … 1]   │
-         * │ dgpsid        │ Integer        │ gpx:dgpsStationType    │   [0 … 1]   │
-         * └───────────────┴────────────────┴────────────────────────┴─────────────┘
+         * WayPoint ⇾ GPXEntity
+         * ┌──────────────────┬────────────────┬────────────────────────┬─────────────┐
+         * │ Name             │ Type           │ XML type               │ Cardinality │
+         * ├──────────────────┼────────────────┼────────────────────────┼─────────────┤
+         * │ sis:identifier   │ Integer        │                        │   [1 … 1]   │
+         * │ sis:envelope     │ Envelope       │                        │   [1 … 1]   │
+         * │ sis:geometry     │ Point          │ (lat,lon) attributes   │   [1 … 1]   │
+         * │ ele              │ Double         │ xsd:decimal            │   [0 … 1]   │
+         * │ time             │ Temporal       │ xsd:dateTime           │   [0 … 1]   │
+         * │ magvar           │ Double         │ gpx:degreesType        │   [0 … 1]   │
+         * │ geoidheight      │ Double         │ xsd:decimal            │   [0 … 1]   │
+         * │ name             │ String         │ xsd:string             │   [0 … 1]   │
+         * │ cmt              │ String         │ xsd:string             │   [0 … 1]   │
+         * │ desc             │ String         │ xsd:string             │   [0 … 1]   │
+         * │ src              │ String         │ xsd:string             │   [0 … 1]   │
+         * │ link             │ OnlineResource │ gpx:linkType           │   [0 … ∞]   │
+         * │ sym              │ String         │ xsd:string             │   [0 … 1]   │
+         * │ type             │ String         │ xsd:string             │   [0 … 1]   │
+         * │ fix              │ Fix            │ gpx:fixType            │   [0 … 1]   │
+         * │ sat              │ Integer        │ xsd:nonNegativeInteger │   [0 … 1]   │
+         * │ hdop             │ Double         │ xsd:decimal            │   [0 … 1]   │
+         * │ vdop             │ Double         │ xsd:decimal            │   [0 … 1]   │
+         * │ pdop             │ Double         │ xsd:decimal            │   [0 … 1]   │
+         * │ ageofdgpsdata    │ Double         │ xsd:decimal            │   [0 … 1]   │
+         * │ dgpsid           │ Integer        │ gpx:dgpsStationType    │   [0 … 1]   │
+         * └──────────────────┴────────────────┴────────────────────────┴─────────────┘
          */
         builder = new FeatureTypeBuilder(null, factory, locale).setSuperTypes(parent);
-        builder.setDefaultScope(Tags.NAMESPACE).setName("WayPoint");
+        builder.setNameSpace(Tags.PREFIX).setName("WayPoint");
         builder.addAttribute(Point.class).setName(geomName)
                 .setCRS(CommonCRS.WGS84.normalizedGeographic())
                 .addRole(AttributeRole.DEFAULT_GEOMETRY);
@@ -181,26 +181,26 @@ final class Types extends Static {
         builder.addAttribute(Integer       .class).setName(Tags.DGPS_ID);
         wayPoint = builder.build();
         /*
-         * http://www.topografix.com/GPX/Route ⇾ GPXEntity
-         * ┌─────────────┬────────────────┬────────────────────────┬─────────────┐
-         * │ Name        │ Type           │ XML type               │ Cardinality │
-         * ├─────────────┼────────────────┼────────────────────────┼─────────────┤
-         * │ @identifier │ Integer        │                        │   [1 … 1]   │
-         * │ @envelope   │ Envelope       │                        │   [1 … 1]   │
-         * │ @geometry   │ Polyline       │                        │   [1 … 1]   │
-         * │ name        │ String         │ xsd:string             │   [0 … 1]   │
-         * │ cmt         │ String         │ xsd:string             │   [0 … 1]   │
-         * │ desc        │ String         │ xsd:string             │   [0 … 1]   │
-         * │ src         │ String         │ xsd:string             │   [0 … 1]   │
-         * │ link        │ OnlineResource │ gpx:linkType           │   [0 … ∞]   │
-         * │ number      │ Integer        │ xsd:nonNegativeInteger │   [0 … 1]   │
-         * │ type        │ String         │ xsd:string             │   [0 … 1]   │
-         * │ rtept       │ WayPoint       │ gpx:wptType            │   [0 … ∞]   │
-         * └─────────────┴────────────────┴────────────────────────┴─────────────┘
+         * Route ⇾ GPXEntity
+         * ┌────────────────┬────────────────┬────────────────────────┬─────────────┐
+         * │ Name           │ Type           │ XML type               │ Cardinality │
+         * ├────────────────┼────────────────┼────────────────────────┼─────────────┤
+         * │ sis:identifier │ Integer        │                        │   [1 … 1]   │
+         * │ sis:envelope   │ Envelope       │                        │   [1 … 1]   │
+         * │ sis:geometry   │ Polyline       │                        │   [1 … 1]   │
+         * │ name           │ String         │ xsd:string             │   [0 … 1]   │
+         * │ cmt            │ String         │ xsd:string             │   [0 … 1]   │
+         * │ desc           │ String         │ xsd:string             │   [0 … 1]   │
+         * │ src            │ String         │ xsd:string             │   [0 … 1]   │
+         * │ link           │ OnlineResource │ gpx:linkType           │   [0 … ∞]   │
+         * │ number         │ Integer        │ xsd:nonNegativeInteger │   [0 … 1]   │
+         * │ type           │ String         │ xsd:string             │   [0 … 1]   │
+         * │ rtept          │ WayPoint       │ gpx:wptType            │   [0 … ∞]   │
+         * └────────────────┴────────────────┴────────────────────────┴─────────────┘
          */
         GroupAsPolylineOperation groupOp = new GroupPointsAsPolylineOperation(geomInfo, Tags.ROUTE_POINTS);
         builder = new FeatureTypeBuilder(null, factory, locale).setSuperTypes(parent);
-        builder.setDefaultScope(Tags.NAMESPACE).setName("Route");
+        builder.setNameSpace(Tags.PREFIX).setName("Route");
         builder.addProperty(groupOp);
         builder.addProperty(FeatureOperations.envelope(envpInfo, null, groupOp));
         builder.setDefaultCardinality(0, 1);
@@ -214,45 +214,45 @@ final class Types extends Static {
         builder.addAssociation(wayPoint).setName(Tags.ROUTE_POINTS).setMaximumOccurs(Integer.MAX_VALUE);
         route = builder.build();
         /*
-         * http://www.topografix.com/GPX/TrackSegment ⇾ GPXEntity
-         * ┌─────────────┬──────────┬─────────────┬─────────────┐
-         * │ Name        │ Type     │ XML type    │ Cardinality │
-         * ├─────────────┼──────────┼─────────────┼─────────────┤
-         * │ @identifier │ Integer  │             │   [1 … 1]   │
-         * │ @envelope   │ Envelope │             │   [1 … 1]   │
-         * │ @geometry   │ Polyline │             │   [1 … 1]   │
-         * │ trkpt       │ WayPoint │ gpx:wptType │   [0 … ∞]   │
-         * └─────────────┴──────────┴─────────────┴─────────────┘
+         * TrackSegment ⇾ GPXEntity
+         * ┌────────────────┬──────────┬─────────────┬─────────────┐
+         * │ Name           │ Type     │ XML type    │ Cardinality │
+         * ├────────────────┼──────────┼─────────────┼─────────────┤
+         * │ sis:identifier │ Integer  │             │   [1 … 1]   │
+         * │ sis:envelope   │ Envelope │             │   [1 … 1]   │
+         * │ sis:geometry   │ Polyline │             │   [1 … 1]   │
+         * │ trkpt          │ WayPoint │ gpx:wptType │   [0 … ∞]   │
+         * └────────────────┴──────────┴─────────────┴─────────────┘
          */
         groupOp = new GroupPointsAsPolylineOperation(geomInfo, Tags.TRACK_POINTS);
         builder = new FeatureTypeBuilder(null, factory, locale).setSuperTypes(parent);
-        builder.setDefaultScope(Tags.NAMESPACE).setName("TrackSegment");
+        builder.setNameSpace(Tags.PREFIX).setName("TrackSegment");
         builder.addProperty(groupOp);
         builder.addProperty(FeatureOperations.envelope(envpInfo, null, groupOp));
         builder.setDefaultCardinality(0, 1);
         builder.addAssociation(wayPoint).setName(Tags.TRACK_POINTS).setMaximumOccurs(Integer.MAX_VALUE);
         trackSegment = builder.build();
         /*
-         * http://www.topografix.com/GPX/Track ⇾ GPXEntity
-         * ┌─────────────┬────────────────┬────────────────────────┬─────────────┐
-         * │ Name        │ Type           │ XML type               │ Cardinality │
-         * ├─────────────┼────────────────┼────────────────────────┼─────────────┤
-         * │ @identifier │ Integer        │                        │   [1 … 1]   │
-         * │ @envelope   │ Envelope       │                        │   [1 … 1]   │
-         * │ @geometry   │ Polyline       │                        │   [1 … 1]   │
-         * │ name        │ String         │ xsd:string             │   [0 … 1]   │
-         * │ cmt         │ String         │ xsd:string             │   [0 … 1]   │
-         * │ desc        │ String         │ xsd:string             │   [0 … 1]   │
-         * │ src         │ String         │ xsd:string             │   [0 … 1]   │
-         * │ link        │ OnlineResource │ gpx:linkType           │   [0 … ∞]   │
-         * │ number      │ Integer        │ xsd:nonNegativeInteger │   [0 … 1]   │
-         * │ type        │ String         │ xsd:string             │   [0 … 1]   │
-         * │ trkseg      │ TrackSegment   │ gpx:trksegType         │   [0 … ∞]   │
-         * └─────────────┴────────────────┴────────────────────────┴─────────────┘
+         * Track ⇾ GPXEntity
+         * ┌────────────────┬────────────────┬────────────────────────┬─────────────┐
+         * │ Name           │ Type           │ XML type               │ Cardinality │
+         * ├────────────────┼────────────────┼────────────────────────┼─────────────┤
+         * │ sis:identifier │ Integer        │                        │   [1 … 1]   │
+         * │ sis:envelope   │ Envelope       │                        │   [1 … 1]   │
+         * │ sis:geometry   │ Polyline       │                        │   [1 … 1]   │
+         * │ name           │ String         │ xsd:string             │   [0 … 1]   │
+         * │ cmt            │ String         │ xsd:string             │   [0 … 1]   │
+         * │ desc           │ String         │ xsd:string             │   [0 … 1]   │
+         * │ src            │ String         │ xsd:string             │   [0 … 1]   │
+         * │ link           │ OnlineResource │ gpx:linkType           │   [0 … ∞]   │
+         * │ number         │ Integer        │ xsd:nonNegativeInteger │   [0 … 1]   │
+         * │ type           │ String         │ xsd:string             │   [0 … 1]   │
+         * │ trkseg         │ TrackSegment   │ gpx:trksegType         │   [0 … ∞]   │
+         * └────────────────┴────────────────┴────────────────────────┴─────────────┘
          */
         groupOp = new GroupAsPolylineOperation(geomInfo, Tags.TRACK_SEGMENTS);
         builder = new FeatureTypeBuilder(null, factory, locale).setSuperTypes(parent);
-        builder.setDefaultScope(Tags.NAMESPACE).setName("Track");
+        builder.setNameSpace(Tags.PREFIX).setName("Track");
         builder.addProperty(groupOp);
         builder.addProperty(FeatureOperations.envelope(envpInfo, null, groupOp));
         builder.setDefaultCardinality(0, 1);

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -191,7 +191,7 @@ final class Writer extends StaxStreamWri
      */
     private void writeWayPoint(final AbstractFeature feature, final String tagName) throws XMLStreamException, JAXBException {
         if (feature != null) {
-            final Point pt = (Point) feature.getPropertyValue("@geometry");
+            final Point pt = (Point) feature.getPropertyValue("sis:geometry");
             writer.writeStartElement(tagName);
             writer.writeAttribute(Attributes.LATITUDE, Double.toString(pt.getY()));
             writer.writeAttribute(Attributes.LONGITUDE, Double.toString(pt.getX()));

Modified: sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -23,6 +23,7 @@ import com.esri.core.geometry.Point;
 import com.esri.core.geometry.Polyline;
 import org.opengis.geometry.Envelope;
 import org.opengis.metadata.content.FeatureCatalogueDescription;
+import org.apache.sis.setup.OptionKey;
 import org.apache.sis.storage.gps.Fix;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
@@ -334,12 +335,12 @@ public final strictfp class ReaderTest e
         verifyPoint((AbstractFeature) points.get(1), 1, v11);
         verifyPoint((AbstractFeature) points.get(2), 2, v11);
 
-        final Polyline p = (Polyline) f.getPropertyValue("@geometry");
+        final Polyline p = (Polyline) f.getPropertyValue("sis:geometry");
         assertEquals("pointCount", 3, p.getPointCount());
         assertEquals("point(0)", new Point(15, 10), p.getPoint(0));
         assertEquals("point(1)", new Point(25, 20), p.getPoint(1));
         assertEquals("point(2)", new Point(35, 30), p.getPoint(2));
-        assertEnvelopeEquals(15, 35, 10, 30, (Envelope) f.getPropertyValue("@envelope"));
+        assertEnvelopeEquals(15, 35, 10, 30, (Envelope) f.getPropertyValue("sis:envelope"));
     }
 
     /**
@@ -358,7 +359,7 @@ public final strictfp class ReaderTest e
 
         assertTrue( "links.isEmpty()", ((Collection<?>) f.getPropertyValue("link" )).isEmpty());
         assertTrue("points.isEmpty()", ((Collection<?>) f.getPropertyValue(dep)).isEmpty());
-        assertNull("@envelope",                         f.getPropertyValue("@envelope"));
+        assertNull("sis:envelope",                      f.getPropertyValue("sis:envelope"));
     }
 
     /**
@@ -438,12 +439,12 @@ public final strictfp class ReaderTest e
         verifyPoint((AbstractFeature) points.get(2), 2, v11);
         assertTrue(((Collection<?>) seg2.getPropertyValue("trkpt")).isEmpty());
 
-        final Polyline p = (Polyline) f.getPropertyValue("@geometry");
+        final Polyline p = (Polyline) f.getPropertyValue("sis:geometry");
         assertEquals("pointCount", 3, p.getPointCount());
         assertEquals("point(0)", new Point(15, 10), p.getPoint(0));
         assertEquals("point(1)", new Point(25, 20), p.getPoint(1));
         assertEquals("point(2)", new Point(35, 30), p.getPoint(2));
-        assertEnvelopeEquals(15, 35, 10, 30, (Envelope) f.getPropertyValue("@envelope"));
+        assertEnvelopeEquals(15, 35, 10, 30, (Envelope) f.getPropertyValue("sis:envelope"));
     }
 
     /**
@@ -454,12 +455,12 @@ public final strictfp class ReaderTest e
      * @param  v11    {@code true} for GPX 1.1, or {@code false} for GPX 1.0.
      */
     private static void verifyPoint(final AbstractFeature f, final int index, final boolean v11) {
-        assertEquals("@identifier", index + 1, f.getPropertyValue("@identifier"));
+        assertEquals("sis:identifier", index + 1, f.getPropertyValue("sis:identifier"));
         switch (index) {
             case 0: {
                 assertEquals(Instant.parse("2010-01-10T00:00:00Z"), f.getPropertyValue("time"));
-                assertEquals("x",               15.0,      ((Point) f.getPropertyValue("@geometry")).getX(), STRICT);
-                assertEquals("y",               10.0,      ((Point) f.getPropertyValue("@geometry")).getY(), STRICT);
+                assertEquals("x",               15.0,      ((Point) f.getPropertyValue("sis:geometry")).getX(), STRICT);
+                assertEquals("y",               10.0,      ((Point) f.getPropertyValue("sis:geometry")).getY(), STRICT);
                 assertEquals("ele",            140.0,               f.getPropertyValue("ele"));
                 assertEquals("magvar",          35.0,               f.getPropertyValue("magvar"));
                 assertEquals("geoidheight",    112.32,              f.getPropertyValue("geoidheight"));
@@ -483,12 +484,12 @@ public final strictfp class ReaderTest e
                     assertStringEquals("http://first-address2.org", links.get(1));
                     assertStringEquals("http://first-address3.org", links.get(2));
                 }
-                assertEnvelopeEquals(15, 15, 10, 10, (Envelope) f.getPropertyValue("@envelope"));
+                assertEnvelopeEquals(15, 15, 10, 10, (Envelope) f.getPropertyValue("sis:envelope"));
                 break;
             }
             case 1: {
-                assertEquals("x", 25, ((Point)f.getPropertyValue("@geometry")).getX(), STRICT);
-                assertEquals("y", 20, ((Point)f.getPropertyValue("@geometry")).getY(), STRICT);
+                assertEquals("x", 25, ((Point)f.getPropertyValue("sis:geometry")).getX(), STRICT);
+                assertEquals("y", 20, ((Point)f.getPropertyValue("sis:geometry")).getY(), STRICT);
                 assertNull("ele",             f.getPropertyValue("ele"));
                 assertNull("time",            f.getPropertyValue("time"));
                 assertNull("magvar",          f.getPropertyValue("magvar"));
@@ -507,13 +508,13 @@ public final strictfp class ReaderTest e
                 assertNull("ageofdgpsdata",   f.getPropertyValue("ageofdgpsdata"));
                 assertNull("dgpsid",          f.getPropertyValue("dgpsid"));
                 assertTrue("links.isEmpty()", ((List<?>) f.getPropertyValue("link")).isEmpty());
-                assertEnvelopeEquals(25, 25, 20, 20, (Envelope) f.getPropertyValue("@envelope"));
+                assertEnvelopeEquals(25, 25, 20, 20, (Envelope) f.getPropertyValue("sis:envelope"));
                 break;
             }
             case 2: {
                 assertEquals(Instant.parse("2010-01-30T00:00:00Z"),  f.getPropertyValue("time"));
-                assertEquals("x",               35.0,       ((Point) f.getPropertyValue("@geometry")).getX(), STRICT);
-                assertEquals("y",               30.0,       ((Point) f.getPropertyValue("@geometry")).getY(), STRICT);
+                assertEquals("x",               35.0,       ((Point) f.getPropertyValue("sis:geometry")).getX(), STRICT);
+                assertEquals("y",               30.0,       ((Point) f.getPropertyValue("sis:geometry")).getY(), STRICT);
                 assertEquals("ele",            150.0,                f.getPropertyValue("ele"));
                 assertEquals("magvar",          25.0,                f.getPropertyValue("magvar"));
                 assertEquals("geoidheight",    142.32,               f.getPropertyValue("geoidheight"));
@@ -536,7 +537,7 @@ public final strictfp class ReaderTest e
                 if (v11) {
                     assertStringEquals("http://third-address2.org", links.get(1));
                 }
-                assertEnvelopeEquals(35, 35, 30, 30, (Envelope) f.getPropertyValue("@envelope"));
+                assertEnvelopeEquals(35, 35, 30, 30, (Envelope) f.getPropertyValue("sis:envelope"));
                 break;
             }
             default: {
@@ -565,7 +566,9 @@ public final strictfp class ReaderTest e
      * Using the URL makes easier for the data store to read the same data more than once.
      */
     private static Store createFromURL() throws DataStoreException {
-        return new Store(provider, new StorageConnector(ReaderTest.class.getResource("1.1/route.xml")));
+        final StorageConnector connector = new StorageConnector(ReaderTest.class.getResource("1.1/route.xml"));
+        connector.setOption(OptionKey.URL_ENCODING, "UTF-8");
+        return new Store(provider, connector);
     }
 
     /**

Modified: sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java?rev=1791995&r1=1791994&r2=1791995&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java [UTF-8] Wed Apr 19 21:57:11 2017
@@ -252,7 +252,7 @@ public final strictfp class WriterTest e
          * Appear also in "route.xml" and "track.xml" files.
          */
         final AbstractFeature point1 = types.wayPoint.newInstance();
-        point1.setPropertyValue("@geometry",     new Point(15, 10));
+        point1.setPropertyValue("sis:geometry",  new Point(15, 10));
         point1.setPropertyValue("time",          Instant.parse("2010-01-10T00:00:00Z"));
         point1.setPropertyValue("name",          "first point");
         point1.setPropertyValue("cmt",           "first comment");
@@ -274,7 +274,7 @@ public final strictfp class WriterTest e
                                                                new Link(new URI("http://first-address2.org")),
                                                                new Link(new URI("http://first-address3.org"))));
         final AbstractFeature point3 = types.wayPoint.newInstance();
-        point3.setPropertyValue("@geometry",     new Point(35, 30));
+        point3.setPropertyValue("sis:geometry",  new Point(35, 30));
         point3.setPropertyValue("time",          Instant.parse("2010-01-30T00:00:00Z"));
         point3.setPropertyValue("name",          "third point");
         point3.setPropertyValue("cmt",           "third comment");
@@ -295,7 +295,7 @@ public final strictfp class WriterTest e
         point3.setPropertyValue("link",          Arrays.asList(new Link(new URI("http://third-address1.org")),
                                                                new Link(new URI("http://third-address2.org"))));
         final AbstractFeature point2 = types.wayPoint.newInstance();
-        point2.setPropertyValue("@geometry", new Point(25, 20));
+        point2.setPropertyValue("sis:geometry", new Point(25, 20));
         final List<AbstractFeature> wayPoints = Arrays.asList(point1, point2, point3);
         final List<AbstractFeature> features;
         switch (type) {



Mime
View raw message