sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1780148 [2/2] - in /sis/branches/JDK8: application/sis-console/ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-console/src/test/java/org/apache/sis/console/ core/sis-utility/src/main/java/org/apache/sis/measu...
Date Wed, 25 Jan 2017 08:40:16 GMT
Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java?rev=1780148&r1=1780147&r2=1780148&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/StoreProvider.java
[UTF-8] Wed Jan 25 08:40:16 2017
@@ -24,6 +24,8 @@ import org.apache.sis.storage.StorageCon
 import org.apache.sis.internal.storage.Capability;
 import org.apache.sis.internal.storage.Capabilities;
 import org.apache.sis.internal.storage.xml.stream.StaxDataStoreProvider;
+import org.apache.sis.measure.Range;
+import org.apache.sis.util.Version;
 
 
 /**
@@ -39,6 +41,21 @@ import org.apache.sis.internal.storage.x
 @Capabilities({Capability.READ, Capability.WRITE})
 public final class StoreProvider extends StaxDataStoreProvider {
     /**
+     * The "1.0" version.
+     */
+    static final Version V1_0 = Version.valueOf(1,0);
+
+    /**
+     * The "1.1" version.
+     */
+    static final Version V1_1 = Version.valueOf(1,1);
+
+    /**
+     * The range of versions returned by {@link #getSupportedVersions()}.
+     */
+    private static final Range<Version> VERSIONS = new Range<>(Version.class,
V1_0, true, V1_1, true);
+
+    /**
      * Creates a new GPX store provider.
      */
     public StoreProvider() {
@@ -48,6 +65,16 @@ public final class StoreProvider extends
     }
 
     /**
+     * Returns the range of versions supported by the GPX data store.
+     *
+     * @return the range of supported versions.
+     */
+    @Override
+    public Range<Version> getSupportedVersions() {
+        return VERSIONS;
+    }
+
+    /**
      * Returns a GPX {@link Store} implementation associated with this provider.
      *
      * @param  connector  information about the storage (URL, stream, <i>etc</i>).

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java?rev=1780148&r1=1780147&r2=1780148&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Writer.java
[UTF-8] Wed Jan 25 08:40:16 2017
@@ -67,7 +67,7 @@ final class Writer extends StaxStreamWri
         super(owner);
         this.metadata = metadata;
         final Version ver = owner.version;
-        if (ver != null && ver.compareTo(Store.V1_0, 2) <= 0) {
+        if (ver != null && ver.compareTo(StoreProvider.V1_0, 2) <= 0) {
             version = 0;
         } else {
             version = 1;
@@ -86,8 +86,8 @@ final class Writer extends StaxStreamWri
         final Version ver;
         switch (version) {
             default:
-            case 1: ver = Store.V1_1; namespace = Tags.NAMESPACE_V11; break;
-            case 0: ver = Store.V1_0; namespace = Tags.NAMESPACE_V10; break;
+            case 1: ver = StoreProvider.V1_1; namespace = Tags.NAMESPACE_V11; break;
+            case 0: ver = StoreProvider.V1_0; namespace = Tags.NAMESPACE_V10; break;
         }
         super.writeStartDocument();
         writer.setDefaultNamespace(namespace);

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java?rev=1780148&r1=1780147&r2=1780148&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java
[UTF-8] Wed Jan 25 08:40:16 2017
@@ -139,7 +139,7 @@ public final strictfp class ReaderTest e
             verifyMetadata(md, 1);
             assertNull(md.author.link);
             assertNull(md.copyright);
-            assertEquals("version", Store.V1_0, reader.getVersion());
+            assertEquals("version", StoreProvider.V1_0, reader.getVersion());
         }
     }
 
@@ -157,7 +157,7 @@ public final strictfp class ReaderTest e
             assertEquals("Apache", md.copyright.author);
             assertEquals(2004, md.copyright.year.intValue());
             assertStringEquals("http://www.apache.org/licenses/LICENSE-2.0", md.copyright.license);
-            assertEquals("version", Store.V1_1, reader.getVersion());
+            assertEquals("version", StoreProvider.V1_1, reader.getVersion());
         }
     }
 
@@ -222,8 +222,8 @@ public final strictfp class ReaderTest e
     public void testWayPoint100() throws DataStoreException {
         try (final Store reader = create("1.0/waypoint.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
-            assertEquals("version", Store.V1_0, reader.getVersion());
-            try (final Stream<Feature> features = reader.getFeatures()) {
+            assertEquals("version", StoreProvider.V1_0, reader.getVersion());
+            try (final Stream<Feature> features = reader.features()) {
                 final Iterator<Feature> it = features.iterator();
                 verifyPoint(it.next(), 0, false);
                 verifyPoint(it.next(), 1, false);
@@ -243,8 +243,8 @@ public final strictfp class ReaderTest e
     public void testWayPoint110() throws DataStoreException {
         try (final Store reader = create("1.1/waypoint.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
-            assertEquals("version", Store.V1_1, reader.getVersion());
-            try (final Stream<Feature> features = reader.getFeatures()) {
+            assertEquals("version", StoreProvider.V1_1, reader.getVersion());
+            try (final Stream<Feature> features = reader.features()) {
                 final Iterator<Feature> it = features.iterator();
                 verifyPoint(it.next(), 0, true);
                 verifyPoint(it.next(), 1, true);
@@ -264,8 +264,8 @@ public final strictfp class ReaderTest e
     public void testRoute100() throws DataStoreException {
         try (final Store reader = create("1.0/route.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
-            assertEquals("version", Store.V1_0, reader.getVersion());
-            try (final Stream<Feature> features = reader.getFeatures()) {
+            assertEquals("version", StoreProvider.V1_0, reader.getVersion());
+            try (final Stream<Feature> features = reader.features()) {
                 final Iterator<Feature> it = features.iterator();
                 verifyRoute(it.next(), false, 1);
                 verifyEmpty(it.next(), "rtept");
@@ -284,7 +284,7 @@ public final strictfp class ReaderTest e
     public void testRoute110() throws DataStoreException {
         try (final Store reader = create("1.1/route.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
-            assertEquals("version", Store.V1_1, reader.getVersion());
+            assertEquals("version", StoreProvider.V1_1, reader.getVersion());
             verifyRoute110(reader);
         }
     }
@@ -294,7 +294,7 @@ public final strictfp class ReaderTest e
      * This verification is shared by {@link #testRoute110()} and {@link #testSequentialReads()}.
      */
     static void verifyRoute110(final Store reader) throws DataStoreException {
-        try (final Stream<Feature> features = reader.getFeatures()) {
+        try (final Stream<Feature> features = reader.features()) {
             final Iterator<Feature> it = features.iterator();
             verifyRoute(it.next(), true, 3);
             verifyEmpty(it.next(), "rtept");
@@ -371,8 +371,8 @@ public final strictfp class ReaderTest e
     public void testTrack100() throws DataStoreException {
         try (final Store reader = create("1.0/track.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
-            assertEquals("version", Store.V1_0, reader.getVersion());
-            try (final Stream<Feature> features = reader.getFeatures()) {
+            assertEquals("version", StoreProvider.V1_0, reader.getVersion());
+            try (final Stream<Feature> features = reader.features()) {
                 final Iterator<Feature> it = features.iterator();
                 verifyTrack(it.next(), false, 1);
                 verifyEmpty(it.next(), "trkseg");
@@ -391,8 +391,8 @@ public final strictfp class ReaderTest e
     public void testTrack110() throws DataStoreException {
         try (final Store reader = create("1.1/track.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
-            assertEquals("version", Store.V1_1, reader.getVersion());
-            try (final Stream<Feature> features = reader.getFeatures()) {
+            assertEquals("version", StoreProvider.V1_1, reader.getVersion());
+            try (final Stream<Feature> features = reader.features()) {
                 final Iterator<Feature> it = features.iterator();
                 verifyTrack(it.next(), true, 3);
                 verifyEmpty(it.next(), "trkseg");
@@ -583,8 +583,8 @@ public final strictfp class ReaderTest e
             verifyRoute110(reader);
             /*
              * Ask for metadata only after a first read, for testing the way the store manages
readers.
-             * The new 'getFeatures()' call should reuse the reader created by 'getMetadata()'
- this
-             * can be verified by stepping in the code with a debugger.
+             * The new 'features()' call should reuse the reader created by 'getMetadata()'
- this can
+             * be verified by stepping in the code with a debugger.
              */
             md = (Metadata) reader.getMetadata();
             verifyRoute110(reader);
@@ -607,13 +607,13 @@ public final strictfp class ReaderTest e
     @DependsOnMethod("testSequentialReads")
     public void testConcurrentReads() throws DataStoreException {
         try (final Store reader = createFromURL()) {
-            final Stream<Feature>   f1 = reader.getFeatures();
+            final Stream<Feature>   f1 = reader.features();
             final Iterator<Feature> i1 = f1.iterator();
             verifyRoute(i1.next(), true, 3);
-            final Stream<Feature>   f2 = reader.getFeatures();
+            final Stream<Feature>   f2 = reader.features();
             final Iterator<Feature> i2 = f2.iterator();
             verifyEmpty(i1.next(), "rtept");
-            final Stream<Feature>   f3 = reader.getFeatures();
+            final Stream<Feature>   f3 = reader.features();
             final Iterator<Feature> i3 = f3.iterator();
             verifyRoute(i2.next(), true, 3);
             verifyRoute(i3.next(), true, 3);

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java?rev=1780148&r1=1780147&r2=1780148&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
[UTF-8] Wed Jan 25 08:40:16 2017
@@ -112,7 +112,7 @@ public final strictfp class WriterTest e
      */
     @Test
     public void testMetadata100() throws Exception {
-        testMetadata(Store.V1_0, "1.0/metadata.xml");
+        testMetadata(StoreProvider.V1_0, "1.0/metadata.xml");
     }
 
     /**
@@ -123,7 +123,7 @@ public final strictfp class WriterTest e
      */
     @Test
     public void testMetadata110() throws Exception {
-        testMetadata(Store.V1_1, "1.1/metadata.xml");
+        testMetadata(StoreProvider.V1_1, "1.1/metadata.xml");
     }
 
     /**
@@ -152,7 +152,7 @@ public final strictfp class WriterTest e
     @Test
     @DependsOnMethod("testMetadata100")
     public void testWayPoints100() throws Exception {
-        testFeatures(Store.V1_0, Type.WAY_POINT, "1.0/waypoint.xml");
+        testFeatures(StoreProvider.V1_0, Type.WAY_POINT, "1.0/waypoint.xml");
     }
 
     /**
@@ -164,7 +164,7 @@ public final strictfp class WriterTest e
     @Test
     @DependsOnMethod("testMetadata110")
     public void testWayPoints110() throws Exception {
-        testFeatures(Store.V1_1, Type.WAY_POINT, "1.1/waypoint.xml");
+        testFeatures(StoreProvider.V1_1, Type.WAY_POINT, "1.1/waypoint.xml");
     }
 
     /**
@@ -176,7 +176,7 @@ public final strictfp class WriterTest e
     @Test
     @DependsOnMethod("testWayPoints100")
     public void testRoutes100() throws Exception {
-        testFeatures(Store.V1_0, Type.ROUTE, "1.0/route.xml");
+        testFeatures(StoreProvider.V1_0, Type.ROUTE, "1.0/route.xml");
     }
 
     /**
@@ -188,7 +188,7 @@ public final strictfp class WriterTest e
     @Test
     @DependsOnMethod("testWayPoints110")
     public void testRoutes110() throws Exception {
-        testFeatures(Store.V1_1, Type.ROUTE, "1.1/route.xml");
+        testFeatures(StoreProvider.V1_1, Type.ROUTE, "1.1/route.xml");
     }
 
     /**
@@ -200,7 +200,7 @@ public final strictfp class WriterTest e
     @Test
     @DependsOnMethod("testRoutes100")
     public void testTracks100() throws Exception {
-        testFeatures(Store.V1_0, Type.TRACK, "1.0/track.xml");
+        testFeatures(StoreProvider.V1_0, Type.TRACK, "1.0/track.xml");
     }
 
     /**
@@ -212,7 +212,7 @@ public final strictfp class WriterTest e
     @Test
     @DependsOnMethod("testRoutes110")
     public void testTracks110() throws Exception {
-        testFeatures(Store.V1_1, Type.TRACK, "1.1/track.xml");
+        testFeatures(StoreProvider.V1_1, Type.TRACK, "1.1/track.xml");
     }
 
     /**
@@ -372,7 +372,7 @@ public final strictfp class WriterTest e
              * but the main purpose of following code is to advance in the stream.
              */
             ReaderTest.verifyMetadata((Metadata) store.getMetadata(), 3);
-            assertEquals("version", Store.V1_1, store.getVersion());
+            assertEquals("version", StoreProvider.V1_1, store.getVersion());
             /*
              * Replace the metadata content by route content. The data store should rewind
              * to the begining of the file and replace the input stream by an output stream.



Mime
View raw message