public Map<String, Object> getWidgetsDescriptorForService(StackInfo stackInfo, String serviceName)
      throws NoSuchParentResourceException, IOException {

    Map<String, Object> widgetDescriptor = null;

    ServiceInfo serviceInfo = stackInfo.getService(serviceName);
    if (serviceInfo == null) {
      throw new NoSuchParentResourceException("Service not found. serviceName" + " = " + serviceName);
    }

    File widgetDescriptorFile = serviceInfo.getWidgetsDescriptorFile();
    if (widgetDescriptorFile != null && widgetDescriptorFile.exists()) {
      widgetDescriptor = gson.fromJson(new FileReader(widgetDescriptorFile), widgetLayoutType);
    }

    return widgetDescriptor;
  }
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