コード例 #1
0
ファイル: Packager.java プロジェクト: aigamo/cloudify
  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;
  }