jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: Session Importer: Question on NodeType matching
Date Mon, 13 Nov 2006 10:29:39 GMT
On 11/10/06, Kar, Swayambhuba <swayambhuba.kar@hp.com> wrote:
> Guys,
>
> Marking the super type of all the generated custom types to nt:base is
> hard coded in the schema converter class and hence the behavior.

if you don't specify a super type for a non-mixin type, the implementation
defaults to nt:base since every non-mixin type must directly or indirectly
extend nt:base.

you have to explicitly specify your super type(s), otherwise nt:base
will be assumed.

cheers
stefan

>
> Thanks,
> -Swayam
>
> -----Original Message-----
> From: Kar, Swayambhuba
> Sent: Friday, November 10, 2006 11:18 AM
> To: users@jackrabbit.apache.org
> Subject: RE: Session Importer: Question on NodeType matching
>
> Hi Dan/Stefen:
>
> I have a similar kind of requirement. Only exception being, I create the
> custom node types from a .xsd schema definition. However, after the node
> types have been crated, the super type for all the node types are set to
> nt:base. How do I tweak the .xsd to create correct node type hierarchy?
>
> Thanks!
>
> -Swayam
>
> -----Original Message-----
> From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
> Sent: Thursday, November 09, 2006 6:23 AM
> To: users@jackrabbit.apache.org
> Subject: Re: Session Importer: Question on NodeType matching
>
> On 11/9/06, Dan Connelly <dsconnelly@adelphia.net> wrote:
> > Stefan Guggisberg wrote:
> >
> > > On 11/8/06, Dan Connelly <dsconnelly@adelphia.net> wrote:
> > >
> > >> All:
> > >>
> > >> This is a follow-up on my questions posted per "ThirdHop for
> structured
> > >> node types".   I have got most of what I want working, but not all.
> > >>
> > >> One remaining problem is that a certain child-node stays
> unstructured
> > >> although I have provided a structured node type for it.   It is
> > >> difficult to diagnose why I am not getting jcr:primaryType of
> > >> "teneo:proxy" for the "author" child node.
> > >>
> > >> Details below.   The "library:Book" node is imported (correctly) as
> a
> > >> structured type.   But its child "author" is not.   It should be a
> > >> "teneo:proxy" primary node type.
> > >>
> > >> Could there be a problem here because the"author" element is in the
> > >> un-named namespace, not in the "library" namespace of its parent?
> > >
> > >
> > > no. the problem is the following:
> > >
> > > [...]
> > > <library:Book jcr:primaryType="teneo:eobject"
> > > [...]
> > >
> > > i.e. library:Book is of type teneo:eobject which extends
> > > nt:unstructured. that's why "author" ends up being of type
> > > nt:unstructured.
> > >
> > > i guess library:Book should be of type library:Book.
> > >
> > > btw: the naming of node and type is somewhat confusing...
> > >
> > > cheers
> > > stefan
> > >
> > <snip>
> >
> ------------------------------------------------------------------------
> --------------------------------
> >
> > Stefan:
> >
> > Agreed, the jcr:primaryType attribute on element library:Book gets set
> > incorrectly.
> >
> > How can I fix this in my node type specification?
> >
> > (I assume that I can alter this behavior through the node type defs,
> > that this is not a bug in Jackrabbit.)
> >
> > I made some changes in my custom_nodetype.xml spec trying to make this
> > change:
> >
> >     * I set isMixin="true" for teneo:eobject.
>
> why do you think that this would help?
>
> >     * I set explicit requiredPrimaryType in the childNode defs of
> >       teneo:content.
> >
> > However, the output XML is unchanged.   The element library:Book still
> > has attribute jcr:primaryType="teneo:eobject", which is incorrect.
>
> i quickly ran a test with your node type definitions and your
> xml data, here's my test code:
>
>             root.addNode("tmp", "teneo:content");
>             root.save();
>
>             FileInputStream fis = new
> FileInputStream("d:/temp/xml/book.xml");
>             wsp.importXML("/tmp", fis,
> ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
>             fis.close();
>             dumpTree(root.getNode("tmp"), System.out);
>
> here's the console output:
>
> [node]   /tmp
>         [prop]   jcr:primaryType teneo:content
>         [node]   /library:Book
>                 [prop]   pages 500
>                 [prop]   jcr:primaryType library:Book
>                 [prop]   category ScienceFiction
>                 [prop]   jcr:uuid 41a71535-3749-4e36-9981-47e8c6bcb4da
>                 [prop]   title The Hobbit
>                 [node]   /author
>                         [prop]   href
> jcr://proxies.test.writer/#/Content.2
>                         [prop]   jcr:primaryType teneo:proxy
>
> i guess everything's fine.
>
> i suggest you redo your test with a clean repository.
>
> cheers
> stefan
> >
> > I have listed the relevant portion of my new custom_nodetype.xml
> below.
> >
> >        Thanks,    Dan
> >
> >  <nodeType name="teneo:eobject" isMixin="true">
> >     <supertypes>
> >       <supertype>mix:referenceable</supertype>
> >       <supertype>nt:unstructured</supertype>
> >     </supertypes>
> >   </nodeType>
> >
> >     <nodeType name="teneo:proxy" isMixin="false" >
> >      <supertypes>
> >       <supertype>nt:base</supertype>
> >       </supertypes>
> >     <propertyDefinition name="href" requiredType="String"
> > autoCreated="false" mandatory="true" onParentVersion="COPY"
> > protected="false" multiple="false" />
> >     </nodeType>
> >
> >     <nodeType name="library:Book" isMixin="false"
> > hasOrderableChildNodes="false" >
> >         <supertypes>
> >             <supertype>teneo:eobject</supertype>
> >         </supertypes>
> >         <propertyDefinition name="title" requiredType="String"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <propertyDefinition name="pages" requiredType="Long"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <propertyDefinition name="category" requiredType="String"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <childNodeDefinition name="author"
> > defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="true"
> > onParentVersion="COPY" protected="false" sameNameSiblings="false" >
> >           <requiredPrimaryTypes>
> >             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
> >           </requiredPrimaryTypes>
> >         </childNodeDefinition>
> >     </nodeType>
> >
> >     <nodeType name="library:Library" isMixin="false"
> > hasOrderableChildNodes="false">
> >         <supertypes>
> >             <supertype>teneo:eobject</supertype>
> >         </supertypes>
> >         <propertyDefinition name="name" requiredType="String"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <childNodeDefinition name="writers"
> > defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> > onParentVersion="COPY" protected="false" sameNameSiblings="true" >
> >           <requiredPrimaryTypes>
> >             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
> >           </requiredPrimaryTypes>
> >           </childNodeDefinition>
> >         <childNodeDefinition name="books"
> > defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> > onParentVersion="COPY" protected="false" sameNameSiblings="true" >
> >           <requiredPrimaryTypes>
> >             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
> >           </requiredPrimaryTypes>
> >           </childNodeDefinition>
> >     </nodeType>
> >
> >     <nodeType name="library:Writer" isMixin="false"
> > hasOrderableChildNodes="false" >
> >         <supertypes>
> >             <supertype>teneo:eobject</supertype>
> >         </supertypes>
> >         <propertyDefinition name="name" requiredType="String"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <childNodeDefinition name="books"
> > defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> > onParentVersion="COPY" protected="false" sameNameSiblings="true" >
> >           <requiredPrimaryTypes>
> >             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
> >           </requiredPrimaryTypes>
> >           </childNodeDefinition>
> >     </nodeType>
> >
> >     <nodeType name="teneo:content" isMixin="false" >
> >      <supertypes>
> >       <supertype>nt:unstructured</supertype>
> >       </supertypes>
> >       <childNodeDefinition name="library:Library"
> > defaultPrimaryType="library:Library" autoCreated="false"
> > mandatory="false" onParentVersion="COPY" protected="false"
> > sameNameSiblings="false" >
> >         <requiredPrimaryTypes>
> >             <requiredPrimaryType>library:Library</requiredPrimaryType>
> >         </requiredPrimaryTypes>
> >       </childNodeDefinition>
> >     <childNodeDefinition name="library:Book"
> > defaultPrimaryType="library:Book" autoCreated="false"
> mandatory="false"
> > onParentVersion="COPY" protected="false" sameNameSiblings="true" >
> >         <requiredPrimaryTypes>
> >             <requiredPrimaryType>library:Book</requiredPrimaryType>
> >         </requiredPrimaryTypes>
> >     </childNodeDefinition>
> >     <childNodeDefinition name="library:Writer"
> > defaultPrimaryType="library:Writer" autoCreated="false"
> > mandatory="false" onParentVersion="COPY" protected="false"
> > sameNameSiblings="true" >
> >         <requiredPrimaryTypes>
> >             <requiredPrimaryType>library:Writer</requiredPrimaryType>
> >         </requiredPrimaryTypes>
> >       </childNodeDefinition>
> >     </nodeType>
> >
> >
> >
>

Mime
View raw message