protected void scanAndUpdateLocalRepositoryIndex(MavenServerProgressIndicator indicator, IndexingContext context, boolean multithreaded)
    throws
    IOException {

    File repositoryDirectory = context.getRepository();
    if (repositoryDirectory == null || !repositoryDirectory.exists()) {
      throw new IOException("Repository directory " + repositoryDirectory + " does not exist");
    }
    indicator.setText("Scanning " + repositoryDirectory.getPath());

    File tmpDir = Files.createTempDirectory(context.getId() + "-tmp").toFile();

    IndexingContext tmpContext = null;

    try {

      tmpContext = new DefaultIndexingContext(context.getId() + "-tmp",
                                              context.getRepositoryId(),
                                              context.getRepository(),
                                              tmpDir,
                                              context.getRepositoryUrl(),
                                              context.getIndexUpdateUrl(),
                                              context.getIndexCreators(),
                                              true);

      myScanner.scan(new ScanningRequest(tmpContext,
                                         new DefaultScannerListener(tmpContext,
                                                                    myContainer.lookup(IndexerEngine.class),
                                                                    false,
                                                                    new MyScanningListener(indicator)),
                                         null));
      indicator.setText("Scanning for " + repositoryDirectory.getPath() + " complete, updating indices");
      tmpContext.updateTimestamp(true);
      context.replace(tmpContext.getIndexDirectory());
      indicator.setText("Indices for " + repositoryDirectory.getPath() + " updated");
    }
    catch (Exception e) {
      throw new IOException("Error scanning context " + context.getId(), e);
    }
    finally {
      if (tmpContext != null) {
        tmpContext.close(true);
      }
      FileUtils.deleteDirectory(tmpDir);
    }
  }
protected void scanAndUpdateLocalRepositoryIndex(MavenServerProgressIndicator indicator, IndexingContext context, boolean multithreaded)