sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1450052 - in /sling/trunk/bundles: api/src/main/java/org/apache/sling/api/resource/ resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/
Date Tue, 26 Feb 2013 06:50:08 GMT
Author: cziegeler
Date: Tue Feb 26 06:50:07 2013
New Revision: 1450052

URL: http://svn.apache.org/r1450052
Log:
SLING-2739 :  Add methods for handling the resource type hierarchy to the resource resolver


Modified:
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
    sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java?rev=1450052&r1=1450051&r2=1450052&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java Tue
Feb 26 06:50:07 2013
@@ -122,7 +122,7 @@ public interface Resource extends Adapta
      * A resource might return a resource super type to overwrite the
      * resource type hierarchy.
      * If a client is interested in the effective resource super type
-     * of a resource, it should call {@link ResourceResolver#getResourceSuperType(Resource)}.
+     * of a resource, it should call {@link ResourceResolver#getParentResourceType(Resource)}.
      */
     String getResourceSuperType();
 

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java?rev=1450052&r1=1450051&r2=1450052&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
(original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
Tue Feb 26 06:50:07 2013
@@ -584,7 +584,7 @@ public interface ResourceResolver extend
      * Returns the super type of the given resource. This method checks first if
      * the resource itself knows its super type by calling
      * {@link Resource#getResourceSuperType()}. If that returns
-     * <code>null</code> {@link #getResourceSuperType(String)}
+     * <code>null</code> {@link #getParentSuperType(String)}
      * is invoked with the resource type of the resource.
      *
      * @param resource The resource to return the resource super type for.
@@ -593,7 +593,7 @@ public interface ResourceResolver extend
      *         provided resource is <code>null</code>
      * @since 2.3
      */
-    String getResourceSuperType(final Resource resource);
+    String getParentResourceType(final Resource resource);
 
     /**
      * Returns the super type of the given resource type. This method converts
@@ -608,7 +608,7 @@ public interface ResourceResolver extend
      *         <code>null</code> if <code>resourceType> is null.
      * @since 2.3
      */
-    public String getResourceSuperType(final String resourceType);
+    public String getParentSuperType(final String resourceType);
 
     /**
      * Returns <code>true</code> if the resource type or any of the resource's

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java?rev=1450052&r1=1450051&r2=1450052&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
(original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
Tue Feb 26 06:50:07 2013
@@ -414,12 +414,12 @@ public class ResourceUtil {
      *         <code>null</code> if the resource type does not exists or returns
      *         <code>null</code> for its super type.
      * @since 2.0.6
-     * @deprecated Use {@link ResourceResolver#getResourceSuperType(String)}
+     * @deprecated Use {@link ResourceResolver#getParentSuperType(String)}
      */
     @Deprecated
     public static String getResourceSuperType(
             final ResourceResolver resourceResolver, final String resourceType) {
-        return resourceResolver.getResourceSuperType(resourceType);
+        return resourceResolver.getParentSuperType(resourceType);
     }
 
     /**
@@ -433,11 +433,11 @@ public class ResourceUtil {
      * @return the super type of the <code>resource</code> or <code>null</code>
      *         if no super type could be computed.
      * @since 2.0.6
-     * @deprecated Use {@link ResourceResolver#getResourceSuperType(Resource)}
+     * @deprecated Use {@link ResourceResolver#getParentResourceType(Resource)}
      */
     @Deprecated
     public static String findResourceSuperType(final Resource resource) {
-        return resource.getResourceResolver().getResourceSuperType(resource);
+        return resource.getResourceResolver().getParentResourceType(resource);
     }
 
     /**

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=1450052&r1=1450051&r2=1450052&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
Tue Feb 26 06:50:07 2013
@@ -1085,23 +1085,23 @@ public class ResourceResolverImpl extend
     }
 
     /**
-     * @see org.apache.sling.api.resource.ResourceResolver#getResourceSuperType(org.apache.sling.api.resource.Resource)
+     * @see org.apache.sling.api.resource.ResourceResolver#getParentResourceType(org.apache.sling.api.resource.Resource)
      */
-    public String getResourceSuperType(final Resource resource) {
+    public String getParentResourceType(final Resource resource) {
         String resourceSuperType = null;
         if ( resource != null ) {
             resourceSuperType = resource.getResourceSuperType();
             if (resourceSuperType == null) {
-                resourceSuperType = this.getResourceSuperType(resource.getResourceType());
+                resourceSuperType = this.getParentSuperType(resource.getResourceType());
             }
         }
         return resourceSuperType;
     }
 
     /**
-     * @see org.apache.sling.api.resource.ResourceResolver#getResourceSuperType(java.lang.String)
+     * @see org.apache.sling.api.resource.ResourceResolver#getParentSuperType(java.lang.String)
      */
-    public String getResourceSuperType(final String resourceType) {
+    public String getParentSuperType(final String resourceType) {
         // normalize resource type to a path string
         final String rtPath = (resourceType == null ? null : ResourceUtil.resourceTypeToPath(resourceType));
         // get the resource type resource and check its super type
@@ -1138,12 +1138,12 @@ public class ResourceResolverImpl extend
              if (resourceType.equals(resource.getResourceType())) {
                  result = true;
              } else {
-                 String superType = this.getResourceSuperType(resource);
+                 String superType = this.getParentResourceType(resource);
                  while (!result && superType != null) {
                      if (resourceType.equals(superType)) {
                          result = true;
                      } else {
-                         superType = this.getResourceSuperType(superType);
+                         superType = this.getParentSuperType(superType);
                      }
                  }
              }

Modified: sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java?rev=1450052&r1=1450051&r2=1450052&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java
Tue Feb 26 06:50:07 2013
@@ -370,8 +370,8 @@ public class ResourceResolverImplTest {
         resolver.setResource("/a", r);
         resolver.setResource("/a/b", typeResource);
 
-        assertEquals("t:c", resolver.getResourceSuperType(r.getResourceType()));
-        assertNull(resolver.getResourceSuperType(r2.getResourceType()));
+        assertEquals("t:c", resolver.getParentSuperType(r.getResourceType()));
+        assertNull(resolver.getParentSuperType(r2.getResourceType()));
     }
 
     @Test public void test_isA() {



Mime
View raw message