private void readViewArchives(boolean systemOnly, boolean useExecutor,
                                String viewNameRegExp) {
    try {

      File viewDir = configuration.getViewsDir();
      String extractedArchivesPath = viewDir.getAbsolutePath() +
          File.separator + EXTRACTED_ARCHIVES_DIR;

      if (extractor.ensureExtractedArchiveDirectory(extractedArchivesPath)) {

        File[] files = viewDir.listFiles();

        if (files != null) {

          Set<Runnable> extractionRunnables = new HashSet<>();

          final String serverVersion = ambariMetaInfoProvider.get().getServerVersion();

          for (final File archiveFile : files) {
            if (!archiveFile.isDirectory()) {

              try {
                final ViewConfig viewConfig = archiveUtility.getViewConfigFromArchive(archiveFile);

                String commonName = viewConfig.getName();
                String version = viewConfig.getVersion();
                String viewName = ViewEntity.getViewName(commonName, version);

                if (!viewName.matches(viewNameRegExp)) {
                  continue;
                }

                final String extractedArchiveDirPath = extractedArchivesPath + File.separator + viewName;
                final File extractedArchiveDirFile = archiveUtility.getFile(extractedArchiveDirPath);

                final ViewEntity viewDefinition = new ViewEntity(viewConfig, configuration, extractedArchiveDirPath);

                boolean systemView = viewDefinition.isSystem();

                if (!systemOnly || systemView) {
                  // update the registry with the view
                  addDefinition(viewDefinition);

                  // always load system views up front
                  if (systemView || !useExecutor || extractedArchiveDirFile.exists()) {
                    // if the archive is already extracted then load the view now
                    readViewArchive(viewDefinition, archiveFile, extractedArchiveDirFile, serverVersion);
                  } else {
                    // if the archive needs to be extracted then create a runnable to do it
                    extractionRunnables.add(new Runnable() {
                      @Override
                      public void run() {
                        readViewArchive(viewDefinition, archiveFile, extractedArchiveDirFile, serverVersion);
                        migrateDataFromPreviousVersion(viewDefinition, serverVersion);
                      }
                    });
                  }
                }
              } catch (Exception e) {
                String msg = "Caught exception reading view archive " + archiveFile.getAbsolutePath();
                LOG.error(msg, e);
              }
            }
          }

          for (ViewEntity view : getDefinitions()) {
            if (view.getStatus() == ViewDefinition.ViewStatus.DEPLOYED) {
              // migrate views that are not need extraction, for ones that need call will be done in the runnable.
              migrateDataFromPreviousVersion(view, serverVersion);
            }
          }

          if (useExecutor && extractionRunnables.size() > 0) {
            final ExecutorService executorService = getExecutorService(configuration);

            for (Runnable runnable : extractionRunnables) {
              // submit a new task for each archive that needs extraction
              executorService.submit(runnable);
            }
          }

          if (configuration.isViewRemoveUndeployedEnabled()) {
            removeUndeployedViews();
          }
        }
      } else {
        LOG.error("Could not create extracted view archive directory " + extractedArchivesPath + ".");
      }
    } catch (Exception e) {
      LOG.error("Caught exception reading view archives.", e);
    }
  }
Extract a view archive at the specified path

@param path
ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java