Author: dklco
Date: Mon May 13 21:57:49 2013
New Revision: 1482119

URL: http://svn.apache.org/r1482119
Log:
Fixes SLING-2871, made the names of the functions and taglibs more consistent

Added:
    
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptToTag.java
      - copied, changed from r1475774, 
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptObjectTag.java
Removed:
    
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptObjectTag.java
Modified:
    
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
    
sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib13.tld
    
sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestAdaptObjectTag.java
    
sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestSlingFunctions.java

Copied: 
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptToTag.java
 (from r1475774, 
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptObjectTag.java)
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptToTag.java?p2=sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptToTag.java&p1=sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptObjectTag.java&r1=1475774&r2=1482119&rev=1482119&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptObjectTag.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AdaptToTag.java
 Mon May 13 21:57:49 2013
@@ -28,10 +28,10 @@ import org.slf4j.LoggerFactory;
 /**
  * Tag for adapting adaptables to classes.
  */
-public class AdaptObjectTag extends TagSupport {
+public class AdaptToTag extends TagSupport {
 
        private static final Logger log = LoggerFactory
-                       .getLogger(AdaptObjectTag.class);
+                       .getLogger(AdaptToTag.class);
        private static final long serialVersionUID = -1945089681840552408L;
        private Adaptable adaptable;
        private String adaptTo;

Modified: 
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java?rev=1482119&r1=1482118&r2=1482119&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
 Mon May 13 21:57:49 2013
@@ -154,7 +154,7 @@ public class SlingFunctions {
         * @return the children of the resource
         * @see org.apache.sling.api.resource.Resource#listChildren()
         */
-       public static final Iterator<Resource> listChildResources(Resource 
resource) {
+       public static final Iterator<Resource> listChildren(Resource resource) {
                log.trace("listChildren");
                
                Iterator<Resource> children = null;

Modified: 
sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib13.tld
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib13.tld?rev=1482119&r1=1482118&r2=1482119&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib13.tld
 (original)
+++ 
sling/trunk/bundles/scripting/jsp-taglib/src/main/resources/META-INF/taglib13.tld
 Mon May 13 21:57:49 2013
@@ -43,9 +43,9 @@
        </function>
 
        <function>
-               <name>listChildResources</name>
+               <name>listChildren</name>
                
<function-class>org.apache.sling.scripting.jsp.taglib.SlingFunctions</function-class>
-               <function-signature>java.util.Iterator 
listChildResources(org.apache.sling.api.resource.Resource)</function-signature>
+               <function-signature>java.util.Iterator 
listChildren(org.apache.sling.api.resource.Resource)</function-signature>
        </function>
 
        <tag>
@@ -77,8 +77,7 @@
                <attribute>
                        <description>
                                Controls if the component hierarchy should be 
ignored
-                               for script
-                               resolution. If true, only the search paths are 
respected.
+                               for script resolution. If true, only the search 
paths are respected.
                        </description>
                        <name>ignoreComponentHierarchy</name>
                        <required>false</required>
@@ -108,8 +107,7 @@
                        <description>
                                The resource object to include in the current 
request
                                processing. Either resource or path must be 
specified. If
-                               both are
-                               specified, the resource takes precedences.
+                               both are specified, the resource takes 
precedences.
                        </description>
                        <name>resource</name>
                        <required>false</required>
@@ -119,14 +117,10 @@
                <attribute>
                        <description>
                                The path to the resource object to include in 
the
-                               current
-                               request processing. If this path is relative it 
is
-                               appended to
-                               the path of the current resource whose
-                               script is including the given
-                               resource. Either resource
-                               or path must be specified. If both are
-                               specified, the
+                               current request processing. If this path is 
relative it is
+                               appended to the path of the current resource 
whose
+                               script is including the given resource. Either 
resource
+                               or path must be specified. If both are 
specified, the
                                resource takes precedences.
                        </description>
                        <name>path</name>
@@ -136,19 +130,13 @@
                <attribute>
                        <description>
                                The resource type of a resource to include. If 
the
-                               resource
-                               to be included is specified with the path 
attribute,
-                               which
-                               cannot be resolved to a resource, the tag may
-                               create a synthetic
-                               resource object out of the path and
-                               this resource type. If the
-                               resource type is set the path
-                               must be the exact path to a resource
-                               object. That is,
+                               resource to be included is specified with the 
path attribute,
+                               which cannot be resolved to a resource, the tag 
may
+                               create a synthetic resource object out of the 
path and
+                               this resource type. If the resource type is set 
the path
+                               must be the exact path to a resource object. 
That is,
                                adding parameters, selectors and extensions to 
the
-                               path
-                               is not supported if the resource type is set.
+                               path is not supported if the resource type is 
set.
                        </description>
                        <name>resourceType</name>
                        <required>false</required>
@@ -166,8 +154,7 @@
                <attribute>
                        <description>
                                When dispatching, add the value provided by 
this option
-                               to the
-                               selectors.
+                               to the selectors.
                        </description>
                        <name>addSelectors</name>
                        <required>false</required>
@@ -198,8 +185,7 @@
                        <description>
                                The resource object to forward the request to. 
Either
                                resource or path must be specified. If both are
-                               specified, the
-                               resource takes precedences.
+                               specified, the resource takes precedences.
                        </description>
                        <name>resource</name>
                        <required>false</required>
@@ -210,12 +196,9 @@
                        <description>
                                The path to the resource object to forward the 
request
                                to. If this path is relative it is appended to 
the path
-                               of the
-                               current resource whose script is forwarding the
-                               given resource.
-                               Either resource or path must be specified.
-                               If both are specified, the
-                               resource takes precedences.
+                               of the current resource whose script is 
forwarding the
+                               given resource. Either resource or path must be 
specified.
+                               If both are specified, the resource takes 
precedences.
                        </description>
                        <name>path</name>
                        <required>false</required>
@@ -224,19 +207,13 @@
                <attribute>
                        <description>
                                The resource type of a resource to forward. If 
the
-                               resource
-                               to be forwarded is specified with the path 
attribute,
-                               which
-                               cannot be resolved to a resource, the tag may
-                               create a synthetic
-                               resource object out of the path and
-                               this resource type. If the
-                               resource type is set the path
-                               must be the exact path to a resource
-                               object. That is,
+                               resource to be forwarded is specified with the 
path attribute,
+                               which cannot be resolved to a resource, the tag 
may
+                               create a synthetic resource object out of the 
path and
+                               this resource type. If the resource type is set 
the path
+                               must be the exact path to a resource object. 
That is,
                                adding parameters, selectors and extensions to 
the
-                               path
-                               is not supported if the resource type is set.
+                               path is not supported if the resource type is 
set.
                        </description>
                        <name>resourceType</name>
                        <required>false</required>
@@ -254,8 +231,7 @@
                <attribute>
                        <description>
                                When dispatching, add the value provided by 
this option
-                               to the
-                               selectors.
+                               to the selectors.
                        </description>
                        <name>addSelectors</name>
                        <required>false</required>
@@ -324,8 +300,7 @@
        <tag>
                <description>
                        Evaluates a script invocation and includes the result
-                       in
-                       the current page.
+                       in the current page.
                </description>
                <name>eval</name>
                <tag-class>
@@ -392,9 +367,9 @@
                <description>
                        Adapts adaptables to objects of other types.
                </description>
-               <name>adapt</name>
+               <name>adaptTo</name>
                <tag-class>
-                       org.apache.sling.scripting.jsp.taglib.AdaptObjectTag
+                       org.apache.sling.scripting.jsp.taglib.AdaptToTag
                </tag-class>
                <body-content>empty</body-content>
                <attribute>
@@ -457,8 +432,7 @@
        <tag>
                <description>
                        Tag for searching for resources using the given query
-                       formulated in the
-                       given language.
+                       formulated in the given language.
                </description>
                <name>findResources</name>
                <tag-class>
@@ -534,8 +508,7 @@
        <tag>
                <description>
                        Retrieves the value from the ValueMap, allowing for a
-                       default value or
-                       coercing the return value.
+                       default value or coercing the return value.
                </description>
                <name>getProperty</name>
                <tag-class>

Modified: 
sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestAdaptObjectTag.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestAdaptObjectTag.java?rev=1482119&r1=1482118&r2=1482119&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestAdaptObjectTag.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestAdaptObjectTag.java
 Mon May 13 21:57:49 2013
@@ -37,7 +37,7 @@ public class TestAdaptObjectTag {
 
        private static final Logger log = LoggerFactory
                        .getLogger(TestAdaptObjectTag.class);
-       private AdaptObjectTag adaptObjectTag;
+       private AdaptToTag adaptToTag;
        private MockResource resource;
        private MockPageContext pageContext;
        private static final String VAR_KEY = "properties";
@@ -49,14 +49,14 @@ public class TestAdaptObjectTag {
        @Before
        public void init() {
                log.info("init");
-               adaptObjectTag = new AdaptObjectTag() {
+               adaptToTag = new AdaptToTag() {
                        protected ClassLoader getClassLoader() {
                                return 
TestAdaptObjectTag.class.getClassLoader();
                        }
                };
 
                pageContext = new MockPageContext();
-               adaptObjectTag.setPageContext(pageContext);
+               adaptToTag.setPageContext(pageContext);
 
                ResourceResolver resolver = new MockResourceResolver();
                resource = new MockResource(resolver, "/", "test");
@@ -71,10 +71,10 @@ public class TestAdaptObjectTag {
                log.info("testAdaptObject");
 
                log.info("Setting up tests");
-               adaptObjectTag.setAdaptable(resource);
-               adaptObjectTag.setAdaptTo(ValueMap.class.getCanonicalName());
-               adaptObjectTag.setVar(VAR_KEY);
-               adaptObjectTag.doEndTag();
+               adaptToTag.setAdaptable(resource);
+               adaptToTag.setAdaptTo(ValueMap.class.getCanonicalName());
+               adaptToTag.setVar(VAR_KEY);
+               adaptToTag.doEndTag();
 
                log.info("Checking result");
                Object result = pageContext.getAttribute(VAR_KEY);
@@ -93,10 +93,10 @@ public class TestAdaptObjectTag {
                log.info("testMissingClass");
 
                log.info("Setting up tests");
-               adaptObjectTag.setAdaptable(resource);
-               adaptObjectTag.setAdaptTo("com.bad.class");
-               adaptObjectTag.setVar(VAR_KEY);
-               adaptObjectTag.doEndTag();
+               adaptToTag.setAdaptable(resource);
+               adaptToTag.setAdaptTo("com.bad.class");
+               adaptToTag.setVar(VAR_KEY);
+               adaptToTag.doEndTag();
 
                log.info("Checking result");
                Object result = pageContext.getAttribute(VAR_KEY);

Modified: 
sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestSlingFunctions.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestSlingFunctions.java?rev=1482119&r1=1482118&r2=1482119&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestSlingFunctions.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp-taglib/src/test/java/org/apache/sling/scripting/jsp/taglib/TestSlingFunctions.java
 Mon May 13 21:57:49 2013
@@ -33,8 +33,10 @@ import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 /**
  * Unit Tests for the Class SlingFunctions.
+ * 
  * @see org.apache.sling.scripting.jsp.taglib.SlingFunctions
  */
 public class TestSlingFunctions {
@@ -52,9 +54,10 @@ public class TestSlingFunctions {
        public void init() {
                log.info("init");
 
-               resolver = new MockResourceResolver(){
+               resolver = new MockResourceResolver() {
                        @Override
-                   public Iterator<Resource> findResources(String query, 
String language) {
+                       public Iterator<Resource> findResources(String query,
+                                       String language) {
                                if (query.equals("query") && 
language.equals("language")) {
                                        List<Resource> resources = new 
ArrayList<Resource>();
                                        resources.add(resource);
@@ -62,7 +65,7 @@ public class TestSlingFunctions {
                                } else {
                                        return null;
                                }
-                   }
+                       }
                };
                resource = new MockResource(resolver, TEST_PATH, "test");
                resolver.addResource(resource);
@@ -85,13 +88,13 @@ public class TestSlingFunctions {
 
                log.info("Tests successful!");
        }
-       
 
        @Test
        public void testFindResources() throws ClassNotFoundException {
                log.info("testFindResources");
 
-               Iterator<Resource> resources = 
SlingFunctions.findResources(resolver, "query", "language");
+               Iterator<Resource> resources = 
SlingFunctions.findResources(resolver,
+                               "query", "language");
                assertNotNull(resources);
                assertTrue(resources.hasNext());
                assertEquals(resource, resources.next());
@@ -126,8 +129,7 @@ public class TestSlingFunctions {
        @Test
        public void testListChildResources() {
                log.info("testListChildResources");
-               Iterator<Resource> children = SlingFunctions
-                               .listChildResources(resource);
+               Iterator<Resource> children = 
SlingFunctions.listChildren(resource);
                assertNotNull(children);
                assertTrue(children.hasNext());
 


Reply via email to