jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jaka Jaksic" <jaka.jak...@telemach.net>
Subject RE: Primary item inheritance
Date Fri, 21 Jul 2006 02:37:50 GMT
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)
            NodeTypeDef ntd = new NodeTypeDef();
            ntd.setName(new QName("", "myResource"));
            ntd.setSupertypes(new QName[]{QName.NT_RESOURCE});
            List ntDefs = new ArrayList();

            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.

View raw message