@Override public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel payload) { LOG.info("Unzipping archive: " + payload.toPrettyString()); File zipFile = payload.asFile(); if (zipFile == null || !zipFile.isFile()) { throw new WindupException("Input path doesn't point to a file: " + (zipFile == null ? "null" : zipFile.getAbsolutePath())); } // create a folder for all archive contents WindupConfigurationModel cfg = WindupConfigurationService.getConfigurationModel(event.getGraphContext()); String windupOutputFolder = cfg.getOutputPath().getFilePath(); Path windupTempUnzippedArchiveFolder = Paths.get(windupOutputFolder, ARCHIVES); if (!Files.isDirectory(windupTempUnzippedArchiveFolder)) { try { Files.createDirectories(windupTempUnzippedArchiveFolder); } catch (IOException e) { throw new WindupException("Failed to create temporary folder: " + windupTempUnzippedArchiveFolder + " due to: " + e.getMessage(), e); } } unzipToTempDirectory(event.getGraphContext(), windupTempUnzippedArchiveFolder, zipFile, payload); }
@Override public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel payload) { if (new WindupJavaConfigurationService(event.getGraphContext()).checkIfIgnored(event, payload)) return; LOG.info("Unzipping archive: " + payload.toPrettyString()); File zipFile = payload.asFile(); if (zipFile == null || !zipFile.isFile()) { throw new WindupException("Input path doesn't point to a file: " + (zipFile == null ? "null" : zipFile.getAbsolutePath())); } final GraphContext graphContext = event.getGraphContext(); checkCancelled(event); // Create a folder for all archive contents. Path unzippedArchiveDir = getArchivesDirLocation(graphContext); ensureDirIsCreated(unzippedArchiveDir); // Collect the malformed archives here. Object badArchives = event.getRewriteContext().get(KEY_BAD_ARCHIVES); if (null == badArchives) event.getRewriteContext().put(KEY_BAD_ARCHIVES, new ArrayList<String>()); unzipToTempDirectory(event, context, unzippedArchiveDir, zipFile, payload, false); }
@Override public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel payload) { if (new WindupJavaConfigurationService(event.getGraphContext()).checkIfIgnored(event, payload)) return; LOG.info("Unzipping archive: " + payload.toPrettyString()); File zipFile = payload.asFile(); if (zipFile == null || !zipFile.isFile()) { throw new WindupException("Input path doesn't point to a file: " + (zipFile == null ? "null" : zipFile.getAbsolutePath())); } final GraphContext graphContext = event.getGraphContext(); checkCancelled(event); // Create a folder for all archive contents. Path unzippedArchiveDir = getArchivesDirLocation(graphContext); ensureDirIsCreated(unzippedArchiveDir); // Collect the malformed archives here. Object badArchives = event.getRewriteContext().get(KEY_BAD_ARCHIVES); if (null == badArchives) event.getRewriteContext().put(KEY_BAD_ARCHIVES, new ArrayList<String>()); unzipToTempDirectory(event, context, unzippedArchiveDir, zipFile, payload, false); }
unzipToTempDirectory(context, tempFolder, newZipFile, newArchiveModel);
unzipToTempDirectory(event, context, tempFolder, newZipFile, duplicateArchive, true); } else unzipToTempDirectory(event, context, tempFolder, newZipFile, newArchiveModel, false);
unzipToTempDirectory(event, context, tempFolder, newZipFile, duplicateArchive, true); } else unzipToTempDirectory(event, context, tempFolder, newZipFile, newArchiveModel, false);