Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3FFD310E02 for ; Mon, 12 Aug 2013 20:37:11 +0000 (UTC) Received: (qmail 82553 invoked by uid 500); 12 Aug 2013 20:37:11 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 82457 invoked by uid 500); 12 Aug 2013 20:37:10 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 82450 invoked by uid 99); 12 Aug 2013 20:37:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Aug 2013 20:37:10 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of elecharny@gmail.com designates 209.85.212.180 as permitted sender) Received: from [209.85.212.180] (HELO mail-wi0-f180.google.com) (209.85.212.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Aug 2013 20:37:05 +0000 Received: by mail-wi0-f180.google.com with SMTP id f14so2207649wiw.13 for ; Mon, 12 Aug 2013 13:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=nEi4lTVj591p/QT5nYjwXY0tIb8eIS6ACm63moK8AeA=; b=PeElTVVgDYhzhe1ynubSM5wQuq6CN2RsJ3zsiLgUGCxiiHO82skojhWAUIviY0LPDe Fj1AAJYbgAoZeRQhgrAnnVJgqRU8YGlIXgoBgwxnBhhtWC17pI3abCi9THQJlKKRV8/2 dJgSbmSM54HLVRKGXI40geQhIzg5I0uclFG+IkXDyXK6Z6RSGtLpzIDPEckeygPh4dD0 SU1VfUvme9JO2HDOvPChnrbCDZECVEKvz8SLk3h7SBY9gJVAN9AH0+HF0RqvZnE15N9y wOVEPzDGgP0vaT8kJ6YE7NwRbrh7Jbov94CDCatj9zklGysYuZrtQZrf8h1xPyshcCCf rfZw== X-Received: by 10.180.13.210 with SMTP id j18mr380853wic.51.1376339803663; Mon, 12 Aug 2013 13:36:43 -0700 (PDT) Received: from Emmanuels-MacBook-Pro.local ([78.251.97.201]) by mx.google.com with ESMTPSA id li9sm18514836wic.2.2013.08.12.13.36.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 13:36:42 -0700 (PDT) Message-ID: <52094759.8060709@gmail.com> Date: Mon, 12 Aug 2013 22:36:41 +0200 From: =?UTF-8?B?RW1tYW51ZWwgTMOpY2hhcm55?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Apache Directory Developers List Subject: [Mavibot] Generic usage X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Hi guys, we have some kind of bad usage of generics in Mavibot, and I'm trying to get it fixed. The pb lies in the way we handle the data we store in a BTree. A BTree has pages (Nodes and Leaves), and those pages hold elements which can be other pages, or values. Values can themselves be simple or multiple (and we could consider that a simple value is just a specific cas of a multiple value). We also store the pages and values either in memory or on disk, so we may have references to physical storage in the second case. This is not quite simple to mimic using generics. Let's sumup all those things : A Node stores Pages (either Nodes or Leaves), which may be dereferenced if they are not in memory. A Leaf stores Values which may be simpe or multiple, and themselves could be dereferenced if they are not in memory. Multiple values are stored in a BTree, where V is the value's type (in fact we *never* store the value, we just store the key. At this point, we can define the generic we want to use and the classes to implement those constraints ValueHolder : ------------- Defines a value stored in memory. MultipleValueHolder : --------------------- o Defines a value where V is a multiple value stored in a BTree : MultipleValueHolder extends ValueHolder> o Stored in memory ReferenceValueHolder : ---------------------- This is a simple value stored on disk. We may have to read it from the disk, but t may be present in memory too. ReferenceValueHolder extends ValueHolder ReferenceMultipleValueHolder : ------------------------------ o Defines a value where V is a multiple value stored in a BTree : ReferenceMultipleValueHolder extends ReferenceValueHolder> o Stored in disk, so may be dereferenced if it's not present in memory Page : ------ A Page can be either a Node or a Leaf. Page Node : ------ Stores references to other pages (Node or Leaf) Node extends Page Leaf : ------ Stores references to values (either simple of multiple, either in memory or dereferenced) Leaf extends Page ReferencePage : --------------- When a page is not present in memory, it can be loaded from disk. ReferencePage extends Page ReferenceNode : --------------- A Node which is stored on disk ReferenceNode extends Node ReferenceLeaf : --------------- A Leaf which is stored on disk ReferenceLeaf extends Leaf Now, we never know in advance if we will store references or memory values into a leaf or a node, at least when we create a BTree. The BTree will use references whan it's managed. At this point, I'm a bit stuck and I'm facing some issue when dealing with multipleValues, and get a Classcast expression when trying to add a new value. I'm working on it though... -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com