private Map<String, Object> getWidgetsDescriptor(String stackName,
      String stackVersion, String serviceName)
        throws NoSuchParentResourceException, IOException {

    AmbariManagementController controller = getManagementController();
    StackInfo stackInfo;
    try {
      stackInfo = controller.getAmbariMetaInfo().getStack(stackName, stackVersion);
    } catch (StackAccessException e) {
      throw new NoSuchParentResourceException(String.format(
        "Parent stack resource doesn't exist: stackName='%s', stackVersion='%s'", stackName, stackVersion));
    }

    if (StringUtils.isEmpty(serviceName)) {
      return null;
    } else {
      return getWidgetsDescriptorForService(stackInfo, serviceName);
    }
  }
Get all stack and stack service metrics descriptor resources.

@param request    user request
@param predicate  request predicate

@return set of all stack related kerberos descriptor resources; will not return null

@throws SystemException                if an unexpected exception occurs
@throws UnsupportedPropertyException   if an unsupported property was requested
@throws NoSuchParentResourceException  if a specified parent resource doesn't exist
@throws NoSuchResourceException        if the requested resource doesn't exist
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java