code: public NodeTypeIterator registerNodeTypes( Collection<NodeTypeDefinition> templates,
                                                 boolean allowUpdates )
          throws InvalidNodeTypeDefinitionException, NodeTypeExistsException, AccessDeniedException, RepositoryException {
  
          session.checkLive();
          try {
              session.checkWorkspacePermission(session.workspaceName(), ModeShapePermissions.REGISTER_TYPE);
          } catch (AccessControlException ace) {
              throw new AccessDeniedException(ace);
          }
          List<JcrNodeType> jcrNodeTypes = repositoryTypeManager.registerNodeTypes(templates, !allowUpdates, false, true);
          this.schemata = null; //clear the cached schemata to make sure it is reloaded
          return new JcrNodeTypeIterator(jcrNodeTypes);
      }
docs: Registers or updates the specified Collection of {@code NodeTypeDefinition} objects. This method is used to register or
  update a set of node types with mutual dependencies. Returns an iterator over the resulting {@code NodeType} objects.
  <p>
  The effect of the method is "all or nothing"; if an error occurs, no node types are registered or updated.
  </p>
  
  @param templates the new node types to register
  @param allowUpdates this flag is not used
  @return the {@code newly created node types}
  @throws InvalidNodeTypeDefinitionException if a {@code NodeTypeDefinition} within the collection is invalid
  @throws NodeTypeExistsException if {@code allowUpdate} is false and a {@code NodeTypeDefinition} within the collection
  specifies a node type name that already exists
  @throws AccessDeniedException if the current session does not have the {@link ModeShapePermissions#REGISTER_TYPE register
  type permission}.
  @throws RepositoryException if another error occurs