If you want to replace the existing node type definition, you should
pass ExtendedNodeTypeManager.REPLACE_IF_EXISTS
as a second parameter for
the ExtendedNodeTypeManager.registerNodeType
method.
ExtendedNodeTypeManager nodeTypeManager = (ExtendedNodeTypeManager) session.getWorkspace()
.getNodeTypeManager();
InputStream is = MyClass.class.getResourceAsStream("mynodetypes.xml");
.....
nodeTypeManager.registerNodeTypes(is,ExtendedNodeTypeManager.REPLACE_IF_EXISTS );
Node type is possible to remove only when the repository does not contain nodes of this type.
nodeTypeManager.unregisterNodeType("myNodeType");