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 08:49:20 GMT
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
View raw message