Return-Path: Delivered-To: apmail-incubator-sling-commits-archive@locus.apache.org Received: (qmail 23057 invoked from network); 3 Dec 2007 13:25:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Dec 2007 13:25:23 -0000 Received: (qmail 86761 invoked by uid 500); 3 Dec 2007 13:25:11 -0000 Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org Received: (qmail 86705 invoked by uid 500); 3 Dec 2007 13:25:11 -0000 Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sling-dev@incubator.apache.org Delivered-To: mailing list sling-commits@incubator.apache.org Received: (qmail 86696 invoked by uid 99); 3 Dec 2007 13:25:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Dec 2007 05:25:11 -0800 X-ASF-Spam-Status: No, hits=-98.0 required=10.0 tests=ALL_TRUSTED,URIBL_BLACK X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Dec 2007 13:25:21 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F141F1A9832; Mon, 3 Dec 2007 05:24:59 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r600524 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java Date: Mon, 03 Dec 2007 13:24:59 -0000 To: sling-commits@incubator.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071203132459.F141F1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fmeschbe Date: Mon Dec 3 05:24:59 2007 New Revision: 600524 URL: http://svn.apache.org/viewvc?rev=600524&view=rev Log: SLING-109 Support Resource adapter Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java?rev=600524&r1=600523&r2=600524&view=diff ============================================================================== --- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java (original) +++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceManager.java Mon Dec 3 05:24:59 2007 @@ -40,9 +40,7 @@ import org.apache.jackrabbit.ocm.manager.ObjectContentManager; import org.apache.jackrabbit.ocm.reflection.ReflectionUtils; import org.apache.sling.api.SlingException; -import org.apache.sling.api.resource.NodeProvider; import org.apache.sling.api.resource.NonExistingResource; -import org.apache.sling.api.resource.ObjectProvider; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceManager; import org.apache.sling.api.resource.ResourceMetadata; @@ -54,7 +52,6 @@ import org.apache.sling.jcr.resource.internal.helper.JcrNodeResourceIterator; import org.apache.sling.jcr.resource.internal.helper.Mapping; import org.apache.sling.jcr.resource.internal.helper.ResourcePathIterator; -import org.osgi.framework.Bundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -298,8 +295,8 @@ */ public void store(Resource resource) throws SlingException { String path = resource.getURI(); - if (resource instanceof ObjectProvider) { - Object data = ((ObjectProvider) resource).getObject(); + Object data = resource.adaptTo(Object.class); + if (data != null) { try { if (itemExists(path)) { checkPermission(path, ACTION_SET_PROPERTY); @@ -399,13 +396,14 @@ throws SlingException { String path = resource.getURI(); - if (!(resource instanceof NodeProvider)) { + Node node = resource.adaptTo(Node.class); + if (node == null) { log.info("orderBefore: Resource {} is not based on a JCR", path); return; } try { - Node parent = ((NodeProvider) resource).getNode().getParent(); + Node parent = node.getParent(); // check whether the parent node supports child node ordering if (!parent.getPrimaryNodeType().hasOrderableChildNodes()) {