code: public void unregisterNodeTypes( Collection<String> nodeTypeNames )
          throws NoSuchNodeTypeException, InvalidNodeTypeDefinitionException, RepositoryException {
          NameFactory nameFactory = context().getValueFactories().getNameFactory();
  
          try {
              session.checkWorkspacePermission(session.workspaceName(), ModeShapePermissions.REGISTER_TYPE);
          } catch (AccessControlException ace) {
              throw new AccessDeniedException(ace);
          }
  
          Collection<Name> names = new ArrayList<Name>(nodeTypeNames.size());
          for (String name : nodeTypeNames) {
              names.add(nameFactory.create(name));
          }
  
          // Unregister the node types, but perform a check to see if any of the node types are currently being used.
          // Unregistering a node type that is being used will likely cause the system to become unstable.
          boolean failIfNodeTypesAreUsed = true;
          repositoryTypeManager.unregisterNodeType(names, failIfNodeTypesAreUsed);
          this.schemata = null; //clear the cached schemata to make sure it is reloaded
      }
docs: Allows the collection of node types to be unregistered if they are not referenced by other node types as supertypes,
  default primary types of child nodes, or required primary types of child nodes.
  
  @param nodeTypeNames the names of the node types to be unregistered
  @throws NoSuchNodeTypeException if any of the node type names do not correspond to a registered node type
  @throws InvalidNodeTypeDefinitionException if any of the node types with the given names cannot be unregistered because
  they are the supertype, one of the required primary types, or a default primary type of a node type that is not
  being unregistered.
  @throws AccessDeniedException if the current session does not have the {@link ModeShapePermissions#REGISTER_TYPE register
  type permission}.
  @throws RepositoryException if any other error occurs