incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r896873 - in /sling/trunk/bundles/scripting/jsp-taglib: pom.xml src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
Date Thu, 07 Jan 2010 13:14:01 GMT
Author: cziegeler
Date: Thu Jan  7 13:13:06 2010
New Revision: 896873

URL: http://svn.apache.org/viewvc?rev=896873&view=rev
Log:
SLING-1277 : Make dependency to jcr api optional

Modified:
    sling/trunk/bundles/scripting/jsp-taglib/pom.xml
    sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
    sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java

Modified: sling/trunk/bundles/scripting/jsp-taglib/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/pom.xml?rev=896873&r1=896872&r2=896873&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp-taglib/pom.xml (original)
+++ sling/trunk/bundles/scripting/jsp-taglib/pom.xml Thu Jan  7 13:13:06 2010
@@ -53,6 +53,7 @@
                             org.apache.sling.scripting.jsp.taglib.*;version=${pom.version}
                         </Export-Package>
                         <Import-Package>
+                            javax.jcr;resolution:=optional,
                             javax.servlet.jsp.*;version=2.0,
                             *
                         </Import-Package>
@@ -76,11 +77,13 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
             <version>2.0.8</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.jsp</artifactId>
-            <version>2.0.2-incubator</version>
+            <version>2.0.8</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>

Modified: sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java?rev=896873&r1=896872&r2=896873&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
(original)
+++ sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTEI.java
Thu Jan  7 13:13:06 2010
@@ -27,7 +27,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.jcr.Node;
 import javax.servlet.jsp.tagext.TagData;
 import javax.servlet.jsp.tagext.TagExtraInfo;
 import javax.servlet.jsp.tagext.VariableInfo;
@@ -95,7 +94,7 @@
 
     private static final String RESOURCE_RESOLVER_CLASS = ResourceResolver.class.getName();
 
-    private static final String NODE_CLASS = Node.class.getName();
+    private static final String NODE_CLASS = "javax.jcr.Node";
 
     private static final String SLING_CLASS = SlingScriptHelper.class.getName();
 
@@ -118,7 +117,9 @@
 
         addVar(varInfos, data, ATTR_RESOURCE_NAME, DEFAULT_RESOURCE_NAME,
             RESOURCE_CLASS);
-        addVar(varInfos, data, ATTR_NODE_NAME, DEFAULT_NODE_NAME, NODE_CLASS);
+        if ( DefineObjectsTag.JCR_NODE_CLASS != null ) {
+            addVar(varInfos, data, ATTR_NODE_NAME, DEFAULT_NODE_NAME, NODE_CLASS);
+        }
 
         addVar(varInfos, data, ATTR_RESOURCE_RESOLVER_NAME,
             DEFAULT_RESOURCE_RESOLVER_NAME, RESOURCE_RESOLVER_CLASS);

Modified: sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java?rev=896873&r1=896872&r2=896873&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
(original)
+++ sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/DefineObjectsTag.java
Thu Jan  7 13:13:06 2010
@@ -16,7 +16,6 @@
  */
 package org.apache.sling.scripting.jsp.taglib;
 
-import javax.jcr.Node;
 import javax.servlet.jsp.tagext.TagSupport;
 
 import org.apache.sling.api.resource.Resource;
@@ -87,6 +86,15 @@
 
     private String resourceResolverName = DEFAULT_RESOURCE_RESOLVER_NAME;
 
+    static Class<?> JCR_NODE_CLASS;
+    static {
+        try {
+            JCR_NODE_CLASS = DefineObjectsTag.class.getClassLoader().loadClass("javax.jcr.Node");
+        } catch (Exception ignore) {
+            // we just ignore this
+        }
+    }
+
     /**
      * Default constructor.
      */
@@ -117,9 +125,11 @@
         pageContext.setAttribute(resourceResolverName, scriptHelper.getRequest().getResourceResolver());
         pageContext.setAttribute(slingName, scriptHelper);
         pageContext.setAttribute(logName, bindings.getLog());
-        final Node node = resource.adaptTo(Node.class);
-        if (node != null) {
-            pageContext.setAttribute(nodeName, node);
+        if ( JCR_NODE_CLASS != null ) {
+            final Object node = resource.adaptTo(JCR_NODE_CLASS);
+            if (node != null) {
+                pageContext.setAttribute(nodeName, node);
+            }
         }
 
         return EVAL_PAGE;



Mime
View raw message