Collection getTCResources()

in command.line/java/com/jetbrains/teamcity/command/RemoteRun.java [257:275]


  Collection<ITCResource> getTCResources(final TCWorkspace workspace, final Collection<File> files, final IProgressMonitor monitor) throws IllegalArgumentException {
    monitor.beginTask(getMsg("RemoteRun.mapping.step.name"));
    final HashSet<ITCResource> out = new HashSet<ITCResource>(files.size());
    for (final File file : files) {
      final ITCResource resource = workspace.getTCResource(file);
      if (resource != null && resource.getRepositoryPath() != null) {
        out.add(resource);
      } else {
        debug("? \"%s\" has not associated ITCResource(%s) or empty RepositoryPath(%s)", file, resource, resource != null ? resource.getRepositoryPath() : null);
      }
    }
    // fire exception if nothing found
    if (out.isEmpty()) {
      throw new IllegalArgumentException(String.format(getMsg("RemoteRun.no.one.mappings.found.error.message"), files.size()));
    }
    monitor.status(new ProgressStatus(IProgressStatus.INFO, String.format(getMsg("RemoteRun.mapping.step.done.message"), out.size(), files.size())));
    monitor.done(); 
    return out;
  }