private void mergeServicesWithParent(
      ExtensionModule parentExtension, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions)
      throws AmbariException {
    extensionInfo.getServices().clear();

    LOG.info("***Merging extension services with parent: " + parentExtension.getId());

    Collection<ServiceModule> mergedModules = mergeChildModules(
        allStacks, commonServices, extensions, serviceModules, parentExtension.serviceModules);
    for (ServiceModule module : mergedModules) {
      if(!module.isDeleted()){
        serviceModules.put(module.getId(), module);
        extensionInfo.getServices().add(module.getModuleInfo());
      }
    }
  }
Merge child services with parent extension.

@param parentExtension    parent extension module
@param allStacks          all stacks in stack definition
@param commonServices     all common services
@param extensions         all extensions

@throws AmbariException if an exception occurs merging the child services with the parent extension
ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionModule.java