Exemple #1
0
  private static File createZippedPu(
      final Service service, final File puFolderToZip, final File recipeFile)
      throws IOException, PackagingException {
    logger.finer("trying to zip " + puFolderToZip.getAbsolutePath());
    final String serviceName =
        service.getName() != null ? service.getName() : recipeFile.getParentFile().getName();

    // create a temp dir under the system temp dir
    final File tmpFile = File.createTempFile("ServicePackage", null);
    tmpFile.delete();
    tmpFile.mkdir();

    final File zipFile = new File(tmpFile, serviceName + ".zip");

    // files will be deleted in reverse order
    tmpFile.deleteOnExit();
    zipFile.deleteOnExit();

    ServiceReader.validateFolderSize(puFolderToZip, service.getMaxJarSize());
    ZipUtils.zip(puFolderToZip, zipFile);
    logger.finer("zipped folder successfully to " + zipFile.getAbsolutePath());
    return zipFile;
  }