sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject svn commit: r1812643 - in /sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage: FeatureSet.java Query.java UnsupportedQueryException.java
Date Thu, 19 Oct 2017 13:52:22 GMT
Author: jsorel
Date: Thu Oct 19 13:52:22 2017
New Revision: 1812643

URL: http://svn.apache.org/viewvc?rev=1812643&view=rev
Log:
DataStore : add FeatureSet Query API

Added:
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java
      - copied, changed from r1812629, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
Modified:
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java?rev=1812643&r1=1812642&r2=1812643&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSet.java
[UTF-8] Thu Oct 19 13:52:22 2017
@@ -75,6 +75,30 @@ public interface FeatureSet extends Data
     FeatureType getType() throws DataStoreException;
 
     /**
+     * Request a subset of features from this resource.
+     * <p>
+     * Using queries allow the {@link DataStore} implementation to optimize
+     * the overall processing by using the tool available in the format.
+     * BoundingBox filters are the most common case of optimization implemented
+     * by {@link DataStore}.
+     * </p>
+     * <p>
+     * The returned subset may not have the same capabilities as this {@link FeatureSet}.
+     * Particularly writing operations may become unsupported after complex queries.
+     * </p>
+     *
+     * @param query definition of operations applied at reading time, common queries
+     *          imply filtering features and transforming attributes.
+     * @return resulting subset of features (never {@code null}).
+     * @throws DataStoreException if processing or verifying the query failed
+     * @throws UnsupportedQueryException if query is not supported, this include
+     *          query validation errors.
+     */
+    default FeatureSet subset(Query query) throws DataStoreException, UnsupportedQueryException
{
+        throw new UnsupportedQueryException();
+    }
+
+    /**
      * Returns a stream of all features contained in this dataset.
      * For all features, the following condition shall be true:
      *

Added: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java?rev=1812643&view=auto
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java
(added)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/Query.java
Thu Oct 19 13:52:22 2017
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.storage;
+
+/**
+ * Queries are descriptive objects used by {@link FeatureSet} to optimize operation
+ * as much as possible on the resource using for example caches and indexes.
+ * <p>
+ * A common query contains a filtering capabilities and simple attribute transformations.
+ * Well known query type include SQL and CQL.
+ * </p>
+ *
+ * @author Johann Sorel (Geomatys)
+ * @version 0.8
+ * @since   0.8
+ * @module
+ */
+public interface Query {
+
+}

Copied: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java
(from r1812629, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java?p2=sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java&p1=sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java&r1=1812629&r2=1812643&rev=1812643&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedQueryException.java
[UTF-8] Thu Oct 19 13:52:22 2017
@@ -16,33 +16,26 @@
  */
 package org.apache.sis.storage;
 
-import java.util.Locale;
-import java.nio.file.OpenOption;
-import org.apache.sis.util.Classes;
-import org.apache.sis.internal.storage.Resources;
-import org.apache.sis.internal.storage.io.IOUtilities;
-
 
 /**
  * Thrown when no {@link DataStoreProvider} is found for a given storage object.
  * May also be thrown if a {@code DataStore} is instantiated directly but the data store
  * can not handle the given input or output object.
  *
- * @author  Martin Desruisseaux (Geomatys)
+ * @author  Johann Sorel (Geomatys)
  * @version 0.8
- * @since   0.4
+ * @since   0.8
  * @module
  */
-public class UnsupportedStorageException extends IllegalOpenParameterException {
+public class UnsupportedQueryException extends IllegalOpenParameterException {
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -8754573140979570187L;
 
     /**
      * Creates an exception with no cause and no details message.
      */
-    public UnsupportedStorageException() {
+    public UnsupportedQueryException() {
     }
 
     /**
@@ -50,7 +43,7 @@ public class UnsupportedStorageException
      *
      * @param message  the detail message.
      */
-    public UnsupportedStorageException(final String message) {
+    public UnsupportedQueryException(final String message) {
         super(message);
     }
 
@@ -59,7 +52,7 @@ public class UnsupportedStorageException
      *
      * @param cause  the cause for this exception.
      */
-    public UnsupportedStorageException(final Throwable cause) {
+    public UnsupportedQueryException(final Throwable cause) {
         super(cause);
     }
 
@@ -69,38 +62,8 @@ public class UnsupportedStorageException
      * @param message  the detail message.
      * @param cause    the cause for this exception.
      */
-    public UnsupportedStorageException(final String message, final Throwable cause) {
+    public UnsupportedQueryException(final String message, final Throwable cause) {
         super(message, cause);
     }
 
-    /**
-     * Creates a new exception which will format a localized message in the given locale.
-     *
-     * @param locale      the locale for the message to be returned by {@link #getLocalizedMessage()}.
-     * @param key         one of {@link Resources.Keys} constants.
-     * @param parameters  parameters to use for formatting the messages.
-     */
-    UnsupportedStorageException(final Locale locale, final short key, final Object... parameters)
{
-        super(locale, key, parameters);
-    }
-
-    /**
-     * Creates a localized exception for an invalid input or output object given to a data
store.
-     * Arguments given to this constructor are hints for building an error message.
-     *
-     * @param locale   the locale of the message to be returned by {@link #getLocalizedMessage()},
or {@code null}.
-     * @param format   short name or abbreviation of the data format (e.g. "CSV", "GML",
"WKT", <i>etc</i>).
-     * @param storage  the invalid input or output object. This is typically {@link StorageConnector#getStorage()}.
-     * @param options  the option used for opening the file, or {@code null} or empty if
unknown.
-     *                 This method looks in particular for {@link java.nio.file.StandardOpenOption#READ}
and
-     *                 {@code WRITE} options for inferring if the data store was to be used
as a reader or as a writer.
-     *                 Those options can be obtained by {@code StorageConnector.getOption(OptionKey.OPEN_OPTIONS)}.
-     *
-     * @since 0.8
-     */
-    public UnsupportedStorageException(final Locale locale, final String format, final Object
storage, final OpenOption... options) {
-        super(locale, IOUtilities.isWrite(options) ? Resources.Keys.IllegalOutputTypeForWriter_2
-                                                   : Resources.Keys.IllegalInputTypeForReader_2,
-                      format, Classes.getClass(storage));
-    }
 }



Mime
View raw message