You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sudhan <s....@gmail.com> on 2007/04/10 00:24:25 UTC
Getting Version History after the node is deleted
I am having trouble in getting the version history once I delete the node
through DavExplorer.
I have listeners like this :
1) This is used for listening to any nodes created or updated on version
storage
session.getWorkspace().getObservationManager().addEventListener(
this,
Event.NODE_ADDED,
"/jcr:system/jcr:versionStorage",
true,
null,
new String[] { "nt:base" },
false);
2) This is used for listening to any nodes deleted from repository
session.getWorkspace().getObservationManager().addEventListener(
this,
Event.NODE_REMOVED,
"/",
true,
null,
new String[] {"nt:file"},
false);
Now my problem is that, I am able to get the event for deleted node (2)but
when i try to access version history for that node it throws
PathNotFoundException.
Is there any way to get hold of version history once the node is deleted.
--
View this message in context: http://www.nabble.com/Getting-Version-History-after-the-node-is-deleted-tf3549983.html#a9910693
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Getting Version History after the node is deleted
Posted by Sudhan <s....@gmail.com>.
Hi Jukka,
Here is the exact scenario " The application publishes (to some predefined
location in a file system) the content of the repository irrespective of
Node added, updated or deleted. Now this is not done to all the files, only
some of the selected ones(depending upon the publish property set inside
jcr:content). So when i update or add new nt:file node, I can always read
those custom property which decides whether to publish the file on the file
system.
I was assuming that the version history still remains intact eventhough you
remove the versionable node from the repository. So if somehow if i can get
a handle to the version history of that actual node, then i can pull out the
property "publish" so that if set true i can publish the deleted file on to
some specific file location.
Hope this would give little bit of idea about my application.
thanks,
Sudhan
Jukka Zitting wrote:
>
> Hi,
>
> On 4/10/07, Sudhan <s....@gmail.com> wrote:
>> My scenario is that, I am already setting some custom property on all the
>> jcr:content node during initialization. Now this property is useful when
>> there are any new updates on the node aswell as when the node is removed
>> from the repository.
>>
>> So when i get an event for NODE_REMOVED, I need to pull out the property
>> set
>> on jcr:content node of the deleted node. I had a notion that the version
>> history still remains eventhough you remove the node from the repository.
>> Now my problem is to get a handle to jcr:content node and do some
>> processing
>> after getting the property.
>
> I'm not sure I follow you. Isn't the jcr:content node removed as well
> when the containing node gets removed? Thus there is no way for you to
> set any jcr:content properties after the removal.
>
> BR,
>
> Jukka Zitting
>
>
--
View this message in context: http://www.nabble.com/Getting-Version-History-after-the-node-is-deleted-tf3549983.html#a9940963
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Getting Version History after the node is deleted
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 4/10/07, Sudhan <s....@gmail.com> wrote:
> My scenario is that, I am already setting some custom property on all the
> jcr:content node during initialization. Now this property is useful when
> there are any new updates on the node aswell as when the node is removed
> from the repository.
>
> So when i get an event for NODE_REMOVED, I need to pull out the property set
> on jcr:content node of the deleted node. I had a notion that the version
> history still remains eventhough you remove the node from the repository.
> Now my problem is to get a handle to jcr:content node and do some processing
> after getting the property.
I'm not sure I follow you. Isn't the jcr:content node removed as well
when the containing node gets removed? Thus there is no way for you to
set any jcr:content properties after the removal.
BR,
Jukka Zitting
Re: Getting Version History after the node is deleted
Posted by Sudhan <s....@gmail.com>.
Hello Jukka,
Yes i am using Jackrabbit remotely over the RMI layer.
My scenario is that, I am already setting some custom property on all the
jcr:content node during initialization. Now this property is useful when
there are any new updates on the node aswell as when the node is removed
from the repository.
So when i get an event for NODE_REMOVED, I need to pull out the property set
on jcr:content node of the deleted node. I had a notion that the version
history still remains eventhough you remove the node from the repository.
Now my problem is to get a handle to jcr:content node and do some processing
after getting the property.
Do you think this can be achieved under present environment.
thanks,
Sudhan
Jukka Zitting wrote:
>
> Hi,
>
> On 4/10/07, Sudhan <s....@gmail.com> wrote:
>> When i tried this, i am getting :
>>
>> Error : java.lang.ClassCastException:
>> org.apache.jackrabbit.rmi.observation.ClientEventPoll$JCREvent
>>
>> when performing casting operation as
>> (org.apache.jackrabbit.core.observation.EventImpl)event
>>
>> is there any thing i am doing wrong here. let me know.
>
> Casting the event to EventImpl only works when you're using a local
> Jackrabbit instance, not when using Jackrabbit remotely over the RMI
> layer.
>
> What's your use case for wanting to get the version history of a removed
> node?
>
> BR,
>
> Jukka Zitting
>
>
--
View this message in context: http://www.nabble.com/Getting-Version-History-after-the-node-is-deleted-tf3549983.html#a9927524
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Getting Version History after the node is deleted
Posted by Sridhar Raman <sr...@gmail.com>.
I realised that I face the same problem as Sudhan. So, is there any way of
achieving this in the current version of Jackrabbit?
Would it possible for me to perform an XPATH query into the version storage
nodes, and try to obtain the frozen child node copy of a deleted node by
using the jcr:frozenUuid property, if I knew the UUID of the node that had
been deleted.
I tried the above, and it returned no results. Any particular reason why I
am facing this problem?
Thanks,
Sridhar
On Apr 11, 2007 8:13 PM, Florent Guillaume <fg...@nuxeo.com> wrote:
> Alexandru Popescu wrote:
> >> What's your use case for wanting to get the version history of a
> >> removed node?
> >
> > On a more theoretical level: isn't this a limitation of the spec? By
> > the time you remove the event the path information attached to the
> > event is quite useless, so the mechanism should try to publish more
> > usefull information.
>
> It was indeed a limitation of JSR-170, and is taken care of in its
> successor, JSR-283, where you have a method to recover the uuid from the
> event.
>
> Florent
>
>
> --
> Florent Guillaume, Director of R&D, Nuxeo
> Open Source Enterprise Content Management (ECM)
> http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
>
>
Re: Getting Version History after the node is deleted
Posted by Florent Guillaume <fg...@nuxeo.com>.
Alexandru Popescu wrote:
>> What's your use case for wanting to get the version history of a
>> removed node?
>
> On a more theoretical level: isn't this a limitation of the spec? By
> the time you remove the event the path information attached to the
> event is quite useless, so the mechanism should try to publish more
> usefull information.
It was indeed a limitation of JSR-170, and is taken care of in its
successor, JSR-283, where you have a method to recover the uuid from the
event.
Florent
--
Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
Re: Getting Version History after the node is deleted
Posted by Alexandru Popescu ☀ <th...@gmail.com>.
On 4/11/07, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> On 4/10/07, Alexandru Popescu ☀ <th...@gmail.com> wrote:
> > On a more theoretical level: isn't this a limitation of the spec? By
> > the time you remove the event the path information attached to the
> > event is quite useless, so the mechanism should try to publish more
> > usefull information.
>
> I think the remove events are most useful for ensuring coherency for
> applications that cache parts of the repository content (a good
> example would be an external search engine). Cache eviction only needs
> the item path as the key of the cached entry.
>
... if you used that as a key and not the UUID or a "natural key"
based on the node properties.
> What use cases do you think would benefit from more information in the
> event records?
>
I don't have real scenarios right now, but I am seeing Sudhan example,
and I guess we can imagine quite a few (take for example workflow
notifications). Probably the best alternative would be to publish
through the event a shallow copy/dettached copy of the deleted node,
so that you still have most of the information available. I know that
this can be solved in your app with custom made code around special
removal ops, but if you look at this as a cross cutting concern, then
having more information published through event would lead to a lot of
possibilities.
bests,
./alex
--
.w( the_mindstorm )p.
_____________________________________
Alexandru Popescu, OSS Evangelist
TestNG/Groovy/AspectJ/WebWork/more...
Information Queue ~ www.InfoQ.com
> BR,
>
> Jukka Zitting
>
Re: Getting Version History after the node is deleted
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 4/10/07, Alexandru Popescu ☀ <th...@gmail.com> wrote:
> On a more theoretical level: isn't this a limitation of the spec? By
> the time you remove the event the path information attached to the
> event is quite useless, so the mechanism should try to publish more
> usefull information.
I think the remove events are most useful for ensuring coherency for
applications that cache parts of the repository content (a good
example would be an external search engine). Cache eviction only needs
the item path as the key of the cached entry.
What use cases do you think would benefit from more information in the
event records?
BR,
Jukka Zitting
Re: Getting Version History after the node is deleted
Posted by Alexandru Popescu ☀ <th...@gmail.com>.
On 4/10/07, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> On 4/10/07, Sudhan <s....@gmail.com> wrote:
> > When i tried this, i am getting :
> >
> > Error : java.lang.ClassCastException:
> > org.apache.jackrabbit.rmi.observation.ClientEventPoll$JCREvent
> >
> > when performing casting operation as
> > (org.apache.jackrabbit.core.observation.EventImpl)event
> >
> > is there any thing i am doing wrong here. let me know.
>
> Casting the event to EventImpl only works when you're using a local
> Jackrabbit instance, not when using Jackrabbit remotely over the RMI
> layer.
>
> What's your use case for wanting to get the version history of a removed node?
>
On a more theoretical level: isn't this a limitation of the spec? By
the time you remove the event the path information attached to the
event is quite useless, so the mechanism should try to publish more
usefull information.
bests,
./alex
--
.w( the_mindstorm )p.
_____________________________________
Alexandru Popescu, OSS Evangelist
TestNG/Groovy/AspectJ/WebWork/more...
Information Queue ~ www.InfoQ.com
> BR,
>
> Jukka Zitting
>
Re: Getting Version History after the node is deleted
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 4/10/07, Sudhan <s....@gmail.com> wrote:
> When i tried this, i am getting :
>
> Error : java.lang.ClassCastException:
> org.apache.jackrabbit.rmi.observation.ClientEventPoll$JCREvent
>
> when performing casting operation as
> (org.apache.jackrabbit.core.observation.EventImpl)event
>
> is there any thing i am doing wrong here. let me know.
Casting the event to EventImpl only works when you're using a local
Jackrabbit instance, not when using Jackrabbit remotely over the RMI
layer.
What's your use case for wanting to get the version history of a removed node?
BR,
Jukka Zitting
Re: Getting Version History after the node is deleted
Posted by Sudhan <s....@gmail.com>.
Hi Toby,
Thanks for your suggestion.
When i tried this, i am getting :
Error : java.lang.ClassCastException:
org.apache.jackrabbit.rmi.observation.ClientEventPoll$JCREvent
when performing casting operation as
(org.apache.jackrabbit.core.observation.EventImpl)event
is there any thing i am doing wrong here. let me know.
thanks,
Sudhan
Tobias Bocanegra wrote:
>
> hi,
> unfortunately, the event for the node_removed does not contain any
> suitable information by the path anymore. what you need is the uuid of
> the node, in order to get the version history.
>
> if you run inside jackrabbit, you can cast the Event to EventImpl, and
> then fetch the "NodeId getParentId();" or "NodeId getChildId()".
>
> Example: String uuid = ((EventImpl)
> evt).getChildId().getUUID().toString();
>
> after that you can query for the 'jcr:versionableUuid' of the
> appropriate version history.
>
> please note, that the NodeId and EventImpl are jackrabbit internals
> and could change in later releases.
>
> regards, toby
>
> On 4/10/07, Sudhan <s....@gmail.com> wrote:
>>
>> I am having trouble in getting the version history once I delete the node
>> through DavExplorer.
>>
>> I have listeners like this :
>>
>> 1) This is used for listening to any nodes created or updated on version
>> storage
>>
>> session.getWorkspace().getObservationManager().addEventListener(
>> this,
>> Event.NODE_ADDED,
>> "/jcr:system/jcr:versionStorage",
>> true,
>> null,
>> new String[] { "nt:base" },
>> false);
>>
>> 2) This is used for listening to any nodes deleted from repository
>>
>> session.getWorkspace().getObservationManager().addEventListener(
>> this,
>> Event.NODE_REMOVED,
>> "/",
>> true,
>> null,
>> new String[] {"nt:file"},
>> false);
>>
>> Now my problem is that, I am able to get the event for deleted node
>> (2)but
>> when i try to access version history for that node it throws
>> PathNotFoundException.
>>
>> Is there any way to get hold of version history once the node is deleted.
>> --
>> View this message in context:
>> http://www.nabble.com/Getting-Version-History-after-the-node-is-deleted-tf3549983.html#a9910693
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
>
>
> --
> -----------------------------------------< tobias.bocanegra@day.com >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com >---
>
>
--
View this message in context: http://www.nabble.com/Getting-Version-History-after-the-node-is-deleted-tf3549983.html#a9926053
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Getting Version History after the node is deleted
Posted by Tobias Bocanegra <to...@day.com>.
hi,
unfortunately, the event for the node_removed does not contain any
suitable information by the path anymore. what you need is the uuid of
the node, in order to get the version history.
if you run inside jackrabbit, you can cast the Event to EventImpl, and
then fetch the "NodeId getParentId();" or "NodeId getChildId()".
Example: String uuid = ((EventImpl) evt).getChildId().getUUID().toString();
after that you can query for the 'jcr:versionableUuid' of the
appropriate version history.
please note, that the NodeId and EventImpl are jackrabbit internals
and could change in later releases.
regards, toby
On 4/10/07, Sudhan <s....@gmail.com> wrote:
>
> I am having trouble in getting the version history once I delete the node
> through DavExplorer.
>
> I have listeners like this :
>
> 1) This is used for listening to any nodes created or updated on version
> storage
>
> session.getWorkspace().getObservationManager().addEventListener(
> this,
> Event.NODE_ADDED,
> "/jcr:system/jcr:versionStorage",
> true,
> null,
> new String[] { "nt:base" },
> false);
>
> 2) This is used for listening to any nodes deleted from repository
>
> session.getWorkspace().getObservationManager().addEventListener(
> this,
> Event.NODE_REMOVED,
> "/",
> true,
> null,
> new String[] {"nt:file"},
> false);
>
> Now my problem is that, I am able to get the event for deleted node (2)but
> when i try to access version history for that node it throws
> PathNotFoundException.
>
> Is there any way to get hold of version history once the node is deleted.
> --
> View this message in context: http://www.nabble.com/Getting-Version-History-after-the-node-is-deleted-tf3549983.html#a9910693
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>
--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---