jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sriraj paul <srirajp...@yahoo.co.uk>
Subject Re: Creating a new node Type
Date Fri, 03 Sep 2010 13:04:24 GMT
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 <justinedelson@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 <justinedelson@gmail.com>
> To: "users@jackrabbit.apache.org" <users@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 <srirajpaul@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);
>>
>>
> 
> 
> 
>      


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