incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi goel <Ruchi.G...@Sun.COM>
Subject Re: dtd for custom_nodetypes.xml
Date Mon, 26 Feb 2007 08:28:34 GMT
Jukka Zitting wrote:
> Hi,
>
> On 2/23/07, ruchi goel <Ruchi.Goel@sun.com> wrote:
>> Is this not a standard way to register nodetypes ?
>
> No. You want to use the JackrabbitNodeTypeManager interface from the
> jackrabbit-api API library. Like this:
>
>    InputStream xml = new FileInputStream(CUSTOM_NODETYPE_CONFIG);
>
>    Session session = ...;
>    JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
>        session.getWorkspace().getNodeTypeManager();
>    manager.registerNodeTypes(xml, JackrabbitNodeTypeManager.TEXT_XML);
>
> The JackrabbitNodeTypeManager.registerNodeTypes() handles all the
> required parsing and other details.
OK.  But if you want to check if a nodetype is already registered, ( and 
reregister or do not register depending on your requirement) , you still 
need to iterate and register nodes one by one.So, what s the advantage 
of     manager.registerNodeTypes(xml, 
JackrabbitNodeTypeManager.TEXT_XML);   as opposed to 
ntReg.registerNodeType(def);
I understand that manager.registerNodeTypes(xml, 
JackrabbitNodeTypeManager.TEXT_XML);   can register in one shot , but 
may be it is a good idea to use it at the end of development , when you 
know you will not be registering or reregistering the nodes again and again.

Thanks,
Ruchi
>
> You can also use the JackrabbitNodeTypeManager.hasNodeType() method to
> check whether a given node type has already been registered.
>
But what
> BR,
>
> Jukka Zitting


Mime
View raw message