public VcsFileContentProvider getContentProvider()

in vault-server/src/jetbrains/buildServer/buildTriggers/vcs/vault/VaultVcsSupport.java [58:82]


  public VcsFileContentProvider getContentProvider() {
    return new VcsFileContentProvider() {
      @NotNull
      public byte[] getContent(@NotNull VcsModification vcsModification, @NotNull VcsChangeInfo change, @NotNull VcsChangeInfo.ContentType contentType, @NotNull VcsRoot vcsRoot) throws VcsException {
        return getContent(
          change.getRelativeFileName(),
          vcsRoot,
          contentType == VcsChangeInfo.ContentType.BEFORE_CHANGE ? change.getBeforeChangeRevisionNumber() : change.getAfterChangeRevisionNumber());
      }

      @NotNull
      public byte[] getContent(@NotNull final String filePath, @NotNull VcsRoot versionedRoot, @NotNull final String version) throws VcsException {
        final VaultConnection connection = getOrCreateConnection(versionedRoot);

        try {
          final File object = connection.getExistingObject(filePath, version);
          return FileUtil.loadFileBytes(object);
        } catch (IOException e) {
          throw new VcsException(e);
        } finally {
          connection.resetCaches();
        }
      }
    };
  }