You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Patrick Plaatje <pa...@ipros.nl> on 2009/02/13 08:27:58 UTC

Create nodetype through API

Hi all,

i'm very new to Jackrabbit, and working myslef through the posiiblities of
it. I came across the part on nodetypes and learned that nodetypes can be
created by making a XML file of a CND file, and feed that to
nodeTypeManager. All fine, but i didn't come across any class that could
create this nodetpye programmatically. Is there an class which does this
or is there a reason for it that it doesn't exist?

Best,

Patrick


GlobalNamingResources JNDI

Posted by Kurz Wolfgang <wo...@gwvs.de>.
In the Webapplication it saysd the following:

<quote>
By default the repository is only made available in a dummy JNDI directory local to this web application. However, you can make the repository globally available if your servlet container allows a web application to modify the global JNDI directory or you are using some other JNDI directory that can manage unserializable Java objects.

To bind the the repository to such a JNDI directory, you need to modify the java.naming parameters in either the /WEB-INF/web.xml deployment descriptor or the jackrabbit/bootstrap.properties file. You need to redeploy this web application to activate the changes.
</quote>

What I read from that is that if I want a second webapplication on the same tomcatserver to access jackrabbit thought JNDI I have to alter the settings of either the bootstrap file or the webapplications web.xml file.

The problem is that I have been searching for hours now on how to make it globally available and haven't found one thing.

As it says I have to set the java.naming parameters but I have no clue what to set them to.

Anyone have an idea on what I have to do to make it globally available?

Thx a lot




Re: Create nodetype through API

Posted by Stefan Guggisberg <st...@gmail.com>.
hi patrick

On Fri, Feb 13, 2009 at 8:27 AM, Patrick Plaatje <pa...@ipros.nl> wrote:
> Hi all,
>
> i'm very new to Jackrabbit, and working myslef through the posiiblities of
> it. I came across the part on nodetypes and learned that nodetypes can be
> created by making a XML file of a CND file, and feed that to
> nodeTypeManager. All fine, but i didn't come across any class that could
> create this nodetpye programmatically. Is there an class which does this
> or is there a reason for it that it doesn't exist?

node type creation is not covered by jcr 1.0. jcr 2.0 (jsr 283) will however
include an api for programmatic node type creation. the node type management
api is not finalized yet but there's already an experimental implementation
available in jackrabbit.

for more information please see

http://issues.apache.org/jira/browse/JCR-1586
http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/api/jsr283/nodetype/package-summary.html
http://jackrabbit.apache.org/api/1.4/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.html

sample code:

NodeTypeManagerImpl ntMgr =
        (NodeTypeManagerImpl) session.getWorkspace().getNodeTypeManager();
NodeTypeTemplate t = ntMgr.createNodeTypeTemplate();
[...]
NodeType newNodeType = ntMgr.registerNodeType(t, false);

cheers
stefan

>
> Best,
>
> Patrick
>
>

Re: Create nodetype through API

Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Feb 13, 2009 at 8:27 AM, Patrick Plaatje <pa...@ipros.nl> wrote:
> i'm very new to Jackrabbit, and working myslef through the posiiblities of
> it. I came across the part on nodetypes and learned that nodetypes can be
> created by making a XML file of a CND file, and feed that to
> nodeTypeManager. All fine, but i didn't come across any class that could
> create this nodetpye programmatically. Is there an class which does this
> or is there a reason for it that it doesn't exist?

You don't have to convert CND into the XML node type format. The
JackrabbitNodeTypeManager can accept both. See the node type
documentation on the website:
http://jackrabbit.apache.org/node-types.html (code is at the bottom).

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com