Sounds like a good idea. It's OK by me.

Ted

2006/11/15, Nicolas <[EMAIL PROTECTED]>:

Hi Jukka,

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.

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

If you are OK, with it, I will open a JIRA issue so we can discuss it
further.

BR,
Nico

On 11/15/06, Jukka Zitting <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> On 11/15/06, Ted Roeloffzen <[EMAIL PROTECTED]> wrote:
> > I have made a small web application with JackRabbit and the first time
> that
> > i run it I have to register the new nodetypedefinitions and the
> namespace
> > URI. Now is my question this: Is there a generic way to check whether
or
> not
> > your using the repository for the first time?
>
> I generally check whether my namespaces or nodetypes are already
> registered. Something like this:
>
>     try {
>         session.getNamespacePrefix(MY_NAMESPACE);
>     } catch (NamespaceException e) {
>         // register the namespace(s)
>     }
>
> or:
>
>     try {
>         session.getWorkspace().getNodeTypeManager()
>             .getNodeType(MY_NODETYPE);
>     } catch (NoSuchNodeTypeException e) {
>         // register the node type(s)
>     }
>
> BR,
>
> Jukka Zitting
>


Reply via email to