Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 95117 invoked from network); 8 Mar 2010 16:40:32 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Mar 2010 16:40:32 -0000 Received: (qmail 29136 invoked by uid 500); 8 Mar 2010 16:40:08 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 29113 invoked by uid 500); 8 Mar 2010 16:40:08 -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 29103 invoked by uid 99); 8 Mar 2010 16:40:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Mar 2010 16:40:07 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of stefan.guggisberg@gmail.com designates 209.85.218.225 as permitted sender) Received: from [209.85.218.225] (HELO mail-bw0-f225.google.com) (209.85.218.225) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Mar 2010 16:40:02 +0000 Received: by bwz25 with SMTP id 25so1328826bwz.11 for ; Mon, 08 Mar 2010 08:39:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=r7XbrrdL8pgJGuq6YWOtehZgPc8GFOw9aERkGxdWP4k=; b=R4utrcF+MkjXVkjrXc/fjSJVyNnmUO8kMimhgIxohitjDQejX0xNHLc7bktDjuCH/t iYLsl8576z/FtJFtDG3VckudCD7dSgLtStyTpeQJiyc0z/hWM7my0ueWlLrDyY9AHZ2F fIWW4ZHGXAeycKJ0tQgvZDMX7EitjUCFJoIoY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Jd4/xXqOxDv4dsEixQLSYD18FssZ/6B9rnfrrpktY2CAwUtcldzNbNbQJC54ZRoVP0 WBJH9Y6660XP4dD8QozaASdAgu+sUv4xxumvrrz1mdv7HyaMLTn0edUdtNpaaxTVo0mj byg/euuj2XDmGkWFANPLPqoJxetGQSl5zgW4A= MIME-Version: 1.0 Received: by 10.204.34.10 with SMTP id j10mr1820730bkd.87.1268066380245; Mon, 08 Mar 2010 08:39:40 -0800 (PST) In-Reply-To: <4B952179.2080306@day.com> References: <90a8d1c01003040245k68d3f438q945f8392eed9c4ef@mail.gmail.com> <90a8d1c01003050139k520fd055v476242a605f4efad@mail.gmail.com> <90a8d1c01003080206o7be8cb7dtcea136347d55d903@mail.gmail.com> <4B952179.2080306@day.com> Date: Mon, 8 Mar 2010 17:39:38 +0100 Message-ID: <90a8d1c01003080839q442cf747r46e5e216d6288b19@mail.gmail.com> Subject: Re: NodeType creation From: Stefan Guggisberg To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Mar 8, 2010 at 5:10 PM, Michael D=FCrig wr= ote: > Sorry for popping in. JCR-2003 indicates that you access the repository v= ia > some kind of remoting (most likely DavEx) and that a method is involved > which is not (yet) implemented in one of the involved remoting layers. Se= e > https://issues.apache.org/jira/browse/JCR-2003. yes, you're right. i was under the assumption that JCR 2.0 is fully impleme= nted in jackrabbit 2.0. but there's obviously still one related open issue with the spi2dav remoting layer: https://issues.apache.org/jira/browse/JCR-2454 cheers stefan > > Michael > > On 3/8/10 4:59 PM, Birmingham, Steven wrote: >> >> Thanks again, =A0It compiles and runs now but I get the same result as w= hen >> I tried the cndImporter; java.lang.UnsupportedOperationException: JCR-20= 03. >> Implementation missing. =A0I am still running the standalone jar and wil= l >> switch over to the war file when I get time and see if all is better. >> >> Steve >> >> -----Original Message----- >> From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] >> Sent: Monday, March 08, 2010 3:06 AM >> To: users@jackrabbit.apache.org >> Subject: Re: NodeType creation >> >> On Fri, Mar 5, 2010 at 9:20 PM, Birmingham, Steven >> =A0wrote: >>> >>> Thanks Stefan, >>> >>> Yeah, I just looked through the message archives and saw the CndImporte= r >>> example and gave it a try. =A0I tried using the CompactNodeTypeDefReade= r as >>> you suggested. =A0It worked as far reading the cnd file, but the >>> NodeTypeManager.registerNodeTypes() is expecting an array of >>> NodeTypeDefinition not QNodeTypeDefinition[]. =A0I saw a method to crea= te >>> QNodeTypeDefinitions out of NodeTypeDefinitions but have not found a wa= y to >>> do vice versa. >> >> sorry, i didn't notice it. >> >> o.a.jackrabbit.spi.commons.nodetyp.NodeTypeDefinitionFactory should do >> the trick. >> >> http://jackrabbit.apache.org/api/2.0/org/apache/jackrabbit/spi/commons/n= odetype/NodeTypeDefinitionFactory.html >> >> here's a sample i put together and which should help get you started: >> >> >> >> ////////////////////////////////////////////////////////////////////////= //////// >> import org.apache.jackrabbit.commons.NamespaceHelper; >> import org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader; >> import org.apache.jackrabbit.commons.cnd.ParseException; >> import org.apache.jackrabbit.spi.QNodeTypeDefinition; >> import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping; >> import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver; >> import >> org.apache.jackrabbit.spi.commons.namespace.SessionNamespaceResolver; >> import >> org.apache.jackrabbit.spi.commons.nodetype.NodeTypeDefinitionFactory; >> import >> org.apache.jackrabbit.spi.commons.nodetype.QDefinitionBuilderFactory; >> >> import javax.jcr.RepositoryException; >> import javax.jcr.Session; >> import javax.jcr.nodetype.NodeTypeDefinition; >> import javax.jcr.nodetype.NodeTypeIterator; >> import java.io.IOException; >> import java.io.InputStream; >> import java.io.InputStreamReader; >> import java.util.ArrayList; >> import java.util.HashMap; >> import java.util.List; >> import java.util.Map; >> >> public class NodeTypeImporter { >> >> =A0 =A0 public static NodeTypeIterator registerNodeTypesFromCND(Session >> session, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 InputStream >> in, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 boolean >> allowUpdate) >> =A0 =A0 =A0 =A0 =A0 =A0 throws IOException, RepositoryException { >> =A0 =A0 =A0 =A0 Map =A0namespaceMap =3D new HashMap(); >> =A0 =A0 =A0 =A0 List =A0qNTDefs =3D new >> ArrayList(); >> =A0 =A0 =A0 =A0 NamespaceResolver nsResolver =3D new >> SessionNamespaceResolver(session); >> =A0 =A0 =A0 =A0 try { >> =A0 =A0 =A0 =A0 =A0 =A0 NamespaceMapping mapping =3D new NamespaceMappin= g(nsResolver); >> >> =A0 =A0 =A0 =A0 =A0 =A0 CompactNodeTypeDefReader> NamespaceMapping> =A0reader =3D >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 new CompactNodeTypeDefReader> NamespaceMapping>( >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 new InputStreamReader(in), "cnd = input stream", >> mapping, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 new QDefinitionBuilderFactory())= ; >> >> =A0 =A0 =A0 =A0 =A0 =A0 namespaceMap.putAll(mapping.getPrefixToURIMappin= g()); >> =A0 =A0 =A0 =A0 =A0 =A0 for (QNodeTypeDefinition ntDef: >> reader.getNodeTypeDefinitions()) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 qNTDefs.add(ntDef); >> =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 } catch (ParseException e) { >> =A0 =A0 =A0 =A0 =A0 =A0 IOException e2 =3D new IOException(e.getMessage(= )); >> =A0 =A0 =A0 =A0 =A0 =A0 e2.initCause(e); >> =A0 =A0 =A0 =A0 =A0 =A0 throw e2; >> =A0 =A0 =A0 =A0 } >> >> =A0 =A0 =A0 =A0 new NamespaceHelper(session).registerNamespaces(namespac= eMap); >> =A0 =A0 =A0 =A0 List =A0ntDefs =3D >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 new NodeTypeDefinitionFactory(session).c= reate(qNTDefs) ; >> =A0 =A0 =A0 =A0 return >> session.getWorkspace().getNodeTypeManager().registerNodeTypes( >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ntDefs.toArray(new NodeTypeDefinition[nt= Defs.size()]), >> allowUpdate); >> =A0 =A0 } >> } >> >> ////////////////////////////////////////////////////////////////////////= //////// >> >> >> cheers >> stefan >> >>> >>> Steve >>> >>> -----Original Message----- >>> From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] >>> Sent: Friday, March 05, 2010 2:39 AM >>> To: users@jackrabbit.apache.org >>> Subject: Re: NodeType creation >>> >>> On Thu, Mar 4, 2010 at 5:33 PM, Birmingham, Steven >>> =A0wrote: >>>> >>>> Thanks for the input Stefan. =A0I looked up your suggestion and tried >>>> using CndImporter >>> >>> erm, i don't think that i suggested using CndImporter... >>> >>> i suggested using CompactNodeTypeDefReader to generate >>> NodeTypeDefinitions from your >>> cnd-style definitions. those NodeTypeDefinition objects can then be >>> passed on to the >>> JCR 2.0 method NodeTypeManager.registerNodeTypes() which should be >>> available >>> on jcr-rmi and jcr2spi clients. >>> >>> you can find some code here, starting at line 232: >>> >>> >>> http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/= java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?revision= =3D816551&view=3Dmarkup >>> >>> cheers >>> stefan >>> >>>> which threw the exception JCR-2003. Implementation missing. =A0So, are= you >>>> saying the implementation is missing from the StandAlone server but wo= uld be >>>> available from the embedded war file? >>>> >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0InputStream is =3D >>>> getClass().getClassLoader().getResourceAsStream("test.cnd"); >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Reader cnd =3D new InputStreamReader(is= ); >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0NodeType[] nodeTypes =3D CndImporter.re= gisterNodeTypes(cnd, >>>> session); >>>> >>>> Steve >>>> >>>> -----Original Message----- >>>> From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] >>>> Sent: Thursday, March 04, 2010 3:46 AM >>>> To: users@jackrabbit.apache.org >>>> Subject: Re: NodeType creation >>>> >>>> On Thu, Mar 4, 2010 at 12:43 AM, Birmingham, Steven >>>> =A0wrote: >>>>> >>>>> I built and added jackrabbit-core-2.0.0.jar to the build path, but >>>>> JackRabbitNodeTypeManager is still unresolved. =A0Yes, I was trying t= o do an >>>>> evaluation on the standalone server. =A0So, are you saying NodeType m= anagement >>>>> in 2.0 is not available in the standalone server? >>>> >>>> no, that's not what i am saying ;) >>>> >>>> i said that the method for registering node types defined in a CND or >>>> XML format >>>> might not be available on a remote client (such as jcr-rmi or jcr2spi)= . >>>> >>>> said method is specified in the jackrabbit-api, which is an extension >>>> to the jcr api. >>>> the jcr 2.0 api does not provide a method for registering node types >>>> declared in CND >>>> or XML format. it only allows to build and register node type >>>> definitions programmatically, see e.g. >>>> >>>> >>>> http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/nodetype= /NodeTypeManager.html#registerNodeTypes(javax.jcr.nodetype.NodeTypeDefiniti= on[],%20boolean) >>>> >>>> you can use CompactNodeTypeDefReader (jcr-commons) to bridge the gap. >>>> CompactNodeTypeDefReader allows you to parse a CND file returning >>>> NodeTypeDefinitions >>>> which can be registered using the jcr 2.0 api. >>>> >>>> cheers >>>> stefan >>>> >>>>> >>>>> I will download the 2.0 war file and see if things work differently o= n >>>>> Tomcat. =A0I am a little confused as there is documentation on the 2.= 0 website >>>>> for NodeType management but I guess it is incomplete? >>>>> >>>>> Thanks for your help, >>>>> Steve >>>>> >>>>> -----Original Message----- >>>>> From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] >>>>> Sent: Wednesday, March 03, 2010 1:30 PM >>>>> To: users@jackrabbit.apache.org >>>>> Subject: Re: NodeType creation >>>>> >>>>> >>>>> >>>>> On 03.03.2010, at 19:01, "Birmingham, Steven" >>>>> =A0wrote: >>>>> >>>>>> Thanks for the response. >>>>>> >>>>>> JackrabbitNodeTypeManager is not on the class path either. =A0I have >>>>>> all the 2.0 jars on the class path. >>>>>> For jackrabbitNodeTypeManagerImpl I get three implementations on the >>>>>> classpath: >>>>>> //import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeManagerImpl; >>>>>> //import >>>>>> >>>>>> org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit.NodeTypeMan= agerImpl; >>>>>> import >>>>>> >>>>>> org.apache.jackrabbit.ocm.nodemanagement.impl.jeceira.NodeTypeManage= rImpl; >>>>>> >>>>>> Does NodeType registration work for you in 2.0? >>>>>> >>>>> yes >>>>> >>>>> JackrabbitNodeTypeManager is included in jackrabbit-core, which is >>>>> missing from your dependencies list. >>>>> >>>>> are you accessing a stand-alone jackrabbit server? if yes, you might >>>>> be out of luck since the said method is only available on a local, >>>>> i.e. embedded instance. >>>>> >>>>> cheers >>>>> stefan >>>>> >>>>>> Here are my dependencies. >>>>>> >>>>>> =A0 =A0>>>>> conf=3D"compile"/> >>>>>> =A0 =A0 >>>>>> =A0 =A0>>>>> commons" rev=3D"2.0.0" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> rev=3D"2.0.0" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> rev=3D"2.0.0" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> rev=3D"2.0.0" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> rev=3D"2.0.0" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> commons" rev=3D"2.0.0" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> rev=3D"2.0.0" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> server" rev=3D"2.0.0" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> rev=3D"3.0.1" conf=3D"compile"/> >>>>>> =A0 =A0>>>>> conf=3D"compile"/> >>>>>> =A0 =A0>>>>> conf=3D"compile"/> >>>>>> =A0 =A0>>>>> conf=3D"compile"/> >>>>>> =A0 =A0>>>>> conf=3D"compile"/> >>>>>> =A0 =A0>>>>> conf=3D"compile"/> >>>>>> >>>>>> Steve >>>>>> >>>>>> -----Original Message----- >>>>>> From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] >>>>>> Sent: Wednesday, March 03, 2010 10:44 AM >>>>>> To: users@jackrabbit.apache.org >>>>>> Subject: Re: NodeType creation >>>>>> >>>>>> On Wed, Mar 3, 2010 at 5:25 PM, Birmingham, Steven >>>>>> =A0wrote: >>>>>>> >>>>>>> Hello, >>>>>>> >>>>>>> I am trying to read a NodeType configuration from an xml file. =A0T= he >>>>>>> example I used was from the ocm test classes. >>>>>>> >>>>>>> >>>>>>> jackrabbitNodeTypeManagerImpl.createNodeTypesFromConfiguration >>>>>>> (session, >>>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0new File= InputStream("./resources/ >>>>>>> Signal.xml")); >>>>>>> >>>>>>> Exception in thread "main" java.lang.NoClassDefFoundError: org/ >>>>>>> apache/jackrabbit/core/nodetype/xml/NodeTypeReader >>>>>>> >>>>>>> I have jcr-2.0.jar and all the other jackrabbit bundles on the >>>>>>> class path. =A0Am I somehow missing a jar or is this method not >>>>>>> supported anymore or changed? >>>>>> >>>>>> try this: >>>>>> >>>>>> http://jackrabbit.apache.org/api/2.0/org/apache/jackrabbit/api/Jackr= abbitNodeTypeManager.html#registerNodeTypes(java.io.InputStream,%20java.lan= g.String) >>>>>> >>>>>> e.g. >>>>>> >>>>>> ((JackrabbitNodeTypeManager) >>>>>> session.getNodeTypeManager()).registerNodeTypes(new >>>>>> FileInputStream("./resources/Signal.xml"), >>>>>> JackrabbitNodeTypeManager.TEXT_XML); >>>>>> >>>>>> cheers >>>>>> stefan >>>>>>> >>>>>>> Thanks, >>>>>>> Steve >>>>>>> >>>>>>> ________________________________ >>>>>>> This e-mail and any files transmitted with it may be proprietary >>>>>>> and are intended solely for the use of the individual or entity to >>>>>>> whom they are addressed. If you have received this e-mail in error >>>>>>> please notify the sender. >>>>>>> Please note that any views or opinions presented in this e-mail are >>>>>>> solely those of the author and do not necessarily represent those >>>>>>> of ITT Corporation. The recipient should check this e-mail and any >>>>>>> attachments for the presence of viruses. ITT accepts no liability >>>>>>> for any damage caused by any virus transmitted by this e-mail. >>>>>>> >>>>> >>>> >>> >