You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by sriraj paul <sr...@yahoo.co.uk> on 2010/09/02 11:36:04 UTC

Creating a new node Type

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);


      

Re: Creating a new node Type

Posted by Justin Edelson <ju...@gmail.com>.
On 9/3/10 9:04 AM, sriraj paul wrote:
> What is th jndi URL for jackrabbit?
I believe this is something you configure at deployment time. For
example, see http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss

>> You can only create new node types by accessing the repository in-process, not 
> 
>> by RMI or WebDAV. 
> Is it like creating new node types using RMI or WebDAV will be implemented later 
> or it is only allowed in-process by specification?
I'm not aware on any prohibition on supporting node type registration
remotely. I'm sure if you provided a patch (especially for DavEx) it
would be appreciated.

Justin

> 
> 
> 
> 
> 
> ________________________________
> From: Justin Edelson <ju...@gmail.com>
> To: users@jackrabbit.apache.org
> Sent: Thu, September 2, 2010 8:39:19 PM
> Subject: Re: Creating a new node Type
> 
> You should use JcrUtils.getRepository("file:///path/to/repository")
> 
> This will find any repository implementation which has RepositoryFactory
> service implementation.
> 
> You could also use JNDI by passing a JNDI url to getRepository().
> 
> HTH,
> Justin
> 
> On 9/2/10 10:58 AM, sriraj paul wrote:
>> I tried to connect to repository using  
>> Repository repository = new TransientRepository(new 
>> File("C:\\jackrabbit\\jackrabbit"));
>> and creating a new node type worked  for jackrabbit server.
>>   
>> What if i want to do the same for any jcr compliant repositories?
>>   
>> Thank you
>> Sriraj
>>
>>
>>
>>
>> ________________________________
>> From: Justin Edelson <ju...@gmail.com>
>> To: "users@jackrabbit.apache.org" <us...@jackrabbit.apache.org>
>> Sent: Thu, September 2, 2010 5:03:13 PM
>> Subject: Re: Creating a new node Type
>>
>> 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 <sr...@yahoo.co.uk> 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);
>>>
>>>
>>
>>
>>
>>       
> 
> 
>       


Re: Creating a new node Type

Posted by sriraj paul <sr...@yahoo.co.uk>.
What is th jndi URL for jackrabbit?
> You can only create new node types by accessing the repository in-process, not 

> by RMI or WebDAV. 
Is it like creating new node types using RMI or WebDAV will be implemented later 
or it is only allowed in-process by specification?





________________________________
From: Justin Edelson <ju...@gmail.com>
To: users@jackrabbit.apache.org
Sent: Thu, September 2, 2010 8:39:19 PM
Subject: Re: Creating a new node Type

You should use JcrUtils.getRepository("file:///path/to/repository")

This will find any repository implementation which has RepositoryFactory
service implementation.

You could also use JNDI by passing a JNDI url to getRepository().

HTH,
Justin

On 9/2/10 10:58 AM, sriraj paul wrote:
> I tried to connect to repository using  
> Repository repository = new TransientRepository(new 
> File("C:\\jackrabbit\\jackrabbit"));
> and creating a new node type worked  for jackrabbit server.
>  
> What if i want to do the same for any jcr compliant repositories?
>  
> Thank you
> Sriraj
> 
> 
> 
> 
> ________________________________
> From: Justin Edelson <ju...@gmail.com>
> To: "users@jackrabbit.apache.org" <us...@jackrabbit.apache.org>
> Sent: Thu, September 2, 2010 5:03:13 PM
> Subject: Re: Creating a new node Type
> 
> 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 <sr...@yahoo.co.uk> 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);
>>
>>
> 
> 
> 
>      


      

Re: Creating a new node Type

Posted by Justin Edelson <ju...@gmail.com>.
You should use JcrUtils.getRepository("file:///path/to/repository")

This will find any repository implementation which has RepositoryFactory
service implementation.

You could also use JNDI by passing a JNDI url to getRepository().

HTH,
Justin

On 9/2/10 10:58 AM, sriraj paul wrote:
> I tried to connect to repository using  
> Repository repository = new TransientRepository(new 
> File("C:\\jackrabbit\\jackrabbit"));
> and creating a new node type worked  for jackrabbit server.
>  
> What if i want to do the same for any jcr compliant repositories?
>  
> Thank you
> Sriraj
> 
> 
> 
> 
> ________________________________
> From: Justin Edelson <ju...@gmail.com>
> To: "users@jackrabbit.apache.org" <us...@jackrabbit.apache.org>
> Sent: Thu, September 2, 2010 5:03:13 PM
> Subject: Re: Creating a new node Type
> 
> 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 <sr...@yahoo.co.uk> 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);
>>
>>
> 
> 
> 
>       


Re: Creating a new node Type

Posted by sriraj paul <sr...@yahoo.co.uk>.
I tried to connect to repository using  
Repository repository = new TransientRepository(new 
File("C:\\jackrabbit\\jackrabbit"));
and creating a new node type worked  for jackrabbit server.
 
What if i want to do the same for any jcr compliant repositories?
 
Thank you
Sriraj




________________________________
From: Justin Edelson <ju...@gmail.com>
To: "users@jackrabbit.apache.org" <us...@jackrabbit.apache.org>
Sent: Thu, September 2, 2010 5:03:13 PM
Subject: Re: Creating a new node Type

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 <sr...@yahoo.co.uk> 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);
> 
> 



      

Re: Creating a new node Type

Posted by Justin Edelson <ju...@gmail.com>.
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 <sr...@yahoo.co.uk> 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);
> 
>