sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1682679 - in /sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling: api/resource/query/ spi/resource/provider/
Date Sun, 31 May 2015 06:07:10 GMT
Author: cziegeler
Date: Sun May 31 06:07:09 2015
New Revision: 1682679

URL: http://svn.apache.org/r1682679
Log:
Update api prototype

Added:
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/JCRQueryProvider.java
  (with props)
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryResult.java
  (with props)
Modified:
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/PropertyBuilder.java
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/Query.java
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructionsBuilder.java
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryManager.java
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryProvider.java
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResolveContext.java
    sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResourceProvider.java

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/PropertyBuilder.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/PropertyBuilder.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/PropertyBuilder.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/PropertyBuilder.java
Sun May 31 06:07:09 2015
@@ -23,22 +23,56 @@ import javax.annotation.Nonnull;
 import aQute.bnd.annotation.ProviderType;
 
 /**
- * Builder for creating a property part of a query
+ * Builder for creating a property part of a query.
  */
 @ProviderType
 public interface PropertyBuilder {
 
-    @Nonnull QueryBuilder eq(Object value);
-
-    @Nonnull QueryBuilder isGreater(Object value);
-
-    @Nonnull QueryBuilder isGreaterOrEq(Object value);
-
-    @Nonnull QueryBuilder isLess(Object value);
-
-    @Nonnull QueryBuilder isLessOrEq(Object value);
-
-    @Nonnull QueryBuilder approx(Object value);
-
+    /**
+     * Create a property constraint for equality test.
+     * @param value The value to check
+     * @return A query builder to continue creating the query.
+     */
+    @Nonnull QueryBuilder eq(@Nonnull Object value);
+
+    /**
+     * Create a property constraint for is greater than test.
+     * @param value The value to check
+     * @return A query builder to continue creating the query.
+     */
+    @Nonnull QueryBuilder isGreater(@Nonnull Object value);
+
+    /**
+     * Create a property constraint for is greater or equals than test.
+     * @param value The value to check
+     * @return A query builder to continue creating the query.
+     */
+    @Nonnull QueryBuilder isGreaterOrEq(@Nonnull Object value);
+
+    /**
+     * Create a property constraint for is less than test.
+     * @param value The value to check
+     * @return A query builder to continue creating the query.
+     */
+    @Nonnull QueryBuilder isLess(@Nonnull Object value);
+
+    /**
+     * Create a property constraint for is less or equals than test.
+     * @param value The value to check
+     * @return A query builder to continue creating the query.
+     */
+    @Nonnull QueryBuilder isLessOrEq(@Nonnull Object value);
+
+    /**
+     * Create a property constraint for a contains test.
+     * @param value The value to check
+     * @return A query builder to continue creating the query.
+     */
+    @Nonnull QueryBuilder contains(@Nonnull Object value);
+
+    /**
+     * Create a property constraint for an existence test.
+     * @return A query builder to continue creating the query.
+     */
     @Nonnull QueryBuilder exists();
 }
\ No newline at end of file

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/Query.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/Query.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/Query.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/Query.java
Sun May 31 06:07:09 2015
@@ -25,35 +25,68 @@ import javax.annotation.Nonnull;
 
 import aQute.bnd.annotation.ProviderType;
 
+/**
+ * A query object describes a query to be executed. Each query has a unique
+ * and stable id which can be used by implementations to cache the parsing
+ * of the query object.
+ *
+ * A query can either be a compound query, combining other queries or
+ * it can be an actual query over resource paths, names, types and
+ * properties. The method {@link #getQueryType()} can be used
+ * to identify the type of the query.
+ */
 @ProviderType
 public interface Query {
 
     /**
-     * Enumeration defining whether the query is consisting of different
-     * queries which are combined based on this operator.
+     * Enumeration defining whether the query is a compound or
+     * single query.
      */
-    public enum PartOperatorType {
-        NONE,
-        AND,
-        OR
+    public enum QueryType {
+        SINGLE,
+        COMPOUND_AND,
+        COMPOUND_OR
     };
 
-    public enum PropertyOperations {
-        EXISTS,
-        EQ,
-        GT,
-        GT_OR_EQ,
-        LT,
-        LT_OR_EQ,
-        APPROX
+    /**
+     * The different property operations.
+     */
+    public enum PropertyOperator {
+        EXISTS,   // property exists
+        EQ,       // property has an equal value
+        GT,       // property is greater than the value
+        GT_OR_EQ, // property is greater or equal to the value
+        LT,       // property is less than the value
+        LT_OR_EQ, // property is less or equal to the value
+        CONTAINS  // property contains the value
     };
 
+    /**
+     * A property constraint describes a constraint on a property.
+     * The operator defines the comparison operation and the name
+     * the name of the property to check. The property name might
+     * be a relative path pointing to a property of a child
+     * resource or it might consist of the special name {code *}
+     * denoting any property.
+     */
     public interface PropertyConstraint {
 
-        @Nonnull PropertyOperations getOperation();
-
+        /**
+         * The operator to use to compare the property value.
+         * @return The operator
+         */
+        @Nonnull PropertyOperator getOperator();
+
+        /**
+         * The property name
+         * @return The name of the property, relative path or {@code *}.
+         */
         @Nonnull String getName();
 
+        /**
+         * The value to compare against.
+         * @return The value to compare or {@code null}.
+         */
         @CheckForNull Object getValue();
     }
 
@@ -65,13 +98,36 @@ public interface Query {
      */
     @Nonnull String getId();
 
+    /**
+     * Returns constraints on the resource paths.
+     * This method returns an empty list if it's a compound query.
+     * @return The list of paths, might be empty.
+     */
     @CheckForNull List<String> getPaths();
 
+    /**
+     * Returns constraints on the resource names.
+     * This method returns an empty list if it's a compound query.
+     * @return The list of names, might be empty.
+     */
     @CheckForNull List<String> getResourceNames();
 
+    /**
+     * Returns constraints on the resource types.
+     * This method returns an empty list if it's a compound query.
+     * @return The list of types, might be empty.
+     */
     @CheckForNull List<String> getIsA();
 
     /**
+     * Return the list of property constraints.
+     * This method only returns constraints, if the query type
+     * is {@link QueryType#SINGLE}.
+     * @return The list of property constraints or {@code null}.
+     */
+    @CheckForNull List<PropertyConstraint> getPropertyConstraints();
+
+    /**
      * Returns the queries if {@link #getPartOperatorType()} does not
      * return {@link PartOperatorType#NONE}.
      * @return The parts or {@code null} if this query is not an operation
@@ -80,10 +136,9 @@ public interface Query {
     @CheckForNull List<Query> getParts();
 
     /**
-     * Return the part operator type.
-     * @return
+     * Return the type of the query.
+     * @return The query type.
      */
-    @Nonnull PartOperatorType getPartOperatorType();
+    @Nonnull QueryType getQueryType();
 
-    @CheckForNull List<PropertyConstraint> getPropertyConstraints();
 }
\ No newline at end of file

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java
Sun May 31 06:07:09 2015
@@ -36,7 +36,7 @@ public interface QueryBuilder {
      *
      * @return The query.
      *
-     * @throws IllegalArgumentException If the query is not valid and can't be created.
+     * @throws IllegalArgumentException If the query is not valid.
      */
     @Nonnull Query build();
 
@@ -93,23 +93,5 @@ public interface QueryBuilder {
      */
     @Nonnull PropertyBuilder property(@Nonnull String name);
 
-    /**
-     * Create a new query based on combining two or more queries in an and fashion.
-     *
-     * @param q1 First query
-     * @param q2 Additional queries
-     * @return The new query
-     */
-    @Nonnull Query and(@Nonnull Query q1, @Nonnull Query... q2);
 
-    /**
-     * Create a new query based on combining two or more queries in an or fashion.
-     *
-     * @param q1 First query
-     * @param q2 Additional queries
-     * @return The new query
-     *
-     * @throws IllegalArgumentException If the argument is not valid.
-     */
-    @Nonnull Query or(@Nonnull Query q1, @Nonnull Query... q2);
 }
\ No newline at end of file

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java
Sun May 31 06:07:09 2015
@@ -22,8 +22,6 @@ import java.util.List;
 
 import javax.annotation.Nonnull;
 
-import org.apache.sling.api.resource.Resource;
-
 import aQute.bnd.annotation.ProviderType;
 
 /**
@@ -33,7 +31,7 @@ import aQute.bnd.annotation.ProviderType
 @ProviderType
 public interface QueryInstructions {
 
-    public static interface SortCriteria {
+    public interface SortCriteria {
         String getPropertyName();
         boolean isAscending();
     }
@@ -56,12 +54,12 @@ public interface QueryInstructions {
      * Generate a continuation key to be used with {@link QueryInstructionsBuilder#continueAt(String)}.
      * The continuation can be used for paging: the last resource of a page is feed into
this
      * method to get a key to be used to get the start for the next page.
-     * A continuation key can only be generated of the result is sorted.
+     * A continuation key can only be generated if the result is sorted.
      * @param resource The last resource of a page
      * @return A continuation key for the next resource after this one, according to the
sorting.
      * @throws IllegalArgumentException if the resource is {@code null}
      */
-    @Nonnull String getContinuationKey(@Nonnull final Resource resource);
+    @Nonnull String getContinuationKey();
 
     /**
      * Unmodifiable list with the sort criteria.

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructionsBuilder.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructionsBuilder.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructionsBuilder.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryInstructionsBuilder.java
Sun May 31 06:07:09 2015
@@ -34,12 +34,12 @@ public interface QueryInstructionsBuilde
      * @param limit The new limit. If a value less than 1 is used, there is no limit.
      * @return The query instructions.
      */
-    @Nonnull QueryInstructionsBuilder limit(final int limit);
+    @Nonnull QueryInstructionsBuilder limit(int limit);
 
     /**
-     *
+     * Specify the continuation key.
      */
-    @Nonnull QueryInstructionsBuilder continueAt(final String continuationKey);
+    @Nonnull QueryInstructionsBuilder continueAt(@Nonnull String continuationKey);
 
     /**
      * Sort the result in ascending order by this property.
@@ -63,5 +63,9 @@ public interface QueryInstructionsBuilde
      */
     @Nonnull QueryInstructionsBuilder sortDescendingBy(@Nonnull String propName);
 
+    /**
+     * Build the query instructions object.
+     * @return The query instructions.
+     */
     @Nonnull QueryInstructions build();
 }
\ No newline at end of file

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryManager.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryManager.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryManager.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/api/resource/query/QueryManager.java
Sun May 31 06:07:09 2015
@@ -47,7 +47,35 @@ public interface QueryManager {
                                      @Nonnull Query q,
                                      @CheckForNull QueryInstructions qi);
 
+    /**
+     * Create a new query.
+     * @return A query builder to build the query.
+     */
     @Nonnull QueryBuilder query();
 
+    /**
+     * Create a new query based on combining two or more queries in an and fashion.
+     *
+     * @param q1 First query
+     * @param q2 Additional queries
+     * @return The new query
+     */
+    @Nonnull Query andQuery(@Nonnull Query q1, @Nonnull Query... q2);
+
+    /**
+     * Create a new query based on combining two or more queries in an or fashion.
+     *
+     * @param q1 First query
+     * @param q2 Additional queries
+     * @return The new query
+     *
+     * @throws IllegalArgumentException If the argument is not valid.
+     */
+    @Nonnull Query orQuery(@Nonnull Query q1, @Nonnull Query... q2);
+
+    /**
+     * Create query instructions.
+     * @return A new query instruction builder.
+     */
     @Nonnull QueryInstructionsBuilder instructions();
 }

Added: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/JCRQueryProvider.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/JCRQueryProvider.java?rev=1682679&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/JCRQueryProvider.java
(added)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/JCRQueryProvider.java
Sun May 31 06:07:09 2015
@@ -0,0 +1,101 @@
+/*
+ * 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.sling.spi.resource.provider;
+
+import java.util.Iterator;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.QuerySyntaxException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ValueMap;
+
+import aQute.bnd.annotation.ConsumerType;
+
+
+/**
+ * The JCR query provider supports querying based on the JCR spec.
+ * Calls from {@link ResourceResolver#findResources(String, String)} and
+ * {@link ResourceResolver#queryResources(String, String)} are passed on
+ * to this object.
+ */
+@ConsumerType
+public interface JCRQueryProvider<T> {
+
+    /**
+     * The supported languages of the resource provider.
+     */
+    String getSupportedLanguages();
+
+    /**
+     * Searches for resources using the given query formulated in the given
+     * language.
+     * <p>
+     * The semantic meaning of the query and language depend on the actual
+     * implementation and storage used for the resources. For JCR repository
+     * being used as storage, the query and language parameters are used to
+     * create a JCR <code>Query</code> through the <code>QueryManager</code>.
+     * The result returned is then based on the <code>NodeIterator</code>
+     * provided by the query result.
+     *
+     * @param query The query string to use to find the resources.
+     * @param language The language in which the query is formulated.
+     * @return An <code>Iterator</code> of {@link Resource} objects matching
the
+     *         query. If no resources match, <code>null</code> might be
+     *         returned instead of an empty iterator.
+     * @throws QuerySyntaxException If the query is not syntactically correct
+     *             according to the query language indicator or if the query
+     *             language is not supported as specified in {@link #LANGUAGES}.
+     * @throws org.apache.sling.api.SlingException If an error occurs querying
+     *             for the resources.
+     * @throws IllegalStateException if this resource provider has already been
+     *             closed.
+     */
+    Iterator<Resource> findResources(@Nonnull ResolveContext<T> ctx, String query,
String language);
+
+    /**
+     * Queries the storage using the given query formulated in the given
+     * language.
+     * <p>
+     * The semantic meaning of the query and language depend on the actual
+     * implementation and storage used for the resources. For JCR repository
+     * being used as storage, the query and language parameters are used to
+     * create a JCR <code>Query</code> through the <code>QueryManager</code>.
+     * The result returned is then based on the <code>RowIterator</code>
+     * provided by the query result. The map returned for each row is indexed by
+     * the column name and the column value is the JCR <code>Value</code> object
+     * converted into the respective Java object, such as <code>Boolean</code>
+     * for a value of property type <em>Boolean</em>.
+     *
+     * @param query The query string to use to find the resources.
+     * @param language The language in which the query is formulated.
+     * @return An <code>Iterator</code> of <code>Map</code> instances
providing
+     *         access to the query result. If no resources match, <code>null</code>
+     *         might be returned instead of an empty iterator.
+     * @throws QuerySyntaxException If the query is not syntactically correct
+     *             according to the query language indicator or if the query
+     *             language is not supported as specified in {@link #LANGUAGES}.
+     * @throws org.apache.sling.api.SlingException If an error occurs querying
+     *             for the resources.
+     * @throws IllegalStateException if this resource provider has already been
+     *             closed.
+     */
+    Iterator<ValueMap> queryResources(@Nonnull ResolveContext<T> ctx, String
query, String language);
+}

Propchange: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/JCRQueryProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/JCRQueryProvider.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryProvider.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryProvider.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryProvider.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryProvider.java
Sun May 31 06:07:09 2015
@@ -18,12 +18,9 @@
  */
 package org.apache.sling.spi.resource.provider;
 
-import java.util.Iterator;
-
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
-import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.query.Query;
 import org.apache.sling.api.resource.query.QueryInstructions;
 
@@ -37,9 +34,9 @@ public interface QueryProvider <T> {
      * @param ctx The resource context-
      * @param q The query
      * @param qi The query instructions
-     * @return An iterator for the resources or {@code null}.
+     * @return A query result or {@code null}.
      */
-    @CheckForNull Iterator<Resource> find(@Nonnull ResolveContext<T> ctx,
+    @CheckForNull QueryResult find(@Nonnull ResolveContext<T> ctx,
             @Nonnull Query q,
             @Nonnull QueryInstructions qi);
 }

Added: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryResult.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryResult.java?rev=1682679&view=auto
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryResult.java
(added)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryResult.java
Sun May 31 06:07:09 2015
@@ -0,0 +1,35 @@
+/*
+ * 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.sling.spi.resource.provider;
+
+import javax.annotation.Nonnull;
+
+import org.apache.sling.api.resource.Resource;
+
+import aQute.bnd.annotation.ConsumerType;
+
+@ConsumerType
+public abstract class QueryResult {
+
+    public abstract @Nonnull Iterable<Resource> getResources();
+
+    public String getContinuationKey() {
+        return null;
+    }
+}

Propchange: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/QueryResult.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResolveContext.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResolveContext.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResolveContext.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResolveContext.java
Sun May 31 06:07:09 2015
@@ -28,10 +28,19 @@ import org.apache.sling.api.resource.Res
 import aQute.bnd.annotation.ProviderType;
 
 /**
+ * The resolve context is passed to most of the methods of the {@link ResourceProvider}
+ * to provide additional context information for the provider.
+ *
+ * If the provider requires authentication, the object returned by {@link ResourceProvider#authenticate(Map)}
+ * is returned in {@link #getProviderState()}.
  */
 @ProviderType
 public interface ResolveContext<T> {
 
+    /**
+     * Get the current resource resolver.
+     * @return The resource resolver.
+     */
     @Nonnull ResourceResolver getResourceResolver();
 
     /**
@@ -46,7 +55,19 @@ public interface ResolveContext<T> {
      */
     @CheckForNull T getProviderState();
 
+    /**
+     * Return a resolve context for the parent resource provider.
+     * @return A resolve context or {@code null} if there is no parent.
+     * @see #getParentResourceProvider()
+     */
     @CheckForNull ResolveContext<?> getParentResolveContext();
 
+    /**
+     * Return the parent resource provider.
+     * If the parent should be used for resolving, a context created with
+     * {@link #getParentResolveContext()} should be passed to that
+     * instance.
+     * @return The parent provider or {@code null} if there is no parent.
+     */
     @CheckForNull ResourceProvider<?> getParentResourceProvider();
 }

Modified: sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResourceProvider.java?rev=1682679&r1=1682678&r2=1682679&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResourceProvider.java
(original)
+++ sling/whiteboard/cziegeler/api-v3/src/main/java/org/apache/sling/spi/resource/provider/ResourceProvider.java
Sun May 31 06:07:09 2015
@@ -70,7 +70,7 @@ public abstract class ResourceProvider<T
     /**
      * The name of the service registration property containing a boolean
      * flag indicating if the ResourceAccessSecurity service should be used for
-     * this provider or not. ResourceAccessSecurity should only be used if the 
+     * this provider or not. ResourceAccessSecurity should only be used if the
      * underlying storage does not provide access control
      * The default for this value is <code>false</code>.
      * (value is "provider.useResourceAccessSecurity")
@@ -385,18 +385,36 @@ public abstract class ResourceProvider<T
     /**
      * Get the optional query provider.
      *
-     * @param ctx The {@link ResolveContext} to which the returned {@link QueryProvider}
is attached.
-     * @return A query provider if this resource provider supports querying.
+     * @return A query provider if this resource provider supports this type of querying.
      */
     public @CheckForNull QueryProvider<T> getQueryProvider() {
         return null;
     }
 
     /**
+     * Get the optional JCR query provider.
      *
-     * @param ctx The {@link ResolveContext} to which the returned {@link Resource} is attached.
-     * @param type
-     * @return
+     * @return A JCR query provider if this resource provider supports this type of querying.
+     */
+    public @CheckForNull JCRQueryProvider<T> getJCRQueryProvider() {
+        return null;
+    }
+
+    /**
+     * Adapts the provider to another type.
+     * <p>
+     * Please not that it is explicitly left as an implementation detail whether
+     * each call to this method with the same <code>type</code> yields the same
+     * object or a new object on each call.
+     * <p>
+     * Implementations of this method should document their adapted types as
+     * well as their behaviour with respect to returning newly created or not
+     * instance on each call.
+     *
+     * @param ctx The {@link ResolveContext}.
+     * @param type The generic type to which this resource is adapted to.
+     * @return The adapter target or {@code null} if the provider cannot
+     *         be adapt to the requested type.
      */
     public @CheckForNull <AdapterType> AdapterType adaptTo(final  @Nonnull ResolveContext<T>
ctx, final @Nonnull Class<AdapterType> type) {
         return null;



Mime
View raw message