private void mergeServiceWithCommonServiceParent(
      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 != 3 || !parentToks[0].equalsIgnoreCase(StackManager.COMMON_SERVICES)) {
      throw new AmbariException("The service '" + serviceInfo.getName() + "' in extension '" + extensionInfo.getName() + ":"
          + extensionInfo.getVersion() + "' extends an invalid parent: '" + parent + "'");
    }

    String baseServiceKey = parentToks[1] + StackManager.PATH_DELIMITER + parentToks[2];
    ServiceModule baseService = commonServices.get(baseServiceKey);
    if (baseService == null) {
      setValid(false);
      extensionInfo.setValid(false);
      String error = "The service '" + serviceInfo.getName() + "' in extension '" + extensionInfo.getName() + ":"
          + extensionInfo.getVersion() + "' extends a non-existent service: '" + parent + "'";
      addError(error);
      extensionInfo.addError(error);
    } else {
      if (baseService.isValid()) {
        service.resolveExplicit(baseService, allStacks, commonServices, extensions);
      } else {
        setValid(false);
        extensionInfo.setValid(false);
        addErrors(baseService.getErrors());
        extensionInfo.addErrors(baseService.getErrors());
      }
    }
  }
Merge a service with its explicitly specified common service as parent.
Parent: common-services/<serviceName>/<serviceVersion>
Common Services Lookup Key: <serviceName>/<serviceVersion>
Example:
 Parent: common-services/HDFS/2.1.0.2.0
 Key: HDFS/2.1.0.2.0

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