jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "hsp" <piccina...@ibest.com.br>
Subject Listing of node types registered
Date Wed, 19 Apr 2006 21:13:38 GMT
Hi;
I am trying to register some custom node types in Jackrabbit, but when I try to create some
node of some kind of node type I have registered (I think of) occurs an error saying that
the node type doesn't exists, but the namespace have been registered because it is showing
resolved.
I am trying to register the custom node types by an custom_nodetypes.xml file. If you prefer
I can send this file. It seems ok, without sintax error.
The piece of code that register it is like:
        try {
        		FileInputStream is=new FileInputStream(NODETYPES_RESOURCE);
                if (is != null) {
                    try {
                        NodeTypeReader ntReader = new NodeTypeReader(is);
                        registerNamespaces(ntReader.getNamespaces(), session);

                        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
                        NodeTypeDef[] nodeTypes = ntReader.getNodeTypeDefs();
                        List unregisteredNTs = new ArrayList();
                        for (int i = 0; i < nodeTypes.length; i++) {
                            try {
                                ntMgr.getNodeType(nodeTypes[i].getName());
                            } catch (NoSuchNodeTypeException e) {
                                // register the node type
                                unregisteredNTs.add(nodeTypes[i]);
                            }
                        }
                        ntMgr.getNodeTypeRegistry().registerNodeTypes(unregisteredNTs);
                    } catch (BaseException e) {
                        throw new RepositoryException(e.getMessage());
                    } catch (IOException e) {
                        throw new RepositoryException(e.getMessage());
                    } finally {
                        try {
                            is.close();
                        } catch (IOException e1) {
                            // ignore
                        }
                    }
                }
	
		} catch (Exception e) {
				// TODO: handle exception
		}
       }

Mime
View raw message