Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 22191 invoked from network); 21 Jul 2006 02:38:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jul 2006 02:38:48 -0000 Received: (qmail 12770 invoked by uid 500); 21 Jul 2006 02:38:45 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 12733 invoked by uid 500); 21 Jul 2006 02:38:45 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 12724 invoked by uid 99); 21 Jul 2006 02:38:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jul 2006 19:38:45 -0700 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [193.2.1.77] (HELO avs4.arnes.si) (193.2.1.77) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jul 2006 19:38:43 -0700 Received: from localhost (avs4.arnes.si [193.2.1.77]) by avs4.arnes.si (Postfix) with ESMTP id 568002C352D for ; Fri, 21 Jul 2006 04:38:19 +0200 (CEST) Received: from avs4.arnes.si ([193.2.1.77]) by localhost (avs4.arnes.si [193.2.1.77]) (amavisd-new, port 10024) with ESMTP id 65819-02 for ; Fri, 21 Jul 2006 04:38:19 +0200 (CEST) Received: from TIHOMIR (clj38-109.dial-up.arnes.si [153.5.66.109]) by avs4.arnes.si (Postfix) with ESMTP id 0DA2E2C34C8 for ; Fri, 21 Jul 2006 04:38:13 +0200 (CEST) From: "Jaka Jaksic" To: Subject: RE: Primary item inheritance Date: Fri, 21 Jul 2006 04:37:50 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 In-Reply-To: <90a8d1c00607200658m398c7354q96742c919167db03@mail.gmail.com> Thread-Index: AcasMFmzgCFeFEzmTqewLOftJjbSKwANbqGQ Message-Id: <20060721023813.0DA2E2C34C8@avs4.arnes.si> X-Virus-Scanned: by amavisd-new at arnes.si X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Stefan! Yes, setting the primary item directly in the node type definition works fine (in fact, that's the way I'm doing it now). But an error occurs if you try to define a subtype's primary item in a CND file and import it with CompactNodeTypeDefReader. A CND like the following produces "ambigous property definition" exception (EffectiveNodeType.internalMerge(), line 1051): ... [foo:myResource] > nt:resource - jcr:data (binary) mandatory ... It would be nice if it was possible to define node types like this entirely in CND, not having to add the primary items manually. -----Original Message----- From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] Sent: Thursday, July 20, 2006 3:58 PM To: dev@jackrabbit.apache.org Subject: Re: Primary item inheritance hi jaka On 7/20/06, Jaka Jaksic wrote: > We define our repository structure using a CND file. In it we override > several built-in node types, namely nt:file and nt:resource. The > problem is that the subtypes don't inherit the primary item > definition, so the resulting types have no primary item. And we can't > simply redefine the primary item property because of an "ambigous definition" error. strange, i quickly tested this with the following code snippet: NodeTypeRegistry ntReg = ((NodeTypeManagerImpl) wsp.getNodeTypeManager()).getNodeTypeRegistry(); NodeTypeDef ntd = new NodeTypeDef(); ntd.setName(new QName("", "myResource")); ntd.setSupertypes(new QName[]{QName.NT_RESOURCE}); ntd.setPrimaryItemName(QName.JCR_MIMETYPE); List ntDefs = new ArrayList(); ntDefs.add(ntd); ntReg.registerNodeTypes(ntDefs); Node n = root.addNode("foo", "myResource"); n.setProperty("jcr:mimeType", "application/octet-stream"); Item pi = n.getPrimaryItem(); // -> returns /foo/jcr/mimeType i.e. i was able to register and use a subtype of nt:resource that specifies a custom primary item (jcr:mimeType). please provide a simple test case that demonstrates your issue.