Re: dtd for custom_nodetypes.xml

2007-02-26 Thread ruchi goel

Jukka Zitting wrote:

Hi,

On 2/23/07, ruchi goel [EMAIL PROTECTED] 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




Re: dtd for custom_nodetypes.xml

2007-02-26 Thread Jukka Zitting

Hi,

On 2/26/07, ruchi goel [EMAIL PROTECTED] wrote:

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.


You could achieve the same effect by putting each additional node type
(or set of them) in a new node type definition file. But you're right,
the JackrabbitNodeTypeManager interface is (intentionally) not as
powerful as the underlying NodeTypeManagerImpl and NodeTypeRegistry
classes.

The problem with your approach is that it requires explicit care from
the node type definition writer to put the definitions in such an
order that any dependencies between types are correctly ordered and
that there are no circular dependencies.

Another problem is that there are no guarantees that the internal
methods (or their semantics) remain the same across Jackrabbit
releases, as we only guarantee backwards compatibility for the JCR API
and the extension interfaces defined in jackrabbit-api.

More generally, the node type management support in Jackrabbit is
still quite limited, i.e. you're restricted to just adding new types
and making only trivial changes to existing types. Thus, during
development I generally recreate the entire test repository when I
need to make changes to my node type definitions. Obviously this is a
poor solution when you need to upgrade production repositories. :-(

BR,

Jukka Zitting


Re: dtd for custom_nodetypes.xml

2007-02-23 Thread ruchi goel

I am using the following to register node types from RMIserver:
*private static void registerNodeTypes(Session session)throws
   InvalidNodeTypeDefException, javax.jcr.RepositoryException, 
IOException {

   InputStream xml = new FileInputStream(CUSTOM_NODETYPE_CONFIG);

   // HINT: throws InvalidNodeTypeDefException, IOException
   NodeTypeDef[] types = NodeTypeReader.read(xml);

   Workspace workspace = session.getWorkspace();
   NodeTypeManager ntMgr = workspace.getNodeTypeManager();
   NodeTypeRegistry ntReg = ((NodeTypeManagerImpl) 
ntMgr).getNodeTypeRegistry();


   for (int j = 0; j  types.length; j++) {
   NodeTypeDef def = types[j];

   try {
   ntReg.getNodeTypeDef(def.getName());
   }
   catch (NoSuchNodeTypeException nsne) {
   // HINT: if not already registered than register custom 
node type

   ntReg.registerNodeType(def);
   }

   }
   }


*where CUSTOM_NODETYPE_CONFIG  is custom_nodetypes.xml
Is this not a standard way to register nodetypes ? This is only 
dependent o Jackrabbit1.2 API !!



Thanks,
Ruchi
Christophe Lombart wrote:

If you want to register new node type, I advise you to read the following
page : http://jackrabbit.apache.org/doc/nodetype/index.html.
We are using the custom_nodestypes.xml only for the unit test. Later, we
have to think about a more robust solution to register node types from 
the
ocm tools. Anyway, I didn't find  the dtd but it is quite simple to 
use it -

sorry



On 2/22/07, ruchi goel [EMAIL PROTECTED] wrote:


Hi,
   Where  can I finddtd for   custom_nodetypes.xml  used  for
registering   custom nodetypes ?

Thanks,
Ruchi







Re: dtd for custom_nodetypes.xml

2007-02-23 Thread Christophe Lombart

On 2/23/07, ruchi goel [EMAIL PROTECTED] wrote:




*where CUSTOM_NODETYPE_CONFIG  is custom_nodetypes.xml
Is this not a standard way to register nodetypes ? This is only
dependent o Jackrabbit1.2 API !!



Following JCR-170, there is not a standard way to register node types.
I think this point will be in the JCR-283.


dtd for custom_nodetypes.xml

2007-02-22 Thread ruchi goel

Hi,
  Where  can I finddtd for   custom_nodetypes.xml  used  for 
registering   custom nodetypes ?


Thanks,
Ruchi


Re: dtd for custom_nodetypes.xml

2007-02-22 Thread Christophe Lombart

If you want to register new node type, I advise you to read the following
page : http://jackrabbit.apache.org/doc/nodetype/index.html.
We are using the custom_nodestypes.xml only for the unit test. Later, we
have to think about a more robust solution to register node types from the
ocm tools. Anyway, I didn't find  the dtd but it is quite simple to use it -
sorry



On 2/22/07, ruchi goel [EMAIL PROTECTED] wrote:


Hi,
   Where  can I finddtd for   custom_nodetypes.xml  used  for
registering   custom nodetypes ?

Thanks,
Ruchi