Example #1
0
  private String deployJar(
      String tag, GitCommitJar commit, Map<String, String> attributes, long timeout)
      throws IOException {
    String[] files = getCommitList(commit.getCommitList());

    SendQueryCallback cb = new SendQueryCallback(files, commit);

    for (int i = 0; !cb.isEmpty() && i < 16; i++) {
      cb.sendNext();
    }

    cb.waitForDone(timeout);

    putTag(tag, commit.getDigest(), attributes);

    return commit.getDigest();
  }
Example #2
0
  public String commitArchive(CommitBuilder commit, Path jar, long timeout) {
    commit.validate();

    GitCommitJar gitCommit = null;

    try {
      gitCommit = new GitCommitJar(jar);

      String tag = commit.getId();

      return deployJar(tag, gitCommit, commit.getAttributes(), timeout);
    } catch (IOException e) {
      throw new RepositoryException(e);
    } finally {
      if (gitCommit != null) gitCommit.close();
    }
  }
Example #3
0
  /**
   * Uploads the contents of a jar/zip file to a Resin server. The jar is unzipped and each
   * component is uploaded separately. For wars, this means that only the changed files need
   * updates.
   *
   * @param tag symbolic name of the jar file to add
   * @param jar path to the jar file
   * @param attributes commit attributes including user, message, and version
   */
  @Override
  public String commitArchive(CommitBuilder commit, InputStream is) {
    commit.validate();

    GitCommitJar gitCommit = null;

    try {
      gitCommit = new GitCommitJar(is);

      String tag = commit.getId();

      long timeout = DEPLOY_TIMEOUT;

      return deployJar(tag, gitCommit, commit.getAttributes(), timeout);
    } catch (IOException e) {
      throw new RepositoryException(e);
    } finally {
      if (gitCommit != null) gitCommit.close();
    }
  }
Example #4
0
  public String commitPath(CommitBuilder commit, Path path, long timeout) {
    commit.validate();

    GitCommitJar gitCommit = null;

    if (!path.exists()) {
      throw new ConfigException(L.l("'{0}' is not an existing path for deploy commit.", path));
    }

    try {
      gitCommit = GitCommitJar.createDirectory(path);

      String tag = commit.getId();

      return deployJar(tag, gitCommit, commit.getAttributes(), timeout);
    } catch (IOException e) {
      throw new RepositoryException(e);
    } finally {
      if (gitCommit != null) gitCommit.close();
    }
  }
Example #5
0
 /** Returns an input stream, without freeing the results */
 @Override
 public InputStream openInputStream() throws IOException {
   return _gitJar.openFile(_sha1);
 }