incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r917973 - in /sling/trunk/bundles/jcr/resource: ./ src/main/java/org/apache/sling/jcr/resource/internal/ src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/
Date Tue, 02 Mar 2010 11:23:04 GMT
Author: cziegeler
Date: Tue Mar  2 11:23:03 2010
New Revision: 917973

URL: http://svn.apache.org/viewvc?rev=917973&view=rev
Log:
SLING-1420 : Remove FakeNode and FakeNodeType

Removed:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/FakeNode.java
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/FakeNodeType.java
Modified:
    sling/trunk/bundles/jcr/resource/pom.xml
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java

Modified: sling/trunk/bundles/jcr/resource/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/pom.xml?rev=917973&r1=917972&r2=917973&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/pom.xml (original)
+++ sling/trunk/bundles/jcr/resource/pom.xml Tue Mar  2 11:23:03 2010
@@ -109,7 +109,6 @@
         <dependency>
             <groupId>javax.jcr</groupId>
             <artifactId>jcr</artifactId>
-            <version>2.0</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=917973&r1=917972&r2=917973&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Tue Mar  2 11:23:03 2010
@@ -205,8 +205,7 @@
 
                 log.debug("resolve: Mapped path {} is a Star Resource",
                     realPath);
-                res = new StarResource(this, ensureAbsPath(realPath),
-                    factory.getJcrResourceTypeProviders());
+                res = new StarResource(this, ensureAbsPath(realPath));
 
             } else
 

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java?rev=917973&r1=917972&r2=917973&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
Tue Mar  2 11:23:03 2010
@@ -18,16 +18,12 @@
  */
 package org.apache.sling.jcr.resource.internal.helper.starresource;
 
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-
 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.jcr.resource.JcrResourceTypeProvider;
 
 /** Used to provide the equivalent of an empty Node for GET requests
  *  to *.something (SLING-344)
@@ -63,24 +59,11 @@
         return res.getPath().endsWith(SLASH_STAR);
     }
 
-    public StarResource(ResourceResolver resourceResolver, String path, JcrResourceTypeProvider[]
jcrProviders) throws SlingException {
-        super(resourceResolver, getResourceMetadata(path), getResourceType(jcrProviders,
path));
+    public StarResource(ResourceResolver resourceResolver, String path) {
+        super(resourceResolver, getResourceMetadata(path), DEFAULT_RESOURCE_TYPE);
         resourceSuperType = UNSET_RESOURCE_SUPER_TYPE;
     }
 
-    /** adaptTo(Node) returns a Fake node, that returns empty values
-     *  for everything except the Node path */
-    @SuppressWarnings("unchecked")
-    @Override
-    public <Type> Type adaptTo(Class<Type> type) {
-        if(type == Node.class) {
-            return (Type) new FakeNode(getPath());
-        } else if(type == String.class) {
-        	return (Type)"";
-        }
-        return null;
-    }
-
     /**
      * Calls {@link ResourceUtil#getResourceSuperType(ResourceResolver, String)} method
      * to dynamically resolve the resource super type of this star resource.
@@ -107,27 +90,4 @@
         }
         return result;
     }
-
-    /** Get the resource type for the given path */
-    static String getResourceType(final JcrResourceTypeProvider[] jcrProviders,
-                                  final String path) {
-        // The only way we can set a meaningful resource type is via the drtp
-        final Node n = new FakeNode(getResourceMetadata(path).getResolutionPath());
-        String resourceType = null;
-        if (jcrProviders != null) {
-            try {
-                int index = 0;
-                while ( resourceType == null && index < jcrProviders.length )
{
-                    resourceType = jcrProviders[index].getResourceTypeForNode(n);
-                    index++;
-                }
-            } catch (RepositoryException re) {
-                throw new SyntheticStarResourceException("getResourceTypeForNode failed",
re);
-            }
-        }
-        if (resourceType == null) {
-            resourceType = DEFAULT_RESOURCE_TYPE;
-        }
-        return resourceType;
-    }
 }
\ No newline at end of file



Mime
View raw message