sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vram...@apache.org
Subject svn commit: r1240908 - in /sling/whiteboard/resourceresolverfactory: jcr-resource/ jcr-resource/src/main/java/org/apache/sling/jcr/resource/internal/ jcr-resource/src/test/java/org/apache/sling/jcr/resource/internal/ resourceresolverfactory/ resourcere...
Date Mon, 06 Feb 2012 07:56:58 GMT
Author: vramdal
Date: Mon Feb  6 07:56:57 2012
New Revision: 1240908

URL: http://svn.apache.org/viewvc?rev=1240908&view=rev
Log: (empty)

Added:
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/pom.xml
      - copied, changed from r1240159, sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/jcr/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/jcr/resource/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/jcr/resource/internal/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/jcr/resource/internal/helper/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/
      - copied from r1240159, sling/whiteboard/resourceresolverfactory/jcr-resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/resourceresolverfactory/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/resourceresolverfactory/StarResource.java
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/test/
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/test/java/
Removed:
    sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
Modified:
    sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml
    sling/whiteboard/resourceresolverfactory/jcr-resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
    sling/whiteboard/resourceresolverfactory/jcr-resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java

Modified: sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml?rev=1240908&r1=1240907&r2=1240908&view=diff
==============================================================================
--- sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml (original)
+++ sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml Mon Feb  6 07:56:57 2012
@@ -23,7 +23,7 @@
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
         <version>12</version>
-        <relativePath>../../../parent/pom.xml</relativePath>
+        <!--<relativePath>../../../parent/pom.xml</relativePath>-->
     </parent>
 
     <artifactId>org.apache.sling.jcr.resource</artifactId>
@@ -37,13 +37,13 @@
 
     <scm>
         <connection>
-            scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/resource
+            scm:svn:http://svn.apache.org/repos/asf/sling/whiteboard/resourceresolverfactory/jcr-resource
         </connection>
         <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/resource
+            scm:svn:https://svn.apache.org/repos/asf/sling/whiteboard/resourceresolverfactory/jcr-resource
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource
+            http://svn.apache.org/viewvc/sling/whiteboard/resourceresolverfactory/jcr-resource
         </url>
     </scm>
 
@@ -121,6 +121,11 @@
     </build>
     
     <dependencies>
+		<dependency>
+			<groupId>org.apache.sling</groupId>
+			<artifactId>org.apache.sling.resourceresolverfactory</artifactId>
+			<version>2.0.11-WHITEBOARD</version>
+		</dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-api</artifactId>

Modified: sling/whiteboard/resourceresolverfactory/jcr-resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/resourceresolverfactory/jcr-resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=1240908&r1=1240907&r2=1240908&view=diff
==============================================================================
--- sling/whiteboard/resourceresolverfactory/jcr-resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
(original)
+++ sling/whiteboard/resourceresolverfactory/jcr-resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Mon Feb  6 07:56:57 2012
@@ -65,7 +65,7 @@ import org.apache.sling.jcr.resource.int
 import org.apache.sling.jcr.resource.internal.helper.URIException;
 import org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResourceIterator;
 import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderEntry;
-import org.apache.sling.jcr.resource.internal.helper.starresource.StarResource;
+import org.apache.sling.resourceresolverfactory.StarResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: sling/whiteboard/resourceresolverfactory/jcr-resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/resourceresolverfactory/jcr-resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java?rev=1240908&r1=1240907&r2=1240908&view=diff
==============================================================================
--- sling/whiteboard/resourceresolverfactory/jcr-resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
(original)
+++ sling/whiteboard/resourceresolverfactory/jcr-resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Mon Feb  6 07:56:57 2012
@@ -60,7 +60,6 @@ import org.apache.sling.jcr.resource.Jcr
 import org.apache.sling.jcr.resource.internal.helper.MapEntries;
 import org.apache.sling.jcr.resource.internal.helper.Mapping;
 import org.apache.sling.jcr.resource.internal.helper.RedirectResource;
-import org.apache.sling.jcr.resource.internal.helper.starresource.StarResource;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventAdmin;

Copied: sling/whiteboard/resourceresolverfactory/resourceresolverfactory/pom.xml (from r1240159,
sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml)
URL: http://svn.apache.org/viewvc/sling/whiteboard/resourceresolverfactory/resourceresolverfactory/pom.xml?p2=sling/whiteboard/resourceresolverfactory/resourceresolverfactory/pom.xml&p1=sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml&r1=1240159&r2=1240908&rev=1240908&view=diff
==============================================================================
--- sling/whiteboard/resourceresolverfactory/jcr-resource/pom.xml (original)
+++ sling/whiteboard/resourceresolverfactory/resourceresolverfactory/pom.xml Mon Feb  6 07:56:57
2012
@@ -23,32 +23,32 @@
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
         <version>12</version>
-        <relativePath>../../../parent/pom.xml</relativePath>
+        <!--<relativePath>../../../parent/pom.xml</relativePath>-->
     </parent>
 
-    <artifactId>org.apache.sling.jcr.resource</artifactId>
-    <version>2.0.11-SNAPSHOT</version>
+    <artifactId>org.apache.sling.resourceresolverfactory</artifactId>
+    <version>2.0.11-WHITEBOARD</version>
     <packaging>bundle</packaging>
 
-    <name>Apache Sling JCR Resource Resolver</name>
+    <name>Apache Sling Resource Resolver Factory</name>
     <description>
-        This bundle provides the JCR based ResourceResolver.
+        This bundle provides the ResourceResolverFactory.
     </description>
 
     <scm>
         <connection>
-            scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/resource
+            scm:svn:http://svn.apache.org/repos/asf/sling/whiteboard/resourceresolverfactory/resourceresolverfactory
         </connection>
         <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/resource
+            scm:svn:https://svn.apache.org/repos/asf/sling/whiteboard/resourceresolverfactory/resourceresolverfactory
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource
+            https://svn.apache.org/viewvc/sling/whiteboard/resourceresolverfactory/resourceresolverfactory
         </url>
     </scm>
 
     <properties>
-        <site.jira.version.id>12314286</site.jira.version.id>
+        <!--<site.jira.version.id>12314286</site.jira.version.id>-->
         <site.javadoc.exclude>**.internal.**</site.javadoc.exclude>
     </properties>
 
@@ -90,29 +90,20 @@
                             org.apache.jackrabbit.api.observation
                         </DynamicImport-Package>
                         <Export-Package>
-                            org.apache.sling.jcr.resource;version=2.1
+                            org.apache.sling.resourceresolverfactory;version=1.0
                         </Export-Package>
                         <Private-Package>
-                            org.apache.sling.jcr.resource.internal.*
+                            org.apache.sling.jcr.resource.resourceresolverfactory.internal.*
                         </Private-Package>
 
                         <!-- Include URL support from Jackrabbit -->
                         <Embed-Dependency>
-                            jackrabbit-classloader;inline="org/apache/jackrabbit/net/**|org/apache/jackrabbit/classloader/Util.*",
-                            jackrabbit-jcr-commons;inline="org/apache/jackrabbit/util/ISO9075.*|org/apache/jackrabbit/name/QName.*|org/apache/jackrabbit/util/XMLChar.*|org/apache/jackrabbit/util/Text.*",
-                            guava;inline="com/google/common/collect/Maps*.*|com/google/common/base/Preconditions.*|com/google/common/primitives/Ints.*"
                         </Embed-Dependency>
 
                         <Sling-Namespaces>
-                            sling=http://sling.apache.org/jcr/sling/1.0
                         </Sling-Namespaces>
 
                         <Sling-Nodetypes>
-                            SLING-INF/nodetypes/folder.cnd,
-                            SLING-INF/nodetypes/resource.cnd,
-                            SLING-INF/nodetypes/vanitypath.cnd,
-                            SLING-INF/nodetypes/redirect.cnd,
-                            SLING-INF/nodetypes/mapping.cnd
                         </Sling-Nodetypes>
                     </instructions>
                 </configuration>
@@ -122,21 +113,10 @@
     
     <dependencies>
         <dependency>
-            <groupId>org.apache.jackrabbit</groupId>
-            <artifactId>jackrabbit-api</artifactId>
-            <version>2.0.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.scr.annotations</artifactId>
         </dependency>
         <dependency>
-            <groupId>javax.jcr</groupId>
-            <artifactId>jcr</artifactId>
-            <version>2.0</version>
-        </dependency>
-        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
         </dependency>
@@ -158,12 +138,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.jcr.api</artifactId>
-            <version>2.0.6</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.adapter</artifactId>
             <version>2.0.4</version>
             <scope>provided</scope>
@@ -216,18 +190,6 @@
         </dependency>
 
         <!-- for adapting JCR resources to URLs -->
-        <dependency>
-            <groupId>org.apache.jackrabbit</groupId>
-            <artifactId>jackrabbit-classloader</artifactId>
-            <version>1.5.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.jackrabbit</groupId>
-            <artifactId>jackrabbit-jcr-commons</artifactId>
-            <version>2.0.0</version>
-            <scope>provided</scope>
-        </dependency>
 
         <!-- Testing -->
         <dependency>
@@ -248,11 +210,5 @@
             <version>1.4</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.jcr.base</artifactId>
-            <version>2.1.0</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 </project>

Added: sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/resourceresolverfactory/StarResource.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/resourceresolverfactory/StarResource.java?rev=1240908&view=auto
==============================================================================
--- sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/resourceresolverfactory/StarResource.java
(added)
+++ sling/whiteboard/resourceresolverfactory/resourceresolverfactory/src/main/java/org/apache/sling/resourceresolverfactory/StarResource.java
Mon Feb  6 07:56:57 2012
@@ -0,0 +1,109 @@
+/*
+ * 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.resourceresolverfactory;
+
+import java.util.Map;
+
+import org.apache.sling.adapter.annotations.Adaptable;
+import org.apache.sling.adapter.annotations.Adapter;
+import org.apache.sling.api.SlingException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceMetadata;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.api.resource.SyntheticResource;
+import org.apache.sling.api.resource.ValueMap;
+
+/** Used to provide the equivalent of an empty Node for GET requests
+ *  to *.something (SLING-344)
+ */
+@Adaptable(adaptableClass = Resource.class, adapters = @Adapter(value = { String.class }))
+public class StarResource extends SyntheticResource {
+
+    final static String SLASH_STAR = "/*";
+    public final static String DEFAULT_RESOURCE_TYPE = "sling:syntheticStarResource";
+
+    private static final String UNSET_RESOURCE_SUPER_TYPE = "<unset>";
+
+    private String resourceSuperType;
+
+    @SuppressWarnings("serial")
+    static class SyntheticStarResourceException extends SlingException {
+        SyntheticStarResourceException(String reason, Throwable cause) {
+            super(reason, cause);
+        }
+    }
+
+    /** True if a StarResource should be used for the given request, if
+     *  a real Resource was not found */
+    public static boolean appliesTo(String path) {
+        return path.contains(SLASH_STAR) || path.endsWith(SLASH_STAR);
+    }
+
+    /**
+     * Returns true if the path of the resource ends with the
+     * {@link #SLASH_STAR} and therefore should be considered a star
+     * resource.
+     */
+    public static boolean isStarResource(Resource res) {
+        return res.getPath().endsWith(SLASH_STAR);
+    }
+
+    public StarResource(ResourceResolver resourceResolver, String path) {
+        super(resourceResolver, getResourceMetadata(path), DEFAULT_RESOURCE_TYPE);
+        resourceSuperType = UNSET_RESOURCE_SUPER_TYPE;
+    }
+
+    /**
+     * Calls {@link ResourceUtil#getResourceSuperType(ResourceResolver, String)} method
+     * to dynamically resolve the resource super type of this star resource.
+     */
+    public String getResourceSuperType() {
+        // Yes, this isn't how you're supposed to compare Strings, but this is intentional.
+        if (resourceSuperType == UNSET_RESOURCE_SUPER_TYPE) {
+            resourceSuperType = ResourceUtil.getResourceSuperType(this.getResourceResolver(),
+                    this.getResourceType());
+        }
+        return resourceSuperType;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <Type> Type adaptTo(Class<Type> type) {
+        if ( type == String.class ) {
+            return (Type)"";
+        }
+        return super.adaptTo(type);
+    }
+
+    /** Get our ResourceMetadata for given path */
+    static ResourceMetadata getResourceMetadata(String path) {
+    	ResourceMetadata result = new ResourceMetadata();
+
+    	// The path is up to /*, what follows is pathInfo
+        final int index = path.indexOf(SLASH_STAR);
+        if(index >= 0) {
+            result.setResolutionPath(path.substring(0, index) + SLASH_STAR);
+            result.setResolutionPathInfo(path.substring(index + SLASH_STAR.length()));
+        } else {
+            result.setResolutionPath(path);
+        }
+        return result;
+    }
+}
\ No newline at end of file



Mime
View raw message