@SuppressWarnings("unchecked")
  @Override
  public void initializeWidgetsAndLayouts(Cluster cluster, Service service) throws AmbariException {
    Type widgetLayoutType = new TypeToken<Map<String, List<WidgetLayout>>>(){}.getType();

    Set<File> widgetDescriptorFiles = new HashSet<>();

    if (null != service) {
      ServiceInfo serviceInfo = ambariMetaInfo.getService(service);
      File widgetDescriptorFile = serviceInfo.getWidgetsDescriptorFile();
      if (widgetDescriptorFile != null && widgetDescriptorFile.exists()) {
        widgetDescriptorFiles.add(widgetDescriptorFile);
      }
    } else {
      // common cluster level widgets
      File commonWidgetsFile = ambariMetaInfo.getCommonWidgetsDescriptorFile();
      if (commonWidgetsFile != null && commonWidgetsFile.exists()) {
        widgetDescriptorFiles.add(commonWidgetsFile);
      } else {
        LOG.warn("Common widgets file with path {%s} doesn't exist. No cluster widgets will be created.", commonWidgetsFile);
      }
    }

    for (File widgetDescriptorFile : widgetDescriptorFiles) {
      Map<String, Object> widgetDescriptor = null;

      try {
        widgetDescriptor = gson.fromJson(new FileReader(widgetDescriptorFile), widgetLayoutType);

        for (Object artifact : widgetDescriptor.values()) {
          List<WidgetLayout> widgetLayouts = (List<WidgetLayout>) artifact;
          createWidgetsAndLayouts(cluster, widgetLayouts);
        }

      } catch (Exception ex) {
        String msg = "Error loading widgets from file: " + widgetDescriptorFile;
        LOG.error(msg, ex);
        throw new AmbariException(msg);
      }
    }
  }
Verifies single repository, see {{@link #verifyRepositories(Set)}.

@param request request
@throws AmbariException if verification fails
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java