public Collection listFiles()

in clearcase-server/src/jetbrains/buildServer/buildTriggers/vcs/clearcase/ClearCaseSupport.java [988:1015]


  public Collection<VcsFileData> listFiles(@NotNull final VcsRoot root, @NotNull final String directoryPath) throws VcsException {
    final Ref<Collection<VcsFileData>> result = new Ref<Collection<VcsFileData>>();
    try {
      withConnection(root, IncludeRule.createDefaultInstance(), null, new ConnectionProcessor() {
        public void process(@NotNull final ClearCaseConnection connection) throws VcsException, IOException {
          final String dirFullPath = new File(getViewPath(root).getWholePath(), directoryPath).getAbsolutePath();
          final Version dirVersion = connection.getLastVersion(dirFullPath, false);
          if (dirVersion == null) {
            result.set(Collections.<VcsFileData>emptySet());
            return;
          }

          final String dirPathWithVersion = dirFullPath + CCParseUtil.CC_VERSION_SEPARATOR + dirVersion.getWholeName();

          final Collection<VcsFileData> files = new ArrayList<VcsFileData>();
          for (final SimpleDirectoryChildElement child : connection.getChildren(dirPathWithVersion)) {
            files.add(new VcsFileData(child.getName(), child.getType() == SimpleDirectoryChildElement.Type.DIRECTORY));
          }

          result.set(files);
        }
      });
    }
    catch (IOException e) {
      throw new VcsException(e);
    }
    return result.get();
  }