jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Bocanegra" <tobias.bocane...@day.com>
Subject Re: Namespaces - questions
Date Tue, 27 Feb 2007 08:13:48 GMT
namespaces are fully supported by jackrabbit since 1.0. and the
registration works exactly as specified in jsr170 (which is a bit
troublesome).

in your application you probably have a 'getRepositorySession' call,
and there i would setup/check the namespaces for your application, eg:

1. check if your namespace is already registered
2. if not, do so.
3. setup the namespace mapping for your session and application.

example:

    try {
        s.getNamespaceURI("http://your.com/ns/1");
    } catch (RepositoryException e) {
        // register namespace
        s.getWorkspace().getNamespaceRegistry().registerNamespace(
            "myapp", "http://your.com/ns/1");
    }
    s.setNamespacePrefix("myapp", "http://your.com/ns/1");
    [....]
    s.getRootNode().getNode("myapp:someNode");

regards, toby


On 2/26/07, Wolf Benz <eurojava@gmail.com> wrote:
> Hi List,
>
> I have 2 questions regarding namespaces:
>
> 1/ What is the meaning/effect of these variables:
> forceNamespacesRegistration
> keepNamespaces
>
> The Javadoc seems to be left blanc for these...
>
> &  I keep getting errors w.r.t. namespaces:
> I try to register a namespace, but I got and error when running the
> application a second time (name space already exists)
> + when forceNamespacesRegistration is true I got 'unregistering
> namespaces is not supported.'
>
> --> Does this mean even in JR 1.2.2 namespaces are not fully
> supported? (...)
> (hope it will probabely be smth else - NS are such key piece of a JCR
> this seems unlikely)
> Do these vars actually do what they are meant to do?
>
> 2/ Most importantly:
> How does one get to register the custom nodes that go with these
> namespaces?
> Does it suffice to place the CND-file in the /respository/namepsaces
> directory, or should it be in the specific WS directory /workspaces/
> myWS/myProjectNamespaces/ (bot defined in the repository.xml)
>
> or....?
> Or do they really have to be digged up from where ever you put the
> cnd file and are these 2 locations mere preferred locations? (like
> the code example on the JR site)
> If so, I can't image that this needs to be done at every single
> getSession - what's the best place to do it once? I'm having a "best
> place-when best" problem with this. Apparently a NS is registered
> from the WS, which you get from the Session. I find this strange. I
> rather see it as tied to a Repository. So I would have expected it in
> the repository configuration.
>
> Sorry or all the questions... (I hope everyone has these issues)
> Wolf
>
> Ps2 Is this sort of stuff addressed in JSR-283 as well?


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Mime
View raw message