Author: cziegeler
Date: Wed Nov 19 08:18:45 2014
New Revision: 1640498

URL: http://svn.apache.org/r1640498
Log:
SLING-3865 : Remove JcrResource.adaptTo(URL

Modified:
    sling/trunk/bundles/jcr/resource/pom.xml
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java

Modified: sling/trunk/bundles/jcr/resource/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/pom.xml?rev=1640498&r1=1640497&r2=1640498&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/pom.xml (original)
+++ sling/trunk/bundles/jcr/resource/pom.xml Wed Nov 19 08:18:45 2014
@@ -94,7 +94,6 @@
 
                         <!-- Include URL support from Jackrabbit -->
                         <Embed-Dependency>
-                            
jackrabbit-classloader;inline="org/apache/jackrabbit/net/**|org/apache/jackrabbit/classloader/Util.*",
                             
jackrabbit-jcr-commons;inline="org/apache/jackrabbit/util/ISO9075.*|org/apache/jackrabbit/name/QName.*|org/apache/jackrabbit/util/XMLChar.*|org/apache/jackrabbit/util/Text.*",
                         </Embed-Dependency>
 

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java?rev=1640498&r1=1640497&r2=1640498&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
 Wed Nov 19 08:18:45 2014
@@ -21,7 +21,6 @@ import static org.apache.jackrabbit.JcrC
 import static org.apache.jackrabbit.JcrConstants.NT_FILE;
 
 import java.io.InputStream;
-import java.net.URL;
 import java.security.AccessControlException;
 import java.util.Iterator;
 import java.util.Map;
@@ -32,7 +31,6 @@ import javax.jcr.Node;
 import javax.jcr.Property;
 import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.net.URLFactory;
 import org.apache.sling.adapter.annotations.Adaptable;
 import org.apache.sling.adapter.annotations.Adapter;
 import org.apache.sling.api.resource.ModifiableValueMap;
@@ -49,7 +47,7 @@ import org.slf4j.LoggerFactory;
 
 /** A Resource that wraps a JCR Node */
 @Adaptable(adaptableClass=Resource.class, adapters={
-        @Adapter({Node.class, Map.class, Item.class, ValueMap.class, 
URL.class}),
+        @Adapter({Node.class, Map.class, Item.class, ValueMap.class}),
         @Adapter(value=PersistableValueMap.class, condition="If the resource 
is a JcrNodeResource and the user has set property privileges on the node."),
         @Adapter(value=InputStream.class, condition="If the resource is a 
JcrNodeResource and has a jcr:data property or is an nt:file node.")
 })
@@ -58,8 +56,6 @@ class JcrNodeResource extends JcrItemRes
     /** marker value for the resourceSupertType before trying to evaluate */
     private static final String UNSET_RESOURCE_SUPER_TYPE = "<unset>";
 
-    private static volatile boolean loggedUrlWarning = false;
-
     /** default log */
     private static final Logger LOGGER = 
LoggerFactory.getLogger(JcrNodeResource.class);
 
@@ -132,8 +128,6 @@ class JcrNodeResource extends JcrItemRes
             return (Type) getNode(); // unchecked cast
         } else if (type == InputStream.class) {
             return (Type) getInputStream(); // unchecked cast
-        } else if (type == URL.class) {
-            return (Type) getURL(); // unchecked cast
         } else if (type == Map.class || type == ValueMap.class) {
             return (Type) new JcrPropertyMap(getNode(), 
this.dynamicClassLoader); // unchecked cast
         } else if (type == PersistableValueMap.class ) {
@@ -241,21 +235,6 @@ class JcrNodeResource extends JcrItemRes
         return null;
     }
 
-    private URL getURL() {
-        if ( !loggedUrlWarning ) {
-            loggedUrlWarning = true;
-            LOGGER.warn("Adapting a JCR resource to a URL is deprecated. This 
feature will be " +
-                    "removed in future versions. Please adjust your code.");
-        }
-        try {
-            return URLFactory.createURL(getNode().getSession(), getPath());
-        } catch (final Exception ex) {
-            LOGGER.error("getURL: Cannot create URL for " + this, ex);
-        }
-
-        return null;
-    }
-
     // ---------- Descendable interface 
----------------------------------------
 
     @Override


Reply via email to