code: @Override
      public NodeType registerNodeType( NodeTypeDefinition template,
                                        boolean allowUpdate )
          throws InvalidNodeTypeDefinitionException, NodeTypeExistsException, AccessDeniedException, RepositoryException {
  
          session.checkLive();
          try {
              session.checkWorkspacePermission(session.workspaceName(), ModeShapePermissions.REGISTER_TYPE);
          } catch (AccessControlException ace) {
              throw new AccessDeniedException(ace);
          }
          JcrNodeType jcrNodeType = this.repositoryTypeManager.registerNodeType(template, !allowUpdate);
          this.schemata = null; //clear the cached schemata to make sure it is reloaded
          return jcrNodeType;
      }
docs: Registers a new node type or updates an existing node type using the specified definition and returns the resulting
  {@link NodeType} object.
  <p>
  Typically, the object passed to this method will be a {@link NodeTypeTemplate} (a subclass of {@link NodeTypeDefinition})
  acquired from {@link JcrNodeTypeManager#createNodeTypeTemplate()} and then filled-in with definition information.
  </p>
  
  @param template the new node type to register
  @param allowUpdate this flag is not used
  @return the {@code newly created node type}
  @throws InvalidNodeTypeDefinitionException if the {@code NodeTypeDefinition} is invalid
  @throws NodeTypeExistsException if {@code allowUpdate} is false and the {@code NodeTypeDefinition} 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