You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by "Furst, Carl" <Ca...@mlb.com> on 2011/06/17 22:25:36 UTC
CndImporter
Does anyone know if custom nodetype can be changed once created? If I change
my node type definition CND file, how do I apply it to a repository?
Thanks,
Carl Furst
Re: CndImporter
Posted by Alexander Klimetschek <ak...@adobe.com>.
On 20.06.11 17:53, "Furst, Carl" <Ca...@mlb.com> wrote:
>I too noticed that I would have to manually update the custom_nodetype.xml
>in the workspace directory. It would seem there's nothing yet to
>manipulate
>the type registry programmatically..
Yes, there is, right in JCR 2.0:
http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/nodetype/NodeTyp
eManager.html
One should not modify custom_nodetype.xml nowadays.
Here is the CND importer code that shows how to use the API (from
jackrabbit-jcr-commons):
http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/ma
in/java/org/apache/jackrabbit/commons/cnd/CndImporter.java?view=markup
You can use this class to read node types from a CND file:
http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/ma
in/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefReader.java?vie
w=markup
Regards,
Alex
--
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel
RE: CndImporter
Posted by "Furst, Carl" <Ca...@mlb.com>.
David,
Thanks for the reply.
I too noticed that I would have to manually update the custom_nodetype.xml
in the workspace directory. It would seem there's nothing yet to manipulate
the type registry programmatically..
This, however, is probably right, because if you have a repository that has
already been created and has content based on a pre-existing custom node
type, how do you adapt the content to node type changes? The type and the
content are tightly coupled (in most cases). Too tight, perhaps, to allow
for a programmatic change to custom node types to be allowed.
Perhaps, the only programmatic solution is then to move to a new workspace,
with new types, import and then delete the old one.
Peace,
Carl Furst
CMS Developer
MLB Advanced Media
o/~ What a difference a byte makes... o/~
-----Original Message-----
From: David Buchmann [mailto:david.buchmann@liip.ch]
Sent: Saturday, June 18, 2011 11:52 AM
To: users@jackrabbit.apache.org
Subject: Re: CndImporter
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hi,
you can update the type definition, but only adding new stuff, never
removing (or renaming) any properties. and you can't delete a node type
once you have registered it.
i think this is a bit surprising, but it means you have to make sure you
test your stuff very well before you apply a cnd to a production system.
the only way we found to get rid of a custom node type was to completely
delete the jackrabbit folder.
cheers,david
Am 17.06.2011 22:25, schrieb Furst, Carl:
> Does anyone know if custom nodetype can be changed once created? If I
change
> my node type definition CND file, how do I apply it to a repository?
>
> Thanks,
> Carl Furst
>
>
>
>
>
>
>
>
> **********************************************************
>
> MLB.com: Where Baseball is Always On
- --
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk38yacACgkQqBnXnqWBgIuZSgCeKmF1KReSIEMHV7bdlcJK3MkL
1nQAoMTwyh1PB2lrmShFup8Y79mI0qLk
=/YHJ
-----END PGP SIGNATURE-----
Re: CndImporter
Posted by Alexander Klimetschek <ak...@adobe.com>.
On 18.06.11 17:52, "David Buchmann" <da...@liip.ch> wrote:
>you can update the type definition, but only adding new stuff, never
>removing (or renaming) any properties. and you can't delete a node type
>once you have registered it.
You can remove a node type through the nt registry (the CND importer does
not do this, so you'd need to write custom code for those nt changes) and
then add the new version of it right afterwards. AFAIK Jackrabbit "falls"
back to nt:unstructured for content using such unknown node types in the
mean time.
This gives a few more upgrade options, however you might still have
incompatible changes to the type...
>i think this is a bit surprising, but it means you have to make sure you
>test your stuff very well before you apply a cnd to a production system.
... as that's a general problem with all schemas (including database
schemas). Once content uses certain properties, constraints etc., you
can't just exchange them.
That's why using nt:unstructured has many advantages - data first,
structure later:
http://wiki.apache.org/jackrabbit/DavidsModel
Using node types only for things where the probability of change in the
future is very, very low, such as for very standardized elements.
nt:file/nt:folder are good examples for that. You can still extend with
mixins later. Since JCR 2.0, you can also change the primary node type of
a node (Node.setNodeType()), however it is not very useful for an evolving
node type, since you'd have to encode the versioning schema inside the
node type name ;-)
>the only way we found to get rid of a custom node type was to completely
>delete the jackrabbit folder.
Or delete only the content that uses those node types and
recreate/reimport it (for the development process where you continuously
might update your nt, but existing data can be thrown away).
But the above still holds true...
Regards,
Alex
--
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel
Re: CndImporter
Posted by David Buchmann <da...@liip.ch>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hi,
you can update the type definition, but only adding new stuff, never
removing (or renaming) any properties. and you can't delete a node type
once you have registered it.
i think this is a bit surprising, but it means you have to make sure you
test your stuff very well before you apply a cnd to a production system.
the only way we found to get rid of a custom node type was to completely
delete the jackrabbit folder.
cheers,david
Am 17.06.2011 22:25, schrieb Furst, Carl:
> Does anyone know if custom nodetype can be changed once created? If I change
> my node type definition CND file, how do I apply it to a repository?
>
> Thanks,
> Carl Furst
>
>
>
>
>
>
>
>
> **********************************************************
>
> MLB.com: Where Baseball is Always On
- --
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk38yacACgkQqBnXnqWBgIuZSgCeKmF1KReSIEMHV7bdlcJK3MkL
1nQAoMTwyh1PB2lrmShFup8Y79mI0qLk
=/YHJ
-----END PGP SIGNATURE-----