Package adept.artifact

Examples of adept.artifact.ArtifactDownloadResult


      File currentCachedFile = ArtifactCache.getOrCreateExistingCacheFile(baseDir, artifact.hash, artifact.filename,
          true);
      if (currentCachedFile == null || !currentCachedFile.isFile()) {
        nonLocalArtifacts.add(artifact);
      } else {
        ArtifactDownloadResult result = new ArtifactDownloadResult(artifact.getArtifact(), currentCachedFile.getName());
        result.setCachedFile(currentCachedFile);
        results.add(result);
      }
    }

    Set<Future<ArtifactDownloadResult>> futures = new HashSet<Future<ArtifactDownloadResult>>(nonLocalArtifacts.size());

    int allSizes = 0;
    for (LockfileArtifact lockfileArtifact : nonLocalArtifacts) {
      allSizes += lockfileArtifact.size / 1024;
    }
    boolean displayProgress = !nonLocalArtifacts.isEmpty();
    if (displayProgress)
      progress.beginTask("Downloading (kB)", allSizes);

    for (LockfileArtifact lockfileArtifact : nonLocalArtifacts) {
      File tmpFile = File.createTempFile("adept-", lockfileArtifact.filename, getTmpDir());
      //Initiate downloads:
      futures.add(executorService.submit(new ArtifactDownloader(baseDir, lockfileArtifact.getArtifact(),
          lockfileArtifact.filename, tmpFile, maxRetries, logger, progress)));
    }
    executorService.shutdown();
    executorService.awaitTermination(timeout, timeoutUnit);

    for (Future<ArtifactDownloadResult> future : futures) {
      ArtifactDownloadResult result = future.get();
      if (result.isSuccess()) {
        results.add(result);
      } else if (result.isFailed()) {
        final String causeString;
        if (result.exception.getCause() == null)
          causeString = "";
        else
          causeString = " " + result.exception.getCause() + ".";
View Full Code Here

TOP

Related Classes of adept.artifact.ArtifactDownloadResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.