private void checkExtensionName(Map<String, StackModule> allStacks)
      throws AmbariException {

    String name = extensionInfo.getName();
    for (StackModule stack : allStacks.values()) {
      String stackName = stack.getModuleInfo().getName();
      if (name.equals(stackName)) {
        throw new AmbariException("The extension '" + name + "' has a name which matches a stack name");
      }
    }
  }
@param allStacks        all stacks specified in the stack definition

@throws AmbariException if the extension name is the same as any of the stacks
ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionModule.java