incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r581826 - in /incubator/sling/trunk/scripting-jsp-taglib/src/main: java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java resources/META-INF/taglib.tld
Date Thu, 04 Oct 2007 09:55:04 GMT
Author: fmeschbe
Date: Thu Oct  4 02:55:03 2007
New Revision: 581826

URL: http://svn.apache.org/viewvc?rev=581826&view=rev
Log:
SLING-38 Support declaring the class name of the ContentManager in the sling:defineObjects
tag

Modified:
    incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
    incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
    incubator/sling/trunk/scripting-jsp-taglib/src/main/resources/META-INF/taglib.tld

Modified: incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java?rev=581826&r1=581825&r2=581826&view=diff
==============================================================================
--- incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
(original)
+++ incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
Thu Oct  4 02:55:03 2007
@@ -23,7 +23,6 @@
 import org.apache.sling.core.ServiceLocator;
 import org.apache.sling.component.ComponentRequest;
 import org.apache.sling.component.ComponentResponse;
-import org.apache.sling.content.ContentManager;
 
 /**
  * This class defines the scripting variables that are created by the
@@ -73,14 +72,18 @@
      */
     public static final String ATTR_CONTENT_MANAGER_NAME = "contentManagerName";
 
+    /**
+     * The name of the tag attribute used to define the type of the
+     * ContentManager scripting variable (value is "contentManagerClass").
+     */
+    public static final String ATTR_CONTENT_MANAGER_CLASS = "contentManagerClass";
+
     private static final String RENDER_REQUEST_CLASS = ComponentRequest.class.getName();
 
     private static final String RENDER_RESPONSE_CLASS = ComponentResponse.class.getName();
 
     private static final String STRING_CLASS = "String"; // always imported
 
-    private static final String CONTENT_MANAGER_CLASS = ContentManager.class.getName();
-
     private static final String SERVICE_LOCATOR_CLASS = ServiceLocator.class.getName();
 
     /**
@@ -102,6 +105,8 @@
             DefineObjectsTag.DEFUALT_HANDLE_NAME);
         String contentManagerName = this.getValue(data, ATTR_CONTENT_MANAGER_NAME,
             DefineObjectsTag.DEFAULT_CONTENT_MANAGER_NAME);
+        String contentManagerClass = this.getValue(data, ATTR_CONTENT_MANAGER_CLASS,
+            DefineObjectsTag.DEFAULT_CONTENT_MANAGER_CLASS);
         String serviceLocatorName = this.getValue(data, ATTR_SERVICE_LOCATOR_NAME,
             DefineObjectsTag.DEFAULT_SERVICE_LOCATOR_NAME);
 
@@ -114,7 +119,7 @@
                 VariableInfo.AT_END),
             new VariableInfo(handleName, STRING_CLASS, true,
                 VariableInfo.AT_END),
-            new VariableInfo(contentManagerName, CONTENT_MANAGER_CLASS, true,
+            new VariableInfo(contentManagerName, contentManagerClass, true,
                 VariableInfo.AT_END),
             new VariableInfo(serviceLocatorName, SERVICE_LOCATOR_CLASS, true,
                 VariableInfo.AT_END) };

Modified: incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java?rev=581826&r1=581825&r2=581826&view=diff
==============================================================================
--- incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
(original)
+++ incubator/sling/trunk/scripting-jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
Thu Oct  4 02:55:03 2007
@@ -56,8 +56,8 @@
 
     /**
      * Default name of the Java type for the scripting variable referencing the
-     * current <code>Content</code> object (value is
-     * "org.apache.sling.components.Content").
+     * current <code>Content</code> object (value is the fully qualifed name
+     * of the <code>Content</code> interface).
      */
     public static final String DEFAULT_CONTENT_CLASS = Content.class.getName();
 
@@ -74,6 +74,13 @@
     public static final String DEFAULT_CONTENT_MANAGER_NAME = "contentManager";
 
     /**
+     * Default name of the Java type for the scripting variable referencing the
+     * current <code>ContentManager</code> (value is the fully qualified name
+     * of the <code>ContentManager</code> inerface).
+     */
+    public static final String DEFAULT_CONTENT_MANAGER_CLASS = ContentManager.class.getName();
+
+    /**
      * Default name for the scripting variable referencing the current
      * <code>ServiceLocator</code> (value is "serviceLocator").
      */
@@ -91,6 +98,8 @@
 
     private String contentManagerName = DEFAULT_CONTENT_MANAGER_NAME;
 
+    private String contentManagerClass = DEFAULT_CONTENT_MANAGER_CLASS;
+
     private String serviceLocatorName = DEFAULT_SERVICE_LOCATOR_NAME;
 
     /**
@@ -113,26 +122,27 @@
      */
     public int doEndTag() {
 
-        ComponentRequest req = TagUtil.getRequest(this.pageContext);
-        ComponentResponse res = TagUtil.getResponse(this.pageContext);
+        ComponentRequest req = TagUtil.getRequest(pageContext);
+        ComponentResponse res = TagUtil.getResponse(pageContext);
         Content content = req.getContent();
-        ContentManager contentManager = TagUtil.getContentManager(this.pageContext);
+        ContentManager contentManager = TagUtil.getContentManager(pageContext);
 
-        this.pageContext.setAttribute(this.requestName, req);
-        this.pageContext.setAttribute(this.responseName, res);
-        this.pageContext.setAttribute(this.contentManagerName, contentManager);
+        pageContext.setAttribute(requestName, req);
+        pageContext.setAttribute(responseName, res);
+        pageContext.setAttribute(contentManagerName, contentManager);
+        pageContext.setAttribute(contentManagerClass, contentManager.getClass().getName());
 
         // content may be null
         if (content != null) {
-            this.pageContext.setAttribute(this.contentName, content);
-            this.pageContext.setAttribute(this.contentClass, content.getClass().getName());
-            this.pageContext.setAttribute(this.handleName, content.getPath());
+            pageContext.setAttribute(contentName, content);
+            pageContext.setAttribute(contentClass, content.getClass().getName());
+            pageContext.setAttribute(handleName, content.getPath());
         } else {
-            TagUtil.log(log, this.pageContext, "RenderRequest has no Content !",
+            TagUtil.log(log, pageContext, "RenderRequest has no Content !",
                 null);
         }
 
-        this.pageContext.setAttribute(this.serviceLocatorName, req.getAttribute(ServiceLocator.REQUEST_ATTRIBUTE_NAME));
+        pageContext.setAttribute(serviceLocatorName, req.getAttribute(ServiceLocator.REQUEST_ATTRIBUTE_NAME));
 
         return EVAL_PAGE;
     }
@@ -161,6 +171,10 @@
 
     public void setContentManagerName(String contentManagerName) {
         this.contentManagerName = contentManagerName;
+    }
+
+    public void setContentManagerClass(String contentManagerClass) {
+        this.contentManagerClass = contentManagerClass;
     }
 
     public void setServiceLocatorName(String name) {

Modified: incubator/sling/trunk/scripting-jsp-taglib/src/main/resources/META-INF/taglib.tld
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting-jsp-taglib/src/main/resources/META-INF/taglib.tld?rev=581826&r1=581825&r2=581826&view=diff
==============================================================================
--- incubator/sling/trunk/scripting-jsp-taglib/src/main/resources/META-INF/taglib.tld (original)
+++ incubator/sling/trunk/scripting-jsp-taglib/src/main/resources/META-INF/taglib.tld Thu
Oct  4 02:55:03 2007
@@ -114,6 +114,11 @@
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>contentManagerClass</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>serviceLocatorName</name>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>



Mime
View raw message