コード例 #1
0
  /** Merge theme modules. */
  private void mergeThemes(
      ServiceModule parent,
      Map<String, StackModule> allStacks,
      Map<String, ServiceModule> commonServices)
      throws AmbariException {
    Collection<ThemeModule> mergedModules =
        mergeChildModules(allStacks, commonServices, themeModules, parent.themeModules);

    for (ThemeModule mergedModule : mergedModules) {
      themeModules.put(mergedModule.getId(), mergedModule);
      ThemeInfo moduleInfo = mergedModule.getModuleInfo();
      if (!moduleInfo.isDeleted()) {
        serviceInfo.getThemesMap().put(moduleInfo.getFileName(), moduleInfo);
      } else {
        serviceInfo.getThemesMap().remove(moduleInfo.getFileName());
      }
    }
  }
コード例 #2
0
  private void populateThemeModules() {

    if (serviceInfo.getThemesDir() == null) {
      serviceInfo.setThemesDir(AmbariMetaInfo.SERVICE_THEMES_FOLDER_NAME);
    }

    String themesDir =
        serviceDirectory.getAbsolutePath() + File.separator + serviceInfo.getThemesDir();

    if (serviceInfo.getThemes() != null) {
      for (ThemeInfo themeInfo : serviceInfo.getThemes()) {
        File themeFile = new File(themesDir + File.separator + themeInfo.getFileName());
        ThemeModule module = new ThemeModule(themeFile, themeInfo);
        themeModules.put(module.getId(), module);
      }
    }

    // lets not fail if theme contain errors
  }