hi, I tried what Justin said.
I deleted my repository, it was jsut for tests. I removed the registred node type and redefine the node type adding the mixin: <ctgt = 'http://www.yunit.pt/contingut/ctn/1.0'> [ctgt:nosamenamesiblings] orderable *mixin* - * (UNDEFINED) multiple - * (UNDEFINED) + * (nt:base) = ctgt:nosamenamesiblings VERSION then I registered the node. the problem now is that I can't create a node: javax.jcr.nodetype.ConstraintViolationException: Unable to add a node with a mixin node type: ctgt:nosamenamesiblings at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1471) at org.apache.jackrabbit.core.NodeImpl.addNodeWithUuid(NodeImpl.java:2087) at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1992) at I looked at the code: if (nodeTypeName != null) { nt = session.getNodeTypeManager().getNodeType(nodeTypeName); if (nt.isMixin()) { throw new ConstraintViolationException( "Unable to add a node with a mixin node type: " + session.getJCRName(nodeTypeName)); } [...] by that I can only assume that you can not create a node with a custom node type that is mixin. is my assumptation correct? can you please help me. thanks in advance. best regards, bruno coelho On Tue, Jun 22, 2010 at 20:46, Justin Edelson <[email protected]>wrote: > On 6/22/10 1:44 PM, bruno coelho wrote: > > hi all, > > > > I'm developing a way of doing backups of our JCR repository built with > > Jackrabbit. > > > > I started by creating a node "/bruno" and used > > *session.exportDocumentView("/", outputStream, skipBinary, > noRecurse);* > > to export all the content to a xml file. > > > > then I use > > *session.importXML("/", inputStream, > > ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);* > > to import the xml file: > > > > <?xml version="1.0" encoding="UTF-8"?> > > <jcr:root jcr:primaryType="rep:root" xmlns:fn=" > > http://www.w3.org/2005/xpath-functions" xmlns:fn_old=" > > http://www.w3.org/2004/10/xpath-functions" xmlns:xs=" > > http://www.w3.org/2001/XMLSchema" xmlns:jcr="http://www.jcp.org/jcr/1.0" > > xmlns:ctgt="http://www.yunit.pt/contingut/ctn/1.0" xmlns:mix=" > > http://www.jcp.org/jcr/mix/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" > > xmlns:rep="internal" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"> > > <jcr:system jcr:primaryType="rep:system"> > > <jcr:versionStorage jcr:primaryType="rep:versionStorage"/> > > <jcr:activities jcr:primaryType="rep:Activities"/> > > <jcr:nodeTypes jcr:primaryType="rep:nodeTypes"> > > [...] > > <ctgt:nosamenamesiblings jcr:primaryType="nt:nodeType" > > jcr:hasOrderableChildNodes="true" jcr:isMixin="false" > > jcr:nodeTypeName="ctgt:nosamenamesiblings"><jcr:propertyDefinition > > jcr:primaryType="nt:propertyDefinition" jcr:autoCreated="false" > > jcr:mandatory="false" jcr:multiple="true" jcr:onParentVersion="COPY" > > jcr:protected="false" > jcr:requiredType="UNDEFINED"/><jcr:propertyDefinition > > jcr:primaryType="nt:propertyDefinition" jcr:autoCreated="false" > > jcr:mandatory="false" jcr:multiple="false" jcr:onParentVersion="COPY" > > jcr:protected="false" > jcr:requiredType="UNDEFINED"/><jcr:childNodeDefinition > > jcr:primaryType="nt:childNodeDefinition" jcr:autoCreated="false" > > jcr:defaultPrimaryType="ctgt:nosamenamesiblings" jcr:mandatory="false" > > jcr:onParentVersion="VERSION" jcr:protected="false" > > jcr:sameNameSiblings="false"/></ctgt:nosamenamesiblings> > > [...] > > </jcr:nodeTypes> > > </jcr:system> > > <bruno jcr:primaryType="ctgt:nosamenamesiblings" > > creationDate="1277226878544" deleted="0" lastModifiedDate="1277226878544" > > name="/bruno" objectFQN="yunit.contingut.content.dataObjects.Folder" > > status="WORK_IN_PROGRESS"/> > > </jcr:root> > > > > my problem is that the import creates another node instead of replacing > the > > existing one. > > it creates a node in /jcr:root/bruno and should replace the node /bruno. > > > > from the specification the importer uses the UUID to check if the node > > exists in the target repository > > but I open the xml file there's no UUID in the attributes of the nodes. > > is this correct? if so how can the importer know if a node already exist > or > > not? > You need to use referenceable nodes. Simply adding the mixin > mix:referenceable to the nodes you want to replace or add the mixin as a > parent node type at the time of node type creation (last I checked JR > doesn't allow for mixins to be added to a node type once the type has > been created) should do the trick. However, I would suggest using system > view especially when dealing with unstructured data (unless I'm missing > something ctgt:nosamenamesibilings is basically nt:unstructured without > support for SNS). > > Justin > > > > > am I doing something wrong? > > > > thanks in advance. > > > > > > best regards, > > > > bruno coelho > > > >
