incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1390431 - in /sling/trunk/bundles: api/src/main/java/org/apache/sling/api/resource/ jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/ resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ resour...
Date Wed, 26 Sep 2012 12:19:29 GMT
Author: cziegeler
Date: Wed Sep 26 12:19:29 2012
New Revision: 1390431

URL: http://svn.apache.org/viewvc?rev=1390431&view=rev
Log:
SLING-2530 : Implement CRUD based on resources

Modified:
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java?rev=1390431&r1=1390430&r2=1390431&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
(original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/AttributableResourceProvider.java
Wed Sep 26 12:19:29 2012
@@ -38,13 +38,13 @@ public interface AttributableResourcePro
 
     /**
      * Returns a collection of attribute names whose value can be retrieved
-     * calling the {@link #getAttribute(String)} method.
+     * calling the {@link #getAttribute(ResourceResolver, String)} method.
      *
      * @return A collection of attribute names or <code>null</code>
      * @throws IllegalStateException if this resource provider has already been
      *                               closed.
      */
-    Collection<String> getAttributeNames();
+    Collection<String> getAttributeNames(ResourceResolver resolver);
 
     /**
      * Returns the value of the given resource provider attribute or <code>null</code>
@@ -60,5 +60,5 @@ public interface AttributableResourcePro
      * @throws IllegalStateException
      *             if this resource provider has already been closed.
      */
-    Object getAttribute(String name);
+    Object getAttribute(ResourceResolver resolver, String name);
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java?rev=1390431&r1=1390430&r2=1390431&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java
(original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/QueriableResourceProvider.java
Wed Sep 26 12:19:29 2012
@@ -94,5 +94,5 @@ public interface QueriableResourceProvid
      * @throws IllegalStateException if this resource provider has already been
      *             closed.
      */
-    Iterator<Map<String, Object>> queryResources(String query, String language);
+    Iterator<Map<String, Object>> queryResources(ResourceResolver resolver, String
query, String language);
 }

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java?rev=1390431&r1=1390430&r2=1390431&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
Wed Sep 26 12:19:29 2012
@@ -255,9 +255,9 @@ public class JcrResourceProvider
     }
 
     /**
-     * @see org.apache.sling.api.resource.QueriableResourceProvider#queryResources(java.lang.String,
java.lang.String)
+     * @see org.apache.sling.api.resource.QueriableResourceProvider#queryResources(ResourceResolver,
java.lang.String, java.lang.String)
      */
-    public Iterator<Map<String, Object>> queryResources(final String query, final
String language) {
+    public Iterator<Map<String, Object>> queryResources(final ResourceResolver
resolver, final String query, final String language) {
         checkClosed();
 
         final String queryLanguage = isSupportedQueryLanguage(language) ? language : DEFAULT_QUERY_LANGUAGE;
@@ -336,9 +336,9 @@ public class JcrResourceProvider
     }
 
     /**
-     * @see org.apache.sling.api.resource.AttributableResourceProvider#getAttributeNames()
+     * @see org.apache.sling.api.resource.AttributableResourceProvider#getAttributeNames(ResourceResolver)
      */
-    public Collection<String> getAttributeNames() {
+    public Collection<String> getAttributeNames(final ResourceResolver resolver) {
         this.checkClosed();
 
         final Set<String> names = new HashSet<String>();
@@ -352,9 +352,9 @@ public class JcrResourceProvider
     }
 
     /**
-     * @see org.apache.sling.api.resource.AttributableResourceProvider#getAttribute(java.lang.String)
+     * @see org.apache.sling.api.resource.AttributableResourceProvider#getAttribute(ResourceResolver,
java.lang.String)
      */
-    public Object getAttribute(final String name) {
+    public Object getAttribute(final ResourceResolver resolver, final String name) {
         this.checkClosed();
 
         if ( JcrResourceProviderFactory.isAttributeVisible(name) ) {

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java?rev=1390431&r1=1390430&r2=1390431&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
Wed Sep 26 12:19:29 2012
@@ -176,7 +176,7 @@ public class ResourceResolverImpl extend
      */
     public Iterator<String> getAttributeNames() {
         checkClosed();
-        return this.factory.getRootProviderEntry().getAttributeNames(this.context);
+        return this.factory.getRootProviderEntry().getAttributeNames(this.context, this);
     }
 
     /**
@@ -188,7 +188,7 @@ public class ResourceResolverImpl extend
             throw new NullPointerException("name");
         }
 
-        return this.factory.getRootProviderEntry().getAttribute(this.context, name);
+        return this.factory.getRootProviderEntry().getAttribute(this.context, this, name);
     }
 
     // ---------- resolving resources
@@ -640,7 +640,7 @@ public class ResourceResolverImpl extend
     throws SlingException {
         checkClosed();
 
-        return this.factory.getRootProviderEntry().queryResources(this.context, query,
+        return this.factory.getRootProviderEntry().queryResources(this.context, this, query,
                         language == null ? DEFAULT_QUERY_LANGUAGE : language);
     }
 

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java?rev=1390431&r1=1390430&r2=1390431&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/tree/RootResourceProviderEntry.java
Wed Sep 26 12:19:29 2012
@@ -184,9 +184,10 @@ public class RootResourceProviderEntry e
 
     /**
      * Invoke all queriable resource providers.
-     * @see QueriableResourceProvider#queryResources(String, String)
+     * @see QueriableResourceProvider#queryResources(ResourceResolver, String, String)
      */
-    public Iterator<Map<String, Object>> queryResources(final ResourceResolverContext
ctx, final String query, final String language) {
+    public Iterator<Map<String, Object>> queryResources(final ResourceResolverContext
ctx,
+                    final ResourceResolver resolver, final String query, final String language)
{
         final Iterator<QueriableResourceProvider> i = this.queriableProviders.getProviders(ctx,
                         new SortedProviderList.Filter<QueriableResourceProvider>()
{
 
@@ -207,7 +208,7 @@ public class RootResourceProviderEntry e
                     nextResourceIter = null;
                     while ( i.hasNext() && nextResourceIter == null ) {
                         final QueriableResourceProvider adap = i.next();
-                        nextResourceIter = adap.queryResources(query, language);
+                        nextResourceIter = adap.queryResources(resolver, query, language);
                     }
                 }
                 if ( nextResourceIter != null ) {
@@ -253,9 +254,9 @@ public class RootResourceProviderEntry e
 
     /**
      * Invoke all attributes providers and combine the result
-     * @see AttributableResourceProvider#getAttributeNames()
+     * @see AttributableResourceProvider#getAttributeNames(ResourceResolver)
      */
-    public Iterator<String> getAttributeNames(final ResourceResolverContext ctx) {
+    public Iterator<String> getAttributeNames(final ResourceResolverContext ctx, final
ResourceResolver resolver) {
         final Set<String> names = new HashSet<String>();
         if ( ctx.getAuthenticationInfo() != null ) {
             names.addAll(ctx.getAuthenticationInfo().keySet());
@@ -263,7 +264,7 @@ public class RootResourceProviderEntry e
         final Iterator<AttributableResourceProvider> i = this.attributableProviders.getProviders(ctx,
null);
         while ( i.hasNext() ) {
             final AttributableResourceProvider adap = i.next();
-            final Collection<String> newNames = adap.getAttributeNames();
+            final Collection<String> newNames = adap.getAttributeNames(resolver);
             if ( newNames != null ) {
                 names.addAll(newNames);
             }
@@ -275,9 +276,9 @@ public class RootResourceProviderEntry e
 
     /**
      * Return the result from the first matching attributes provider
-     * @see AttributableResourceProvider#getAttribute(String)
+     * @see AttributableResourceProvider#getAttribute(ResourceResolver, String)
      */
-    public Object getAttribute(final ResourceResolverContext ctx, final String name) {
+    public Object getAttribute(final ResourceResolverContext ctx, final ResourceResolver
resolver, final String name) {
         Object result = null;
         if (!FORBIDDEN_ATTRIBUTE.equals(name) )  {
             if (ctx.getAuthenticationInfo() != null) {
@@ -287,7 +288,7 @@ public class RootResourceProviderEntry e
                 final Iterator<AttributableResourceProvider> i = this.attributableProviders.getProviders(ctx,
null);
                 while ( result == null && i.hasNext() ) {
                     final AttributableResourceProvider adap = i.next();
-                    result = adap.getAttribute(name);
+                    result = adap.getAttribute(resolver, name);
                 }
             }
         }



Mime
View raw message