jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sriraj paul <srirajp...@yahoo.co.uk>
Subject Creating a new node Type
Date Thu, 02 Sep 2010 09:36:04 GMT
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);


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message