jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@day.com>
Subject Re: Determine if Node has been deleted
Date Fri, 10 Oct 2008 08:14:04 GMT
hi micah

On Thu, Oct 9, 2008 at 4:34 PM, Micah Whitacre <mkwhitacre@gmail.com> wrote:
> What's the best way to determine if a node has been removed from the
> repository?  The use case I have is that I have a reference to a
> Node[1] object.  That node however could have been deleted by another
> user and therefore when I perform operations like hasNode(...) I get
> an exception.  Is there a proactively determine if that Node is still
> in the repository?  Or is the best way to determine this to not hold
> onto the Node but instead store off the path, and use the path to
> retrieve the Node each time using a PathNotFoundException?

in general i wouldn't hold on too long to Node instances (e.g. by having
long-lived objects keeping references to them) but rather store an
identifier (path or uuid), as you correctly suggested.

you can always check the existence of an item by calling

boolean Session#itemExists(String absolutePath)

cheers
stefan

>
> Thanks for your help,
> Micah
>
> [1] - http://day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Node.html
>

Mime
View raw message