You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <Fe...@day.com> on 2007/12/07 11:50:07 UTC

Re: svn commit: r602052 - in /incubator/sling/trunk/scripting: jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/ jsp-taglib/src/main/resources/META-INF/ jsp/src/main/java/org/apache/sling/scripting/jsp/util/

-1 :-)

There IS a ResourceManager in the API: it is an interface extending
ResourceResolver and implemented by the JcrResourceManager. It is used
for object mapping stuff.

So, I would propose to re-add this. 

Regards
Felix


Am Freitag, den 07.12.2007, 09:57 +0000 schrieb cziegeler@apache.org:
> Author: cziegeler
> Date: Fri Dec  7 01:57:29 2007
> New Revision: 602052
> 
> URL: http://svn.apache.org/viewvc?rev=602052&view=rev
> Log:
> There is no resource manager in the api anymore. The resource resolver can be get directly from the request, so no need for additional taglib support.
> 
> 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
>     incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/util/TagUtil.java
> 
> 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=602052&r1=602051&r2=602052&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 Fri Dec  7 01:57:29 2007
> @@ -16,14 +16,7 @@
>   */
>  package org.apache.sling.scripting.jsp.taglib;
>  
> -import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.DEFAULT_MAPPED_OBJECT_NAME;
> -import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.DEFAULT_NODE_NAME;
> -import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.DEFAULT_REQUEST_NAME;
> -import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.DEFAULT_RESOURCE_MANAGER_CLASS;
> -import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.DEFAULT_RESOURCE_MANAGER_NAME;
> -import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.DEFAULT_RESOURCE_NAME;
> -import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.DEFAULT_RESPONSE_NAME;
> -import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.DEFAULT_SERVICE_LOCATOR_NAME;
> +import static org.apache.sling.scripting.jsp.taglib.DefineObjectsTag.*;
>  
>  import java.util.ArrayList;
>  import java.util.List;
> @@ -86,18 +79,6 @@
>       */
>      public static final String ATTR_SERVICE_LOCATOR_NAME = "serviceLocatorName";
>  
> -    /**
> -     * The name of the tag attribute used to define the name of the
> -     * ResourceManager scripting variable (value is "resourceManagerName").
> -     */
> -    public static final String ATTR_RESOURCE_MANAGER_NAME = "resourceManagerName";
> -
> -    /**
> -     * The name of the tag attribute used to define the type of the
> -     * ResourceManager scripting variable (value is "resourceManagerClass").
> -     */
> -    public static final String ATTR_RESOURCE_MANAGER_CLASS = "resourceManagerClass";
> -
>      private static final String RENDER_REQUEST_CLASS = SlingHttpServletRequest.class.getName();
>  
>      private static final String RENDER_RESPONSE_CLASS = SlingHttpServletResponse.class.getName();
> @@ -131,11 +112,6 @@
>              null);
>          addVar(varInfos, data, ATTR_MAPPED_OBJECT_NAME,
>              DEFAULT_MAPPED_OBJECT_NAME, mappedObjectClass);
> -
> -        String resourceManagerClass = getValue(data,
> -            ATTR_RESOURCE_MANAGER_CLASS, DEFAULT_RESOURCE_MANAGER_CLASS);
> -        addVar(varInfos, data, ATTR_RESOURCE_MANAGER_NAME,
> -            DEFAULT_RESOURCE_MANAGER_NAME, resourceManagerClass);
>  
>          addVar(varInfos, data, ATTR_SERVICE_LOCATOR_NAME,
>              DEFAULT_SERVICE_LOCATOR_NAME, SERVICE_LOCATOR_CLASS);
> 
> 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=602052&r1=602051&r2=602052&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 Fri Dec  7 01:57:29 2007
> @@ -22,7 +22,6 @@
>  import org.apache.sling.api.SlingHttpServletRequest;
>  import org.apache.sling.api.SlingHttpServletResponse;
>  import org.apache.sling.api.resource.Resource;
> -import org.apache.sling.api.resource.ResourceManager;
>  import org.apache.sling.scripting.jsp.util.TagUtil;
>  
>  /**
> @@ -66,19 +65,6 @@
>  
>      /**
>       * Default name for the scripting variable referencing the current
> -     * <code>ResourceManager</code> (value is "resourceManager").
> -     */
> -    public static final String DEFAULT_RESOURCE_MANAGER_NAME = "resourceManager";
> -
> -    /**
> -     * Default name of the Java type for the scripting variable referencing the
> -     * current <code>ResourceManager</code> (value is the fully qualified name
> -     * of the <code>ResourceManager</code> interface).
> -     */
> -    public static final String DEFAULT_RESOURCE_MANAGER_CLASS = ResourceManager.class.getName();
> -
> -    /**
> -     * Default name for the scripting variable referencing the current
>       * <code>ServiceLocator</code> (value is "serviceLocator").
>       */
>      public static final String DEFAULT_SERVICE_LOCATOR_NAME = "serviceLocator";
> @@ -95,10 +81,6 @@
>  
>      private String mappedObjectClass = null;
>  
> -    private String resourceManagerName = DEFAULT_RESOURCE_MANAGER_NAME;
> -
> -    private String resourceManagerClass = DEFAULT_RESOURCE_MANAGER_CLASS;
> -
>      private String serviceLocatorName = DEFAULT_SERVICE_LOCATOR_NAME;
>  
>      /**
> @@ -114,10 +96,9 @@
>       * <li><code>SlingHttpServletResponse</code>
>       * <li>current <code>Resource</code>
>       * <li>current <code>Node</code> (if resource is a NodeProvider)
> -     * <li>current <code>ResourcManager</code>
>       * <li>current <code>ServiceLocator</code>
>       * </ul>
> -     * 
> +     *
>       * @return always {@link #EVAL_PAGE}.
>       */
>      public int doEndTag() {
> @@ -125,12 +106,10 @@
>          SlingHttpServletRequest req = TagUtil.getRequest(pageContext);
>          SlingHttpServletResponse res = TagUtil.getResponse(pageContext);
>          Resource resource = req.getResource();
> -        ResourceManager resourceManager = TagUtil.getResourceManager(pageContext);
>  
>          pageContext.setAttribute(requestName, req);
>          pageContext.setAttribute(responseName, res);
>          pageContext.setAttribute(resourceName, resource);
> -        pageContext.setAttribute(resourceManagerName, resourceManager);
>          pageContext.setAttribute(serviceLocatorName, req.getServiceLocator());
>  
>          Node node = resource.adaptTo(Node.class);
> @@ -173,14 +152,6 @@
>  
>      public void setMappedObjectClass(String name) {
>          this.mappedObjectClass = name;
> -    }
> -
> -    public void setResourceManagerName(String name) {
> -        this.resourceManagerName = name;
> -    }
> -
> -    public void setResourceManagerClass(String name) {
> -        this.resourceManagerClass = name;
>      }
>  
>      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=602052&r1=602051&r2=602052&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 Fri Dec  7 01:57:29 2007
> @@ -129,16 +129,6 @@
>              <rtexprvalue>false</rtexprvalue>
>          </attribute>
>          <attribute>
> -            <name>resourceManagerName</name>
> -            <required>false</required>
> -            <rtexprvalue>false</rtexprvalue>
> -        </attribute>
> -        <attribute>
> -            <name>resourceManagerClass</name>
> -            <required>false</required>
> -            <rtexprvalue>false</rtexprvalue>
> -        </attribute>
> -        <attribute>
>              <name>serviceLocatorName</name>
>              <required>false</required>
>              <rtexprvalue>false</rtexprvalue>
> 
> Modified: incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/util/TagUtil.java
> URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/util/TagUtil.java?rev=602052&r1=602051&r2=602052&view=diff
> ==============================================================================
> --- incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/util/TagUtil.java (original)
> +++ incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/util/TagUtil.java Fri Dec  7 01:57:29 2007
> @@ -25,7 +25,6 @@
>  
>  import org.apache.sling.api.SlingHttpServletRequest;
>  import org.apache.sling.api.SlingHttpServletResponse;
> -import org.apache.sling.api.resource.ResourceManager;
>  import org.slf4j.Logger;
>  
>  /**
> @@ -111,14 +110,5 @@
>          }
>  
>          return (SlingHttpServletResponse) req;
> -    }
> -
> -    public static ResourceManager getResourceManager(PageContext pageContext) {
> -        try {
> -            SlingHttpServletRequest request = getRequest(pageContext);
> -            return (ResourceManager) request.getResourceResolver();
> -        } catch (ClassCastException cce) {
> -            throw new IllegalStateException("request wrong class");
> -        }
>      }
>  }
> 
> 


Re: svn commit: r602052 - in /incubator/sling/trunk/scripting: jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/ jsp-taglib/src/main/resources/META-INF/ jsp/src/main/java/org/apache/sling/scripting/jsp/util/

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> -1 :-)
> 
> There IS a ResourceManager in the API: it is an interface extending
> ResourceResolver and implemented by the JcrResourceManager. It is used
> for object mapping stuff.
> 
> So, I would propose to re-add this. 
> 
:) Yes, you're right (of course). (I got confused as there was unused
stuff in the taglib code,
sorry for that)

I'll readd the stuff.

But I'm wondering now if this is a good thing in general to have an
additional ResourceManager interface and then assuming that
request.getResourceResolver() returns a ResourceManager.

We found this nice solution for the Resource (the adaptTo) method - I'm
not sure if we need something corresponding to this for the resource
resolver as well?

Carsten


-- 
Carsten Ziegeler
cziegeler@apache.org