Beispiel #1
0
  /** This is the reason for this thread. We launch the remote process and wait until it returns. */
  @Override
  public void run() {
    fireCreationEvent();

    //
    // We wait for build changes. We never update during a build
    // and we will wait a bit after a build ends.
    //

    UpdateGuard guard =
        new UpdateGuard(context) {
          @Override
          protected void update() {
            LaunchThread.this.update();
          }
        };

    guard.open();

    try {
      exitValue = session.launch();
    } catch (Exception e) {
      logger.logWarning("Exception from launcher", e);
      e.printStackTrace();
    } finally {
      guard.close();
      terminate();
    }
  }
Beispiel #2
0
  private void update() {
    if (isTerminated()) return;

    try {
      //
      // TODO Should use listener
      //

      if (launcher.getProject() instanceof Run) launcher.getProject().refresh();

      launcher.update();
    } catch (Exception e) {
      logger.logWarning("Exception from update", e);
    }
    fireChangeEvent();
  }
 private void addRepositoryPlugins(Collection<Object> result, Workspace workspace) {
   workspace.getErrors().clear();
   List<RepositoryPlugin> repoPlugins = workspace.getPlugins(RepositoryPlugin.class);
   for (String error : workspace.getErrors()) {
     logger.logError(error, null);
   }
   for (RepositoryPlugin repoPlugin : repoPlugins) {
     if (CACHE_REPOSITORY.equals(repoPlugin.getName())) continue;
     if (repoPlugin instanceof IndexProvider) {
       IndexProvider indexProvider = (IndexProvider) repoPlugin;
       if (!supportsPhase(indexProvider)) continue;
     }
     if (showRepos) result.add(repoPlugin);
     else result.addAll(Arrays.asList(getRepositoryBundles(repoPlugin)));
   }
 }
  Object[] getProjectBundles(Project project) {
    ProjectBundle[] result = null;
    try {
      Collection<? extends Builder> builders = project.getSubBuilders();
      result = new ProjectBundle[builders.size()];

      int i = 0;
      for (Builder builder : builders) {
        ProjectBundle bundle = new ProjectBundle(project, builder.getBsn());
        result[i++] = bundle;
      }
    } catch (Exception e) {
      logger.logError(
          MessageFormat.format("Error querying sub-bundles for project {0}.", project.getName()),
          e);
    }
    return result;
  }
  Object[] getRepositoryBundles(RepositoryPlugin repo) {
    Object[] result = null;

    List<String> bsns = null;
    try {
      bsns = repo.list(filter);
    } catch (Exception e) {
      logger.logError(MessageFormat.format("Error querying repository {0}.", repo.getName()), e);
    }
    if (bsns != null) {
      Collections.sort(bsns);
      result = new RepositoryBundle[bsns.size()];
      int i = 0;
      for (String bsn : bsns) {
        result[i++] = new RepositoryBundle(repo, bsn);
      }
    }
    return result;
  }
  Object[] getRepositoryBundleVersions(RepositoryBundle bundle) {
    RepositoryBundleVersion[] result = null;

    SortedSet<Version> versions = null;
    try {
      versions = bundle.getRepo().versions(bundle.getBsn());
    } catch (Exception e) {
      logger.logError(
          MessageFormat.format(
              "Error querying versions for bundle {0} in repository {1}.",
              bundle.getBsn(), bundle.getRepo().getName()),
          e);
    }
    if (versions != null) {
      result = new RepositoryBundleVersion[versions.size()];
      int i = 0;
      for (Version version : versions) {
        result[i++] = new RepositoryBundleVersion(bundle, version);
      }
    }
    return result;
  }