You can only create new node types by accessing the repository in-process, not by RMI or WebDAV.
Justin On Sep 2, 2010, at 5:36 AM, sriraj paul <[email protected]> wrote: > Hello , > > I want to create a new node type derived from nt:file , such that it allows > to > add a new node inside it other than "jcr:content" node. > > For that i tried the following code > > Repository repository = JcrUtils.getRepository( session = repository.login( > Workspace ws = session.getWorkspace(); > NodeTypeManager nodeTypeManager=ws.getNodeTypeManager(); > NodeTypeTemplate ndt=nodeTypeManager.createNodeTypeTemplate(); > String [] str={"nt:file"}; > ndt.setName("myfile"); > ndt.setDeclaredSuperTypeNames(str); > nodeTypeManager.registerNodeType(ndt, false); > > > The function call createNodeTypeTemplate(); is giving the exception > Exceptionin > thread "main" javax.jcr.UnsupportedRepositoryOperationException: TODO: > JCRRMI-26at > org.apache.jackrabbit.rmi.client.ClientNodeTypeManager.createNodeTypeTemplate( > at Test.main(ClientNodeTypeManager.java:104)Test.java:305) > > I am using jackrabbit-standalone-2.1.1.jar got from > http://jackrabbit.apache.org/downloads.html as the jcr client library. Is > there > some jcr client library that implements all the jcr api's. > > I also tried > InputStream is= > Reader cnd = > NodeType[] nodeTypes = > CndImporter.registerNodeTypes(cnd,session);newFileInputStream("C:\\file.cnd");newInputStreamReader(is); > > > This is also giving exception on the function call > CndImporter.registerNodeTypes(cnd,session).Exceptionin thread "main" > org.apache.jackrabbit.commons.cnd.ParseException: > javax.jcr.UnsupportedRepositoryOperationException: TODO: JCRRMI-26 (cnd input > stream, line 1)at org.apache.jackrabbit.commons.cnd.Lexer.fail( > at org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.parse( > at org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>( > at org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>( > at org.apache.jackrabbit.commons.cnd.CndImporter.registerNodeTypes( > at org.apache.jackrabbit.commons.cnd.CndImporter.registerNodeTypes( > at Test.main( > > File.cnd contains only one line > [myfile] > nt:file > > Is there any client library that implements all jcr api's and how to create a > new node type? > > Thank you > SrirajLexer.java:228)CompactNodeTypeDefReader.java:219)CompactNodeTypeDefReader.java:164)CompactNodeTypeDefReader.java:140)CndImporter.java:111)CndImporter.java:74)Test.java:316)newSimpleCredentials("admin", > "admin".toCharArray()),null);http://localhost:8079/rmi); > >
