jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Roeloffzen" <ted.roeloff...@gmail.com>
Subject Re: Checking existence of the repository
Date Wed, 15 Nov 2006 09:28:38 GMT
Sounds like a good idea. It's OK by me.

Ted

2006/11/15, Nicolas <ntoper@gmail.com>:
>
> 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 <jukka.zitting@gmail.com> wrote:
> >
> > Hi,
> >
> > On 11/15/06, Ted Roeloffzen <ted.roeloffzen@gmail.com> 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
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message