You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Michael Harris <mi...@gmail.com> on 2008/07/24 17:10:02 UTC
versioning a file
hey all,
so i can create file
Node fileNode = parentFolder.addNode(file.getName(), "nt:file");
// make the file versionable and lockable
fileNode.addMixin("mix:versionable");
// create the mandatory child node - jcr:content
Node resNode = fileNode.addNode("jcr:content", "nt:resource");
I added the middle line to make the file versionable. but when I try to
getVersionHistory on the file I get an exception
javax.jcr.UnsupportedRepositoryOperationException: Unable to perform
versioning operation on non versionable node: /files/testVersionFile
at
org.apache.jackrabbit.core.NodeImpl.checkVersionable(NodeImpl.java:3215)
any ideas? Can I add the mix:versionable type to nt:file? If not, how does
one version a file?
--
---------------------
Michael Harris
Re: versioning a file
Posted by Alexander Klimetschek <ak...@day.com>.
On Mon, Aug 11, 2008 at 7:34 PM, Michael Harris
<mi...@gmail.com> wrote:
> Alex
>
> thanx -- i asked that a while ago and ended up just trying it -- i version
> the file and everything works fine.
I know, I was on vacation and currently digg through all the unread
mails and try to answer the yet-unanswered ones as far as I can.
> I tend to ask a lot of questions I should only ask after trying it
> myself....;)
No problem, some things like OPV are not that obvious :-)
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: versioning a file
Posted by Michael Harris <mi...@gmail.com>.
Alex
thanx -- i asked that a while ago and ended up just trying it -- i version
the file and everything works fine.
I tend to ask a lot of questions I should only ask after trying it
myself....;)
On Mon, Aug 11, 2008 at 12:12 PM, Alexander Klimetschek <ak...@day.com>wrote:
> Hi!
>
> On Thu, Jul 24, 2008 at 7:35 PM, Michael Harris
> <mi...@gmail.com> wrote:
> > when a node is versioned, what happens to child nodes? Are they
> versioned
> > to?
>
> You can specify the behaviour in the node type definitions - have a
> look at section "8.2.11 OnParentVersion Attribute" of the JCR spec.
> For a quick overview, see here
> http://markmail.org/message/4kfvtze7t7quqayu
>
> > If you want to modify a child node, would you checkout the parent or the
> > child?
>
> If you add or remove child nodes, you have to modify the parent. To
> change properties, you only modify the node with the properties. The
> rest depends on the OnParentVersion attribute.
>
> > So nt:file node has a child node nt:resource. The content of the file is
> > stored as a property of that resource. To version the file, do you
> checkout
> > the nt:file or the nt:resource?
>
> Good question! Haven't done so my self, but since nt:resource has a
> OPV=COPY you can do both. I would tend to make the nt:file a
> mix:versionable.
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>
--
---------------------
Michael Harris
Re: versioning a file
Posted by Alexander Klimetschek <ak...@day.com>.
Hi!
On Thu, Jul 24, 2008 at 7:35 PM, Michael Harris
<mi...@gmail.com> wrote:
> when a node is versioned, what happens to child nodes? Are they versioned
> to?
You can specify the behaviour in the node type definitions - have a
look at section "8.2.11 OnParentVersion Attribute" of the JCR spec.
For a quick overview, see here
http://markmail.org/message/4kfvtze7t7quqayu
> If you want to modify a child node, would you checkout the parent or the
> child?
If you add or remove child nodes, you have to modify the parent. To
change properties, you only modify the node with the properties. The
rest depends on the OnParentVersion attribute.
> So nt:file node has a child node nt:resource. The content of the file is
> stored as a property of that resource. To version the file, do you checkout
> the nt:file or the nt:resource?
Good question! Haven't done so my self, but since nt:resource has a
OPV=COPY you can do both. I would tend to make the nt:file a
mix:versionable.
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: versioning a file
Posted by Michael Harris <mi...@gmail.com>.
when a node is versioned, what happens to child nodes? Are they versioned
to?
If you want to modify a child node, would you checkout the parent or the
child?
So nt:file node has a child node nt:resource. The content of the file is
stored as a property of that resource. To version the file, do you checkout
the nt:file or the nt:resource?
On Thu, Jul 24, 2008 at 11:10 AM, Michael Harris <mi...@gmail.com>
wrote:
> hey all,
>
> so i can create file
>
> Node fileNode = parentFolder.addNode(file.getName(), "nt:file");
>
> // make the file versionable and lockable
> fileNode.addMixin("mix:versionable");
>
> // create the mandatory child node - jcr:content
> Node resNode = fileNode.addNode("jcr:content", "nt:resource");
>
> I added the middle line to make the file versionable. but when I try to
> getVersionHistory on the file I get an exception
>
>
> javax.jcr.UnsupportedRepositoryOperationException: Unable to perform
> versioning operation on non versionable node: /files/testVersionFile
> at
> org.apache.jackrabbit.core.NodeImpl.checkVersionable(NodeImpl.java:3215)
>
>
> any ideas? Can I add the mix:versionable type to nt:file? If not, how
> does one version a file?
>
> --
> ---------------------
> Michael Harris
>
--
---------------------
Michael Harris