You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/09/26 14:36:29 UTC
svn commit: r699299 -
/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
Author: fmeschbe
Date: Fri Sep 26 05:36:29 2008
New Revision: 699299
URL: http://svn.apache.org/viewvc?rev=699299&view=rev
Log:
SLING-645 Use JcrResourceUtil.getResourceSuperType to resolve any
super type of star resources.
Modified:
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java?rev=699299&r1=699298&r2=699299&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/starresource/StarResource.java Fri Sep 26 05:36:29 2008
@@ -28,6 +28,7 @@
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.SyntheticResource;
import org.apache.sling.jcr.resource.JcrResourceTypeProvider;
+import org.apache.sling.jcr.resource.JcrResourceUtil;
/** Used to provide the equivalent of an empty Node for GET requests
* to *.something (SLING-344)
@@ -36,6 +37,10 @@
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 {
@@ -81,6 +86,8 @@
resourceType = DEFAULT_RESOURCE_TYPE;
}
setResourceType(resourceType);
+
+ resourceSuperType = UNSET_RESOURCE_SUPER_TYPE;
}
/** adaptTo(Node) returns a Fake node, that returns empty values
@@ -96,6 +103,17 @@
return null;
}
+ /**
+ * Calls {@link JcrResourceUtil#getResourceSuperType(Resource)} method
+ * to dynamically resolve the resource super type of this star resource.
+ */
+ public String getResourceSuperType() {
+ if (resourceSuperType == UNSET_RESOURCE_SUPER_TYPE) {
+ resourceSuperType = JcrResourceUtil.getResourceSuperType(this);
+ }
+ return resourceSuperType;
+ }
+
/** Get our ResourceMetadata for given path */
static ResourceMetadata getResourceMetadata(String path) {
ResourceMetadata result = new ResourceMetadata();