sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1807629 [5/5] - in /sis/trunk: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/metadata/ core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/ core/sis-referen...
Date Thu, 07 Sep 2017 16:55:03 GMT
Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java?rev=1807629&r1=1807628&r2=1807629&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/gpx/Store.java
[UTF-8] Thu Sep  7 16:55:01 2017
@@ -19,15 +19,17 @@ package org.apache.sis.internal.storage.
 import java.net.URISyntaxException;
 import org.opengis.util.NameFactory;
 import org.opengis.util.FactoryException;
+import org.opengis.geometry.Envelope;
 import org.opengis.metadata.Metadata;
 import org.opengis.metadata.distribution.Format;
-import org.apache.sis.storage.Resource;
+import org.apache.sis.storage.FeatureSet;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.storage.ConcurrentReadException;
 import org.apache.sis.storage.IllegalNameException;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.storage.AbstractDataSet;
 import org.apache.sis.internal.storage.xml.stream.StaxDataStore;
 import org.apache.sis.util.collection.BackingStoreException;
 import org.apache.sis.util.ArgumentChecks;
@@ -56,7 +58,7 @@ import org.apache.sis.feature.DefaultFea
  * @since   0.8
  * @module
  */
-public final class Store extends StaxDataStore {
+public final class Store extends StaxDataStore implements FeatureSet {
     /**
      * Version of the GPX file, or {@code null} if unknown.
      */
@@ -168,13 +170,24 @@ public final class Store extends StaxDat
     }
 
     /**
-     * Returns the {@code FeatureSet} from which all features in this data store can be accessed.
+     * Returns the spatio-temporal envelope of this resource.
      *
-     * @return the starting point of all features in this data store.
+     * @return the spatio-temporal resource extent.
+     * @throws DataStoreException if an error occurred while reading or computing the envelope.
      */
     @Override
-    public Resource getRootResource() {
-        return new FeatureAccess(this, listeners);
+    public Envelope getEnvelope() throws DataStoreException {
+        return AbstractDataSet.envelope(getMetadata());
+    }
+
+    /**
+     * Returns the base type of all GPX types.
+     *
+     * @return base type of all GPX types.
+     */
+    @Override
+    public DefaultFeatureType getType() {
+        return types.parent;
     }
 
     /**
@@ -196,10 +209,12 @@ public final class Store extends StaxDat
     /**
      * Returns the stream of features.
      *
+     * @param  parallel  ignored in current implementation.
      * @return a stream over all features in the XML file.
      * @throws DataStoreException if an error occurred while creating the feature stream.
      */
-    final synchronized Stream<AbstractFeature> features() throws DataStoreException
{
+    @Override
+    public final synchronized Stream<AbstractFeature> features(boolean parallel) throws
DataStoreException {
         Reader r = reader;
         reader = null;
         if (r == null) try {

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java?rev=1807629&r1=1807628&r2=1807629&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
[UTF-8] Thu Sep  7 16:55:01 2017
@@ -38,6 +38,7 @@ import org.apache.sis.setup.OptionKey;
 import org.apache.sis.storage.DataStore;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.internal.storage.URIDataStore;
 import org.apache.sis.internal.storage.io.ChannelFactory;
 import org.apache.sis.internal.storage.io.IOUtilities;
 import org.apache.sis.internal.storage.io.Markable;
@@ -64,7 +65,7 @@ import org.apache.sis.util.Debug;
  * @since   0.8
  * @module
  */
-public abstract class StaxDataStore extends DataStore {
+public abstract class StaxDataStore extends URIDataStore {
     /**
      * The locale to use for locale-sensitive data (<strong>not</strong> for
logging or warning messages),
      * or {@code null} if unspecified.
@@ -372,8 +373,11 @@ public abstract class StaxDataStore exte
 
     /**
      * Returns the factory that created this {@code DataStore} instance, or {@code null}
if unspecified.
+     *
+     * @return the factory that created this {@code DataStore} instance, or {@code null}
if unspecified.
      */
-    final StaxDataStoreProvider getProvider() {
+    @Override
+    public final StaxDataStoreProvider getProvider() {
         return (StaxDataStoreProvider) provider;
     }
 

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java?rev=1807629&r1=1807628&r2=1807629&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java
[UTF-8] Thu Sep  7 16:55:01 2017
@@ -338,12 +338,12 @@ public abstract class StaxStreamReader e
     }
 
     /**
-     * Returns the current value of {@link XMLStreamReader#getElementText()} as an URI,
+     * Returns the current value of {@link XMLStreamReader#getElementText()} as a URI,
      * or {@code null} if that value is null or empty.
      *
-     * @return the current text element as an URI, or {@code null} if empty.
+     * @return the current text element as a URI, or {@code null} if empty.
      * @throws XMLStreamException if a text element can not be returned.
-     * @throws URISyntaxException if the text can not be parsed as an URI.
+     * @throws URISyntaxException if the text can not be parsed as a URI.
      */
     protected final URI getElementAsURI() throws XMLStreamException, URISyntaxException {
         final Context context = Context.current();

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=1807629&r1=1807628&r2=1807629&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] Thu Sep  7 16:55:01 2017
@@ -224,7 +224,7 @@ public final strictfp class ReaderTest e
         try (Store reader = create("1.0/waypoint.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
             assertEquals("version", StoreProvider.V1_0, reader.getVersion());
-            try (Stream<AbstractFeature> features = reader.features()) {
+            try (Stream<AbstractFeature> features = reader.features(false)) {
                 final Iterator<AbstractFeature> it = features.iterator();
                 verifyPoint(it.next(), 0, false);
                 verifyPoint(it.next(), 1, false);
@@ -245,7 +245,7 @@ public final strictfp class ReaderTest e
         try (Store reader = create("1.1/waypoint.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
             assertEquals("version", StoreProvider.V1_1, reader.getVersion());
-            try (Stream<AbstractFeature> features = reader.features()) {
+            try (Stream<AbstractFeature> features = reader.features(false)) {
                 final Iterator<AbstractFeature> it = features.iterator();
                 verifyPoint(it.next(), 0, true);
                 verifyPoint(it.next(), 1, true);
@@ -266,7 +266,7 @@ public final strictfp class ReaderTest e
         try (Store reader = create("1.0/route.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
             assertEquals("version", StoreProvider.V1_0, reader.getVersion());
-            try (Stream<AbstractFeature> features = reader.features()) {
+            try (Stream<AbstractFeature> features = reader.features(false)) {
                 final Iterator<AbstractFeature> it = features.iterator();
                 verifyRoute(it.next(), false, 1);
                 verifyEmpty(it.next(), "rtept");
@@ -295,7 +295,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 (Stream<AbstractFeature> features = reader.features()) {
+        try (Stream<AbstractFeature> features = reader.features(false)) {
             final Iterator<AbstractFeature> it = features.iterator();
             verifyRoute(it.next(), true, 3);
             verifyEmpty(it.next(), "rtept");
@@ -373,7 +373,7 @@ public final strictfp class ReaderTest e
         try (Store reader = create("1.0/track.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
             assertEquals("version", StoreProvider.V1_0, reader.getVersion());
-            try (Stream<AbstractFeature> features = reader.features()) {
+            try (Stream<AbstractFeature> features = reader.features(false)) {
                 final Iterator<AbstractFeature> it = features.iterator();
                 verifyTrack(it.next(), false, 1);
                 verifyEmpty(it.next(), "trkseg");
@@ -393,7 +393,7 @@ public final strictfp class ReaderTest e
         try (Store reader = create("1.1/track.xml")) {
             verifyAlmostEmptyMetadata((Metadata) reader.getMetadata());
             assertEquals("version", StoreProvider.V1_1, reader.getVersion());
-            try (Stream<AbstractFeature> features = reader.features()) {
+            try (Stream<AbstractFeature> features = reader.features(false)) {
                 final Iterator<AbstractFeature> it = features.iterator();
                 verifyTrack(it.next(), true, 3);
                 verifyEmpty(it.next(), "trkseg");
@@ -610,13 +610,13 @@ public final strictfp class ReaderTest e
     @DependsOnMethod("testSequentialReads")
     public void testConcurrentReads() throws DataStoreException {
         try (Store reader = createFromURL()) {
-            final Stream<AbstractFeature>   f1 = reader.features();
+            final Stream<AbstractFeature>   f1 = reader.features(false);
             final Iterator<AbstractFeature> i1 = f1.iterator();
             verifyRoute(i1.next(), true, 3);
-            final Stream<AbstractFeature>   f2 = reader.features();
+            final Stream<AbstractFeature>   f2 = reader.features(false);
             final Iterator<AbstractFeature> i2 = f2.iterator();
             verifyEmpty(i1.next(), "rtept");
-            final Stream<AbstractFeature>   f3 = reader.features();
+            final Stream<AbstractFeature>   f3 = reader.features(false);
             final Iterator<AbstractFeature> i3 = f3.iterator();
             verifyRoute(i2.next(), true, 3);
             verifyRoute(i3.next(), true, 3);



Mime
View raw message