You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by "Marian Schedenig (qs)" <Ma...@qualysoft.com> on 2009/04/14 15:48:35 UTC

WedDAV Copy method on versioned resources

Hi!

I'm using versioning through WebDAV. Doing checkout - write to file -
checkin works fine so far, as does listing the version history and accessing
the content old versions through their respective HTTP URLs.

Now I'm trying to implement a simple revert feature, which checks out the
resource, copies and old version over it, and does a checkin. As the revert
shouldn't just restore the content of the old version, but the properties as
well, I'm using the Copy method, using the version URL of the old version as
the source URL and the "main" (regular) URL of the resource as the
destination, with overwrite set to true.

But this doesn't work as expected. And it doesn't simply delete the
versioned resource and replace it with a new one containing the old
version's contents, either. What I get is an unversioned resource with no
properties, and plenty of error messages on the server side:

14.04.2009 15:05:24 *WARN * AbstractVersionManager: Versioning item not
found: 6e8c8bae-1422-48f0-b383-84befd6c487a (AbstractVersionManager.java,
line 94)
14.04.2009 15:05:24 *ERROR* VersionResourceImpl:
6e8c8bae-1422-48f0-b383-84befd6c487a: the item does not exist anymore
(VersionResourceImpl.java, line 285)

Is this a bug, or am I just doing it wrong? If it's the latter, what would
be the correct way to create a new version with the contents and properties
of an earlier version?

Thx,
Marian.

-- 
View this message in context: http://www.nabble.com/WedDAV-Copy-method-on-versioned-resources-tp23039770p23039770.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: WedDAV Copy method on versioned resources

Posted by "Marian Schedenig (qs)" <Ma...@qualysoft.com>.

Julian Reschke wrote:
> 
> As a matter of fact, demonstrating the 
> problem (with an attempt to workaround on top of the JCR API) may be 
> useful in clarifying the spec :-)

I've been trying to reproduce the problem in minimal demo program through
the JCR API (earlier I had only been using DAV), but without success. In
fact, I can't seem to get Workspace#copy() to work at all.

I have these source and destination paths:

String src = version.getNodes().nextNode().getPath();
String dest = node.getPath();

Where "version" is the version node I want to restore (the only child node
being the "frozen" node containing my versioned data, this is what I'm
getting the path of) and "node" being the versioned node I want to overwrite
with the contents from the old version.

But after

		session.getWorkspace().copy(src, dest);

the contents of "node" are unchanged. Refreshing the session doesn't help.

I'm probably making a very obvious mistake, but I just can't figure out
where.

Thx,
Marian.

PS: I realise that the JCR API provides a dedicated method for restoring old
versions, but to my knowledge, no DAV equivalent exists which would (or
could) be mapped to it.
-- 
View this message in context: http://www.nabble.com/WedDAV-Copy-method-on-versioned-resources-tp23039770p23371666.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: WedDAV Copy method on versioned resources

Posted by Julian Reschke <ju...@gmx.de>.
Marian Schedenig (qs) wrote:
> 
> Julian Reschke wrote:
>> Sounds like a bug, see the DeltaV spec...: 
>>
> 
> That's what I was afraid to hear. The DAV layer seems rather thin at this
> point, it doesn't do much more than call a copy method in the actual JCR
> layer. I've followed the calls to BatchedItemOperation#copy(), to see if the
> target node is actually deleted anywhere before the new node is written over
> it. I don't see that happening anywhere, but while I'm somewhat accustomed
> to the DAV classes by now, the JCR internals still are mostly magic to me.
> 
> Any point in filing a bug report for this based on this information?

It appears that the JCR spec is silent on this; I've followed up on the 
Expert Group's mailing list...

> Plus, any hints on a decent workaround for now? :) Overwriting the content
> of a target file plus all properties and dropping all properties not present
> on the version I want to restore should do what I need, but I expect I might
> run into some trouble when I try to overwrite live properties (not knowing
> they are live) or missing (unlikely) dead properties excluded from ALLPROP
> requests.

Yes, that may get complicated. As a matter of fact, demonstrating the 
problem (with an attempt to workaround on top of the JCR API) may be 
useful in clarifying the spec :-)

Best regards, Julian

Re: WedDAV Copy method on versioned resources

Posted by "Marian Schedenig (qs)" <Ma...@qualysoft.com>.

Julian Reschke wrote:
> 
> Sounds like a bug, see the DeltaV spec...: 
> 

That's what I was afraid to hear. The DAV layer seems rather thin at this
point, it doesn't do much more than call a copy method in the actual JCR
layer. I've followed the calls to BatchedItemOperation#copy(), to see if the
target node is actually deleted anywhere before the new node is written over
it. I don't see that happening anywhere, but while I'm somewhat accustomed
to the DAV classes by now, the JCR internals still are mostly magic to me.

Any point in filing a bug report for this based on this information?

Plus, any hints on a decent workaround for now? :) Overwriting the content
of a target file plus all properties and dropping all properties not present
on the version I want to restore should do what I need, but I expect I might
run into some trouble when I try to overwrite live properties (not knowing
they are live) or missing (unlikely) dead properties excluded from ALLPROP
requests.

Cheers,
Marian.

-- 
View this message in context: http://www.nabble.com/WedDAV-Copy-method-on-versioned-resources-tp23039770p23044020.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: WedDAV Copy method on versioned resources

Posted by Julian Reschke <ju...@gmx.de>.
Marian Schedenig (qs) wrote:
> Hi!
> 
> I'm using versioning through WebDAV. Doing checkout - write to file -
> checkin works fine so far, as does listing the version history and accessing
> the content old versions through their respective HTTP URLs.
> 
> Now I'm trying to implement a simple revert feature, which checks out the
> resource, copies and old version over it, and does a checkin. As the revert
> shouldn't just restore the content of the old version, but the properties as
> well, I'm using the Copy method, using the version URL of the old version as
> the source URL and the "main" (regular) URL of the resource as the
> destination, with overwrite set to true.
> 
> But this doesn't work as expected. And it doesn't simply delete the
> versioned resource and replace it with a new one containing the old
> version's contents, either. What I get is an unversioned resource with no
> properties, and plenty of error messages on the server side:
> 
> 14.04.2009 15:05:24 *WARN * AbstractVersionManager: Versioning item not
> found: 6e8c8bae-1422-48f0-b383-84befd6c487a (AbstractVersionManager.java,
> line 94)
> 14.04.2009 15:05:24 *ERROR* VersionResourceImpl:
> 6e8c8bae-1422-48f0-b383-84befd6c487a: the item does not exist anymore
> (VersionResourceImpl.java, line 285)
> 
> Is this a bug, or am I just doing it wrong? If it's the latter, what would
> be the correct way to create a new version with the contents and properties
> of an earlier version?

Sounds like a bug, see the DeltaV spec...: 
<http://greenbytes.de/tech/webdav/rfc3253.html#rfc.section.1.7>.

BR, Julian