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 C29DC9EC5 for ; Fri, 13 Apr 2012 13:41:53 +0000 (UTC) Received: (qmail 91478 invoked by uid 500); 13 Apr 2012 13:41:53 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 91421 invoked by uid 500); 13 Apr 2012 13:41:53 -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 91413 invoked by uid 99); 13 Apr 2012 13:41:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 13:41:53 +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 (athena.apache.org: domain of mueller@adobe.com designates 64.18.1.25 as permitted sender) Received: from [64.18.1.25] (HELO exprod6og110.obsmtp.com) (64.18.1.25) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 13:41:46 +0000 Received: from outbound-smtp-2.corp.adobe.com ([193.104.215.16]) by exprod6ob110.postini.com ([64.18.5.12]) with SMTP ID DSNKT4gtBccvwhF1DQOgoAg9LxiMVDbY519w@postini.com; Fri, 13 Apr 2012 06:41:26 PDT Received: from inner-relay-1.corp.adobe.com (inner-relay-1.corp.adobe.com [153.32.1.51]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id q3DDfNaW004467 for ; Fri, 13 Apr 2012 06:41:24 -0700 (PDT) Received: from nahub02.corp.adobe.com (nahub02.corp.adobe.com [10.8.189.98]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id q3DDfDvv009739 for ; Fri, 13 Apr 2012 06:41:23 -0700 (PDT) Received: from eurcas01.eur.adobe.com (10.128.4.27) by nahub02.corp.adobe.com (10.8.189.98) with Microsoft SMTP Server (TLS) id 8.3.192.1; Fri, 13 Apr 2012 06:41:20 -0700 Received: from eurmbx01.eur.adobe.com ([10.128.4.32]) by eurcas01.eur.adobe.com ([10.128.4.27]) with mapi; Fri, 13 Apr 2012 14:40:51 +0100 From: Thomas Mueller To: "oak-dev@jackrabbit.apache.org" Date: Fri, 13 Apr 2012 14:40:50 +0100 Subject: Re: Encoding of JCR values in json Thread-Topic: Encoding of JCR values in json Thread-Index: Ac0Zewoxgq+b2DrHRO6t0mBTejiolg== Message-ID: In-Reply-To: <4F87F795.8050507@apache.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.14.0.111121 acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Hi, >>An alternative might be: numbers with an "e" are double ("10e0"), numbers >> with a dot are decimal ("10.0"), all other numbers are long ("10"). But >> that would require the MicroKernel stores the *exact* JSON >>representation. >> I don't think that's a good idea either. > >The underlying storage mechanism must not be of concern to the user of >the Microkernel API. The Microkernel API uses JSON to transport values. >So the Microkernel implementation is in charge of serializing these into >a format suitable for the underlying storage mechanism. Even if I put a >number with 10 Million digits into a JSON property. I think we should not rely on the MicroKernel implementation to support unlimited precision numbers. For example MongoDB only supports IEEE 754 floating point numbers, as defined by the BSON spec: http://en.wikipedia.org/wiki/BSON - so we can't store BigDecimal as a JSON number, because we would risk losing precision. Also, I would not rely on the MicroKernel implementation to preserve the exact JSON representation. If we store the number as 100.00, we should not rely on getting 100.00 back. We might as well get 100.0 or 100 back. We should document this in the MicroKernel specification. The JSON specification itself doesn't define such details. >How could the GC possible know whether a >binary is still in use or not? >String blobId =3D mk.write(inStream); > >and write the returned blobId on a piece of paper. According to the >current Microkernel contract I could come back after a couple of years >and would still be able to retrieve that blob. Yes, we need to narrow the contract. Regards, Thomas