private void resolveExtension(
          ExtensionModule extension, Map<String, StackModule> allStacks, Map<String, ServiceModule> commonServices, Map<String, ExtensionModule> extensions)
          throws AmbariException {
    if (extension.getModuleState() == ModuleState.INIT) {
	  extension.resolve(null, allStacks, commonServices, extensions);
    } else if (extension.getModuleState() == ModuleState.VISITED) {
      //todo: provide more information to user about cycle
      throw new AmbariException("Cycle detected while parsing extension definition");
    }
    if (!extension.isValid() || (extension.getModuleInfo() != null && !extension.getModuleInfo().isValid())) {
      setValid(false);
      addError("Stack includes an invalid extension: " + extension.getModuleInfo().getName());
    }
  }
Resolve an extension module.

@param extension              extension module to be resolved
@param allStacks              all stack modules in stack definition
@param commonServices         all common services
@param extensions             all extensions
@throws AmbariException if unable to resolve the stack
ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java