private void mergeServiceWithExtensionServiceParent(
      ServiceModule service, String parent, Map<String, StackModule> allStacks,
      Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions)
      throws AmbariException {
    ServiceInfo serviceInfo = service.getModuleInfo();
    String[] parentToks = parent.split(StackManager.PATH_DELIMITER);
    if(parentToks.length != 4 || !parentToks[0].equalsIgnoreCase(StackManager.EXTENSIONS)) {
      throw new AmbariException("The service '" + serviceInfo.getName() + "' in stack '" + stackInfo.getName() + ":"
          + stackInfo.getVersion() + "' extends an invalid parent: '" + parent + "'");
    }

    String extensionKey = parentToks[1] + StackManager.PATH_DELIMITER + parentToks[2];
    ExtensionModule extension = extensions.get(extensionKey);

    if (extension == null || !extension.isValid()) {
      setValid(false);
      addError("The service '" + serviceInfo.getName() + "' in stack '" + stackInfo.getName() + ":"
          + stackInfo.getVersion() + "' extends a non-existent service: '" + parent + "'");
    } else {
      resolveExtension(extension, allStacks, commonServices, extensions);
      ServiceModule parentService = extension.getServiceModules().get(parentToks[3]);
      if (parentService == null || !parentService.isValid()) {
        setValid(false);
        addError("The service '" + serviceInfo.getName() + "' in stack '" + stackInfo.getName() + ":"
            + stackInfo.getVersion() + "' extends a non-existent service: '" + parent + "'");
      } else {
        service.resolve(parentService, allStacks, commonServices, extensions);
      }
    }
  }
Merge a service with its explicitly specified extension service as parent.
Parent: extensions/<extensionName>/<extensionVersion>/<serviceName>
Example:
 Parent: extensions/EXT_TEST/1.0/CUSTOM_SERVICE

@param service          the service to merge
@param parent           the explicitly specified extension as parent
@param allStacks        all stacks specified in the stack definition
@param commonServices   all common services
@param extensions       all extensions
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java