Alright, well I finally figured this out. Here's my successful
configuration:
<nodeType name="galaxy:workspace"
isMixin="false"
hasOrderableChildNodes="false"
primaryItemName=""
sameNameSiblings="false">
<propertyDefinition name="*" requiredType="undefined"
onParentVersion="COPY" sameNameSiblings="false" />
<childNodeDefinition name="*" defaultPrimaryType="nt:unstructured"
onParentVersion="COPY" sameNameSiblings="false" />
</nodeType>
<nodeType name="galaxy:artifact"
isMixin="false"
hasOrderableChildNodes="false"
primaryItemName=""
sameNameSiblings="false">
<propertyDefinition name="*" requiredType="undefined"
onParentVersion="COPY" sameNameSiblings="false" />
<childNodeDefinition name="*" defaultPrimaryType="nt:unstructured"
onParentVersion="COPY" sameNameSiblings="true" />
</nodeType>
Once again, it'd be great if things like residual item definitions and
what not were documented somewhere. Along with a schema for the XML
file. I fooled around with the CND notation as well, but found it a
little confusing and short on real examples (well so is the XML for that
matter). I think I could probably figure it out now that I have a
working XML version, but not much point any more. :-)
Thanks for the help Peter,
- Dan
Peeter Piegaze wrote:
If you need to be able to add arbitrary child nodes and properties to
nodes of type galaxy:workspace then you can include residual child
item defs directly within the definition of galaxy:workspace as
opposed to inheriting them.
If you know what a galaxy:workspace is allowed to contain then just
add child item defs for those particular items or inherit from some
non-unstructured standard type.
If the problem is, as I suspect, the behavior of Jackrabbit wrt
inheritence then doing any of these should fix it.
On 2/20/08, Dan Diephouse <[EMAIL PROTECTED]> wrote:
Thinking about this some more: so is the workaround to not have a
superType and then define all my properties/child node types?
- Dan
Dan Diephouse wrote:
> Any suggested workarounds? If I create a different parent type which
> artifact/workspace inherit from, would that help?
>
> - Dan
>
> Peeter Piegaze wrote:
>> Hi Dan,
>>
>> The trouble is that you are using type nt:unstructured as the
>> superclass of type galaxy:workspace. This adds the following child
>> node definition to the effective (as opposed to declared) definition
>> of galaxy:workspace:
>>
>> <childNodeDefinition
>> name="*"
>> onParentVersion="VERSION"
>> sameNameSiblings="true" />
>>
>> This definition allows any number of child nodes of any type with any
>> name, each any number of times. This is called a residual definition
>> in JSR-170-speak.
>>
>> The interaction between two conflicting item defintions in a node type
>> that arise due to subclassing is not well defined in JSR 170. As a
>> result implementations are free to apply whatever resolution mechanism
>> they see fit. In the case of Jackrabbit when you add a child node
>> called "galaxy:artifact" to your galaxy:workspace node the first time
>> it matches your original child node defintion:
>>
>> <childNodeDefinition
>> name="galaxy:artifact"
>> onParentVersion="COPY"
>> sameNameSiblings="false" />
>>
>> when you then add a second it matches the residual definition.
>>
>> I admit that this behavior is weird. It will be addressed in JCR 2.0 :-)
>>
>> Cheers,
>> Peeter
>>
>>
>> On 2/20/08, Dan Diephouse <[EMAIL PROTECTED]> wrote:
>>
>>> Sorry, I didn't include the whole thing, but I changed it so it does:
>>>
>>> <nodeType name="galaxy:workspace"
>>> isMixin="false"
>>> hasOrderableChildNodes="false"
>>> primaryItemName=""
>>> sameNameSiblings="false">
>>>
>>> <supertypes>
>>> <supertype>nt:unstructured</supertype>
>>> </supertypes>
>>> <childNodeDefinition name="galaxy:artifact" onParentVersion="COPY"
>>> sameNameSiblings="false" />
>>> </nodeType>
>>>
>>> <nodeType name="galaxy:artifact"
>>> isMixin="false"
>>> hasOrderableChildNodes="false"
>>> primaryItemName=""
>>> sameNameSiblings="false"
>>> allowSameNameSiblings="false">
>>>
>>> <supertypes>
>>> <supertype>nt:unstructured</supertype>
>>> </supertypes>
>>>
>>> </nodeType>
>>>
>>> - Dan
>>>
>>>
>>> Tobias Bocanegra wrote:
>>> as i said, the workspace nodetype must have SNS=false
>>> regards, toby
>>>
>>> On 2/20/08, Dan Diephouse <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> Hmmm... This doesn't seem to work either:
>>>
>>> <nodeType name="galaxy:artifact"
>>> isMixin="false"
>>> hasOrderableChildNodes="false"
>>> primaryItemName=""
>>> sameNameSiblings="false">
>>>
>>> <supertypes>
>>> <supertype>nt:unstructured</supertype>
>>> </supertypes>
>>>
>>> </nodeType>
>>>
>>> I'm guessing I'm doing something stupid. :-)
>>> - Dan
>>>
>>>
>>> Tobias Bocanegra wrote:
>>> hi,
>>> the SNS works on the defining node, not on the child. i.e. your
>>> galaxy:workspace must have the SNS=false, not the artifact.
>>>
>>> regards, toby
>>>
>>> On 2/20/08, Dan Diephouse <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> I'm trying to disallow same name siblings. We have the concept of
>>> workspaces which hold artifacts and other workspaces. Very similar
>>> to a
>>> file system (we chose not to go with the built in file node types
>>> though
>>> as they didn't fit our application). We've defined our node types like
>>> this:
>>>
>>> <nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
>>> xmlns:jcr="http://www.jcp.org/jcr/1.0"
>>> xmlns:galaxy="http://galaxy.mule.org"
>>> xmlns:mix="http://www.jcp.org/jcr/mix/1.0">
>>>
>>> <nodeType name="galaxy:workspace"
>>> isMixin="false"
>>> hasOrderableChildNodes="false"
>>> primaryItemName="">
>>>
>>> <supertypes>
>>> <supertype>nt:unstructured</supertype>
>>> </supertypes>
>>> <childNodeDefinition name="galaxy:artifact" onParentVersion="COPY"
>>> sameNameSiblings="false" />
>>> </nodeType>
>>>
>>> </nodeTypes>
>>>
>>> When I dump the type registry I get this:
>>>
>>> {http://galaxy.mule.org}workspace
>>> Supertypes
>>> {http://www.jcp.org/jcr/nt/1.0}unstructured
>>> Mixin false
>>> OrderableChildNodes false
>>> PrimaryItemName <null>
>>> NodeDefinition (declared in {http://galaxy.mule.org}workspace)
>>> id=801081333
>>> Name {http://galaxy.mule.org}artifact
>>> RequiredPrimaryType {http://www.jcp.org/jcr/nt/1.0}base
>>> AutoCreated false
>>> Mandatory false
>>> OnVersion COPY
>>> Protected false
>>> AllowsSameNameSiblings false
>>>
>>> But I'm still able to add multiple galaxy:artifact nodes with the same
>>> name as you see from this repository dump:
>>>
>>> /workspaces/Default Workspace
>>> /workspaces/Default Workspace/updated = 2008-02-20T11:17:21.920-08:00
>>> /workspaces/Default Workspace/jcr:primaryType = galaxy:workspace
>>> /workspaces/Default Workspace/jcr:mixinTypes = mix:referenceable
>>> /workspaces/Default Workspace/jcr:uuid =
>>> de38a3e0-9bc1-4406-9618-5d9ccde3883d
>>> /workspaces/Default Workspace/name = Default Workspace
>>> /workspaces/Default Workspace/hello_world.wsdl
>>> /workspaces/Default Workspace/hello_world.wsdl/lifecycle =
>>> Default
>>> /workspaces/Default Workspace/hello_world.wsdl/updated =
>>> 2008-02-20T11:17:23.434-08:00
>>> /workspaces/Default Workspace/hello_world.wsdl/phase =
>>> Created
>>> /workspaces/Default Workspace/hello_world.wsdl/contentType
>>> =
>>> application/wsdl+xml
>>> /workspaces/Default
>>> Workspace/hello_world.wsdl/jcr:primaryType =
>>> galaxy:artifact
>>> /workspaces/Default
>>> Workspace/hello_world.wsdl/jcr:mixinTypes =
>>> mix:referenceable
>>> /workspaces/Default Workspace/hello_world.wsdl/jcr:uuid =
>>> 492fbb9f-ee45-4910-8907-8db107895bad
>>> /workspaces/Default Workspace/hello_world.wsdl/name = hello_world.wsdl
>>> /workspaces/Default
>>> Workspace/hello_world.wsdl/documentType =
>>> {http://schemas.xmlsoap.org/wsdl/}definitions
>>> /workspaces/Default Workspace/hello_world.wsdl[2]
>>> /workspaces/Default
>>> Workspace/hello_world.wsdl[2]/lifecycle = Default
>>> /workspaces/Default Workspace/hello_world.wsdl[2]/updated
>>> =
>>> 2008-02-20T11:17:24.130-08:00
>>> /workspaces/Default Workspace/hello_world.wsdl[2]/phase =
>>> Created
>>> /workspaces/Default
>>> Workspace/hello_world.wsdl[2]/contentType =
>>> application/wsdl+xml
>>> /workspaces/Default
>>> Workspace/hello_world.wsdl[2]/jcr:primaryType =
>>> galaxy:artifact
>>> /workspaces/Default
>>> Workspace/hello_world.wsdl[2]/jcr:mixinTypes =
>>> mix:referenceable
>>> /workspaces/Default Workspace/hello_world.wsdl[2]/jcr:uuid
>>> =
>>> e21883eb-4f98-46b4-8868-1ce80355a1a9
>>> /workspaces/Default Workspace/hello_world.wsdl[2]/name =
>>> hello_world.wsdl
>>> /workspaces/Default
>>> Workspace/hello_world.wsdl[2]/documentType =
>>> {http://schemas.xmlsoap.org/wsdl/}definitions
>>>
>>> As you can see, I have a parent node which is a galaxy:workspace and
>>> multiple nodes with the same name :(. Any ideas what in the world I'm
>>> doing wrong?
>>>
>>> Also, as this is one of the best practices for JCR integration,
>>> it'd be
>>> great if the first hops guide detailed how to do this. Am I missing
>>> some
>>> obvious piece of documentation which explains all this?
>>>
>>> Thanks
>>> - Dan
>>>
>>>
>>> --
>>> Dan Diephouse
>>> MuleSource
>>> http://mulesource.com | http://netzooid.com/blog
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Dan Diephouse
>>> MuleSource
>>> http://mulesource.com | http://netzooid.com/blog
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Dan Diephouse
>>> MuleSource
>>> http://mulesource.com | http://netzooid.com/blog
>>>
>>>
>
>
--
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog
--
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog