Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 9297 invoked from network); 28 Feb 2007 16:51:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Feb 2007 16:51:43 -0000 Received: (qmail 87555 invoked by uid 500); 28 Feb 2007 16:51:50 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 87539 invoked by uid 500); 28 Feb 2007 16:51:50 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 87530 invoked by uid 99); 28 Feb 2007 16:51:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 08:51:50 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of stefan.guggisberg@gmail.com designates 64.233.182.191 as permitted sender) Received: from [64.233.182.191] (HELO nf-out-0910.google.com) (64.233.182.191) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 08:51:39 -0800 Received: by nf-out-0910.google.com with SMTP id x4so626194nfb for ; Wed, 28 Feb 2007 08:51:18 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gFpon9Vd0rixqcuCMsM5wkd8FcioTbWdZGfwRNJCBeaFL1ByR/R2iZVeluAzgmXU++orTBbNlZM69p+TZ9tAljPZ3J1iSm5MzmkekPb3o/SB/qSaZDJY5mIbWR3hc/qKmijUytVrYRxzszkwjRHW5/bEoGWtA5jCk/CgxPLxJm0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DgMHGEfYA6Bln77EgwKRnj97dQ+n1U7n/WXZcRAK8BX1kDmUUQCCg/rpRryq3S4ay3UMEpD4i/SA8keIuQOrBo7fYuipIuzRb6vpUQOV/7tGImtIOYChS5MKyK51cFa2MjfZZFMgedegAmZVbFN7yOo/Vv5lrGvcjdR9b7nOnco= Received: by 10.49.28.3 with SMTP id f3mr3895344nfj.1172681477923; Wed, 28 Feb 2007 08:51:17 -0800 (PST) Received: by 10.49.3.2 with HTTP; Wed, 28 Feb 2007 08:51:17 -0800 (PST) Message-ID: <90a8d1c00702280851r25447090v9eb682139c001dcb@mail.gmail.com> Date: Wed, 28 Feb 2007 17:51:17 +0100 From: "Stefan Guggisberg" To: users@jackrabbit.apache.org Subject: Re: Namespaces - questions In-Reply-To: <698421c00702270110o5f54e2d3oa1c541f15c203fd9@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <8be731880702270013t6a6c2674h5e1bf66a0fe402bb@mail.gmail.com> <698421c00702270110o5f54e2d3oa1c541f15c203fd9@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org On 2/27/07, Wolf Benz wrote: > Hi Tobias, > Most importantly: thanks for taking the time to reply :-) > I have 2 remaining questions: > > 1/ It seems (to me, at least) unefficient to have to do this at every > time you get a session, no? (as this is code that is passed every time > you get a session) Is there a way to "init" a session once and for all > so that every next call to it can assume this work is done instead of > having to check every other time it is done? you have to register your custom types once, just like you have to create your custom tables in an rdbms once. JackrabbitNodeTypeManager.registerNodeTypes(InputStream, String) provides an easy and convenient way of registering your custom node types incl. any referenced namespaces, e.g. JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager) session.getWorkspace().getNodeTypeManager(); manager.registerNodeTypes(new FileInputStream("mytypes.cnd"), JackrabbitNodeTypeManager.TEXT_X_JCR_CND); > > 2/ Why do you explicitely (again) do the > "s.setNamespacePrefix("myapp", "http://your.com/ns/1");" as you not > only registered the NS, but also provide the NS (myapp) in your call > on the next line: "s.getRootNode().getNode("myapp:someNode");" > Is it necessary? namespaces in JCR are modelled after XML namespaces. for more information please refer to sections 4.5 and 6.3 in the jsr 170 specification. cheers stefan > > Thanks in advance, > Wolf > > On 2/27/07, Tobias Bocanegra wrote: > > 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 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 >--- > > >