jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Checking existence of the repository
Date Wed, 15 Nov 2006 09:30:00 GMT

On 11/15/06, Nicolas <ntoper@gmail.com> wrote:
> I had a similar issue (on the backup tool), maybe it could be a good
> addition to write a small method to check for the existence of a specific
> NodeType and a Namespace.

See the NamespaceRegistryImpl.safeRegisterNamespace() method that
achieves the full use case for namespaces. It's an internal Jackrabbit
method, so I wouldn't advocate using it from general JCR clients, but
the backup tool can well use it.

> It seems to be a common use case and catching exception for this is not a
> good practice, although not JCR compliant.

Catching the esceptions is JCR compliant.

I don't think it makes much sense to add Jackrabbit specific
extensions for doing this, the extra benefit of having a boolean
return value from something like isNamespaceRegistered() or
nodeTypeExists() instead of catching the respective exception is
rather minor (both achieve the same result, and the use case is quite
rare), so it definitely wouldn't justify adding a direct Jackrabbit
dependency to a client.

You may want to send the suggestion to jsr-283-comments@jcp.org for
consideration in JCR 2.0, but at least I would be intuitively against
adding such utility methods since the need for them is quite limited.


Jukka Zitting

View raw message