コード例 #1
0
 private ArtifactResult downloadZipped(Node node, ArtifactContext context) {
   ArtifactContext zippedContext = context.getZipContext();
   ArtifactResult zipResult = getArtifactResult(zippedContext);
   if (zipResult != null) {
     String zipName = zipResult.artifact().getName();
     File unzippedFolder =
         new File(
             zipResult.artifact().getParentFile(), zipName.substring(0, zipName.length() - 4));
     try {
       IOUtils.extractArchive(zipResult.artifact(), unzippedFolder);
     } catch (IOException e) {
       throw new RepositoryException(
           "Failed to unzip folder downloaded from Herd: " + zipResult.artifact(), e);
     }
     return new FileArtifactResult(
         zipResult.repository(),
         this,
         zipResult.name(),
         zipResult.version(),
         unzippedFolder,
         zipResult.repositoryDisplayString());
   } else {
     return null;
   }
 }
コード例 #2
0
 private void uploadZipped(Node parent, ArtifactContext context, File folder) {
   File zippedFolder = null;
   try {
     try {
       zippedFolder = IOUtils.zipFolder(folder);
     } catch (IOException e) {
       throw new RepositoryException("Failed to zip folder for upload to Herd: " + folder, e);
     }
     ArtifactContext zippedContext = context.getZipContext();
     putArtifact(zippedContext, zippedFolder);
     ShaSigner.signArtifact(this, zippedContext, zippedFolder, log);
   } finally {
     if (zippedFolder != null) {
       FileUtil.deleteQuietly(zippedFolder);
     }
   }
 }