From oak-dev-return-3361-apmail-jackrabbit-oak-dev-archive=jackrabbit.apache.org@jackrabbit.apache.org Thu Jan 31 10:48:33 2013 Return-Path: X-Original-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB9C9D089 for ; Thu, 31 Jan 2013 10:48:32 +0000 (UTC) Received: (qmail 30920 invoked by uid 500); 31 Jan 2013 10:48:32 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 30742 invoked by uid 500); 31 Jan 2013 10:48:32 -0000 Mailing-List: contact oak-dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-dev@jackrabbit.apache.org Received: (qmail 30619 invoked by uid 99); 31 Jan 2013 10:48:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jan 2013 10:48:27 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of anchela@adobe.com designates 64.18.1.185 as permitted sender) Received: from [64.18.1.185] (HELO exprod6og103.obsmtp.com) (64.18.1.185) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jan 2013 10:48:19 +0000 Received: from outbound-smtp-2.corp.adobe.com ([193.104.215.16]) by exprod6ob103.postini.com ([64.18.5.12]) with SMTP ID DSNKUQpL3U1LyLo1tl4FnZ7BEMW8FQTqJ2Jr@postini.com; Thu, 31 Jan 2013 02:47:58 PST Received: from inner-relay-4.eur.adobe.com (inner-relay-4b [10.128.4.237]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id r0VAluC9012574 for ; Thu, 31 Jan 2013 02:47:56 -0800 (PST) Received: from nacas03.corp.adobe.com (nacas03.corp.adobe.com [10.8.189.121]) by inner-relay-4.eur.adobe.com (8.12.10/8.12.9) with ESMTP id r0VAltXL020868 for ; Thu, 31 Jan 2013 02:47:55 -0800 (PST) Received: from eurhub01.eur.adobe.com (10.128.4.30) by nacas03.corp.adobe.com (10.8.189.121) with Microsoft SMTP Server (TLS) id 8.3.297.1; Thu, 31 Jan 2013 02:47:54 -0800 Received: from angela.corp.adobe.com (10.132.1.18) by eurhub01.eur.adobe.com (10.128.4.111) with Microsoft SMTP Server id 8.3.297.1; Thu, 31 Jan 2013 10:47:52 +0000 Message-ID: <510A4BD8.6000409@adobe.com> Date: Thu, 31 Jan 2013 11:47:52 +0100 From: Angela Schreiber User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: Subject: Re: svn commit: r1440540 [1/2] - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authori... References: <20130130173339.4EA1323889DE@eris.apache.org> <510A4A4E.3090303@apache.org> In-Reply-To: <510A4A4E.3090303@apache.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org hi michael feel free to revert it. i decided to change it as i will heavily use ReadOnlyTree#getPath and i am sure it will have a negative impact on overall system performance as it's within the permission evaluation... that was the reason behind... but of course i can build my own ReadOnlyTree implementation that keeps track of the path... angela On 1/31/13 11:41 AM, Michael Dürig wrote: > > Hi, > > Preemptively building and caching the path here is worrisome since this > will blow up memory usage quite a bit. This is the reason the path was > only build on access (i.e. getPath()) in the original design and in > TreeImpl. > > Michael > > > On 30.1.13 17:33, angela@apache.org wrote: >> + /** >> + * Path of this tree >> + */ >> + private final String path; >> + >> + /** >> + * Underlying node state >> + */ >> private final NodeState state; >> >> - public ReadOnlyTree(NodeState root) { >> - this(null, "", root); >> + public ReadOnlyTree(NodeState rootState) { >> + this(null, "", rootState); >> } >> >> - public ReadOnlyTree(ReadOnlyTree parent, String name, NodeState state) { >> + public ReadOnlyTree(@Nullable ReadOnlyTree parent, @Nonnull String name, @Nonnull NodeState state) { >> this.parent = parent; >> this.name = checkNotNull(name); >> + this.path = buildPath(parent, name); >> this.state = checkNotNull(state); >> checkArgument(!name.isEmpty() || parent == null); >> } >> >> + private static String buildPath(ReadOnlyTree parent, String name) { >> + if (parent == null) { >> + return "/"; >> + } else if (parent.isRoot()) { >> + return parent.path + name; >> + } else { >> + StringBuilder sb = new StringBuilder(); >> + sb.append(parent.path).append('/').append(name); >> + return sb.toString(); >> + } >> + }