Example usage for java.nio.file Path resolve

List of usage examples for java.nio.file Path resolve

Introduction

In this page you can find the example usage for java.nio.file Path resolve.

Prototype

default Path resolve(String other) 

Source Link

Document

Converts a given path string to a Path and resolves it against this Path in exactly the manner specified by the #resolve(Path) resolve method.

Usage

From source file:fr.pilato.elasticsearch.crawler.fs.test.integration.FsCrawlerImplAllParametersIT.java

/**
 * Test case for #136: https://github.com/dadoonet/fscrawler/issues/136 : Moving existing files does not index new files
 *///  ww w .j  av  a 2 s .  c o  m
@Test
public void test_moving_files() throws Exception {
    String filename = "oldfile.txt";

    startCrawler();

    // Let's first create some files
    logger.info(" ---> Creating a file [{}]", filename);

    Path tmpDir = rootTmpDir.resolve("resources").resolve(getCurrentTestName() + "-tmp");
    if (Files.notExists(tmpDir)) {
        Files.createDirectory(tmpDir);
    }

    Path file = Files.createFile(tmpDir.resolve(filename));
    Files.write(file, "Hello world".getBytes(Charsets.UTF_8));

    // We should have 1 doc first
    countTestHelper(getCrawlerName(), null, 1);

    logContentOfDir(currentTestResourceDir, Level.DEBUG);

    // We remove a directory
    logger.info("  ---> Moving file [{}] to [{}]", file, currentTestResourceDir);
    Files.move(file, currentTestResourceDir.resolve(filename));

    logContentOfDir(currentTestResourceDir, Level.DEBUG);

    // We expect to have 4 docs now
    countTestHelper(getCrawlerName(), null, 2);
}

From source file:me.ryanhamshire.GriefPrevention.GriefPrevention.java

public void loadConfig() {
    try {//from  ww  w .j av  a  2 s . c  o m
        Files.createDirectories(DataStore.configFilePath.getParent());
        if (Files.notExists(DataStore.configFilePath)) {
            Files.createFile(DataStore.configFilePath);
        }
        if (Files.notExists(DataStore.messagesFilePath)) {
            Files.createFile(DataStore.messagesFilePath);
        }
        if (Files.notExists(DataStore.bannedWordsFilePath)) {
            Files.createFile(DataStore.bannedWordsFilePath);
        }
        if (Files.notExists(DataStore.softMuteFilePath)) {
            Files.createFile(DataStore.softMuteFilePath);
        }

        Path rootConfigPath = Sponge.getGame().getSavesDirectory().resolve("config").resolve("GriefPrevention")
                .resolve("worlds");
        DataStore.globalConfig = new GriefPreventionConfig<GlobalConfig>(Type.GLOBAL,
                rootConfigPath.resolve("global.conf"));
        for (World world : Sponge.getGame().getServer().getWorlds()) {
            DimensionType dimType = world.getProperties().getDimensionType();
            if (!Files.exists(
                    rootConfigPath.resolve(dimType.getId()).resolve(world.getProperties().getWorldName()))) {
                try {
                    Files.createDirectories(rootConfigPath.resolve(dimType.getId())
                            .resolve(world.getProperties().getWorldName()));
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

            DataStore.dimensionConfigMap.put(world.getProperties().getUniqueId(),
                    new GriefPreventionConfig<DimensionConfig>(Type.DIMENSION,
                            rootConfigPath.resolve(dimType.getId()).resolve("dimension.conf")));
            DataStore.worldConfigMap.put(world.getProperties().getUniqueId(),
                    new GriefPreventionConfig<>(Type.WORLD, rootConfigPath.resolve(dimType.getId())
                            .resolve(world.getProperties().getWorldName()).resolve("world.conf")));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:fll.web.FullTournamentTest.java

/**
 * Simulate entering subjective scores by pulling them out of testDataConn.
 * /*  w w  w  . j a v  a2  s.c  o m*/
 * @param testDataConn Where to get the test data from
 * @param challengeDocument the challenge descriptor
 * @throws SQLException
 * @throws SAXException
 * @throws InterruptedException 
 */
private void enterSubjectiveScores(final Connection testDataConn, final ChallengeDescription description,
        final Tournament sourceTournament, final Path outputDirectory) throws SQLException, IOException,
        MalformedURLException, ParseException, SAXException, InterruptedException {

    final Path subjectiveZip = outputDirectory
            .resolve(sanitizeFilename(sourceTournament.getName()) + "_subjective-data.fll");

    IntegrationTestUtils.downloadFile(new URL(TestUtils.URL_ROOT + "admin/subjective-data.fll"),
            "application/zip", subjectiveZip);

    final SubjectiveFrame subjective = new SubjectiveFrame();
    subjective.load(subjectiveZip.toFile());

    // insert scores into zip
    for (final ScoreCategory subjectiveElement : description.getSubjectiveCategories()) {
        final String category = subjectiveElement.getName();
        final String title = subjectiveElement.getTitle();

        // find appropriate table model
        final TableModel tableModel = subjective.getTableModelForTitle(title);
        Assert.assertNotNull(tableModel);

        final int teamNumberColumn = findColumnByName(tableModel, "TeamNumber");
        Assert.assertTrue("Can't find TeamNumber column in subjective table model", teamNumberColumn >= 0);
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Found team number column at " + teamNumberColumn);
        }

        try (final PreparedStatement prep = testDataConn
                .prepareStatement("SELECT * FROM " + category + " WHERE Tournament = ?")) {
            prep.setInt(1, sourceTournament.getTournamentID());

            try (final ResultSet rs = prep.executeQuery()) {
                while (rs.next()) {
                    final int teamNumber = rs.getInt("TeamNumber");

                    // find row number in table
                    int rowIndex = -1;
                    for (int rowIdx = 0; rowIdx < tableModel.getRowCount(); ++rowIdx) {
                        final Object teamNumberRaw = tableModel.getValueAt(rowIdx, teamNumberColumn);
                        Assert.assertNotNull(teamNumberRaw);
                        final int value = Utilities.NUMBER_FORMAT_INSTANCE.parse(teamNumberRaw.toString())
                                .intValue();

                        if (LOGGER.isTraceEnabled()) {
                            LOGGER.trace("Checking if " + teamNumber + " equals " + value + " raw: "
                                    + teamNumberRaw + "? " + (value == teamNumber) + " rowIdx: " + rowIdx
                                    + " numRows: " + tableModel.getRowCount());
                        }

                        if (value == teamNumber) {
                            rowIndex = rowIdx;
                            break;
                        }
                    }
                    Assert.assertTrue("Can't find team " + teamNumber + " in subjective table model",
                            rowIndex >= 0);

                    if (rs.getBoolean("NoShow")) {
                        // find column for no show
                        final int columnIndex = findColumnByName(tableModel, "No Show");
                        Assert.assertTrue("Can't find No Show column in subjective table model",
                                columnIndex >= 0);
                        tableModel.setValueAt(Boolean.TRUE, rowIndex, columnIndex);
                    } else {
                        for (final AbstractGoal goalElement : subjectiveElement.getGoals()) {
                            if (!goalElement.isComputed()) {
                                final String goalName = goalElement.getName();
                                final String goalTitle = goalElement.getTitle();

                                // find column index for goal and call set
                                final int columnIndex = findColumnByName(tableModel, goalTitle);
                                Assert.assertTrue(
                                        "Can't find " + goalTitle + " column in subjective table model",
                                        columnIndex >= 0);
                                final int value = rs.getInt(goalName);
                                tableModel.setValueAt(Integer.valueOf(value), rowIndex, columnIndex);
                            }
                        }
                    } // not NoShow
                } // foreach score
            } // try ResultSet
        } // try PreparedStatement
    } // foreach category
    subjective.save();

    // upload scores
    IntegrationTestUtils.loadPage(selenium, TestUtils.URL_ROOT + "admin/index.jsp");
    final WebElement fileInput = selenium.findElement(By.name("subjectiveFile"));
    fileInput.sendKeys(subjectiveZip.toAbsolutePath().toString());

    selenium.findElement(By.id("uploadSubjectiveFile")).click();

    Assert.assertFalse(IntegrationTestUtils.isElementPresent(selenium, By.id("error")));
    Assert.assertTrue(IntegrationTestUtils.isElementPresent(selenium, By.id("success")));

}

From source file:com.facebook.buck.util.unarchive.UnzipTest.java

@Test
public void testExtractZipFile() throws InterruptedException, IOException {
    try (ZipArchive zipArchive = new ZipArchive(this.zipFile, true)) {
        zipArchive.add("1.bin", DUMMY_FILE_CONTENTS);
        zipArchive.add("subdir/2.bin", DUMMY_FILE_CONTENTS);
        zipArchive.addDir("emptydir");
    }/*from   w w w . j  a  va 2  s  . co m*/

    Path extractFolder = tmpFolder.newFolder();
    ImmutableList<Path> result = ArchiveFormat.ZIP.getUnarchiver().extractArchive(
            new DefaultProjectFilesystemFactory(), zipFile.toAbsolutePath(), extractFolder.toAbsolutePath(),
            ExistingFileMode.OVERWRITE);
    assertTrue(Files.exists(extractFolder.toAbsolutePath().resolve("1.bin")));
    Path bin2 = extractFolder.toAbsolutePath().resolve("subdir/2.bin");
    assertTrue(Files.exists(bin2));
    assertTrue(Files.isDirectory(extractFolder.toAbsolutePath().resolve("emptydir")));
    try (InputStream input = Files.newInputStream(bin2)) {
        byte[] buffer = new byte[DUMMY_FILE_CONTENTS.length];
        int bytesRead = input.read(buffer, 0, DUMMY_FILE_CONTENTS.length);
        assertEquals(DUMMY_FILE_CONTENTS.length, bytesRead);
        for (int i = 0; i < DUMMY_FILE_CONTENTS.length; i++) {
            assertEquals(DUMMY_FILE_CONTENTS[i], buffer[i]);
        }
    }
    assertEquals(ImmutableList.of(extractFolder.resolve("1.bin"), extractFolder.resolve("subdir/2.bin")),
            result);
}

From source file:com.netflix.genie.web.services.loadbalancers.script.ScriptLoadBalancer.java

/**
 * Check if the script file needs to be refreshed.
 *///from w w w  . j a  v  a2  s .  com
public void refresh() {
    log.debug("Refreshing");
    final long updateStart = System.nanoTime();
    final Set<Tag> tags = Sets.newHashSet();
    try {
        this.isUpdating.set(true);

        // Update the script timeout
        this.timeoutLength.set(this.environment.getProperty(ScriptLoadBalancerProperties.TIMEOUT_PROPERTY,
                Long.class, DEFAULT_TIMEOUT_LENGTH));

        final String scriptFileSourceValue = this.environment
                .getProperty(ScriptLoadBalancerProperties.SCRIPT_FILE_SOURCE_PROPERTY);
        if (StringUtils.isBlank(scriptFileSourceValue)) {
            throw new IllegalStateException("Invalid empty value for script source file property: "
                    + ScriptLoadBalancerProperties.SCRIPT_FILE_SOURCE_PROPERTY);
        }
        final String scriptFileSource = new URI(scriptFileSourceValue).toString();

        final String scriptFileDestinationValue = this.environment
                .getProperty(ScriptLoadBalancerProperties.SCRIPT_FILE_DESTINATION_PROPERTY);
        if (StringUtils.isBlank(scriptFileDestinationValue)) {
            throw new IllegalStateException("Invalid empty value for script destination directory property: "
                    + ScriptLoadBalancerProperties.SCRIPT_FILE_DESTINATION_PROPERTY);
        }
        final Path scriptDestinationDirectory = Paths.get(new URI(scriptFileDestinationValue));

        // Check the validity of the destination directory
        if (!Files.exists(scriptDestinationDirectory)) {
            Files.createDirectories(scriptDestinationDirectory);
        } else if (!Files.isDirectory(scriptDestinationDirectory)) {
            throw new IllegalStateException("The script destination directory " + scriptDestinationDirectory
                    + " exists but is not a directory");
        }

        final String fileName = StringUtils.substringAfterLast(scriptFileSource, SLASH);
        if (StringUtils.isBlank(fileName)) {
            throw new IllegalStateException("No file name found from " + scriptFileSource);
        }

        final String scriptExtension = StringUtils.substringAfterLast(fileName, PERIOD);
        if (StringUtils.isBlank(scriptExtension)) {
            throw new IllegalStateException("No file extension available in " + fileName);
        }

        final Path scriptDestinationPath = scriptDestinationDirectory.resolve(fileName);

        // Download and cache the file (if it's not already there)
        this.fileTransferService.getFile(scriptFileSource, scriptDestinationPath.toUri().toString());

        final ScriptEngine engine = this.scriptEngineManager.getEngineByExtension(scriptExtension);
        // We want a compilable engine so we can cache the script
        if (!(engine instanceof Compilable)) {
            throw new IllegalArgumentException("Script engine must be of type " + Compilable.class.getName());
        }
        final Compilable compilable = (Compilable) engine;
        try (InputStream fis = Files.newInputStream(scriptDestinationPath);
                InputStreamReader reader = new InputStreamReader(fis, UTF_8)) {
            log.debug("Compiling {}", scriptFileSource);
            this.script.set(compilable.compile(reader));
        }

        tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_OK));

        this.isConfigured.set(true);
    } catch (final GenieException | IOException | ScriptException | RuntimeException | URISyntaxException e) {
        tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_FAILED));
        tags.add(Tag.of(MetricsConstants.TagKeys.EXCEPTION_CLASS, e.getClass().getName()));
        log.error("Refreshing the load balancing script for ScriptLoadBalancer failed due to {}",
                e.getMessage(), e);
        this.isConfigured.set(false);
    } finally {
        this.isUpdating.set(false);
        this.registry.timer(UPDATE_TIMER_NAME, tags).record(System.nanoTime() - updateStart,
                TimeUnit.NANOSECONDS);
        log.debug("Refresh completed");
    }
}

From source file:com.vmware.photon.controller.deployer.xenon.task.CreateDhcpVmTaskService.java

private void processConfigIso(State currentState, VmService.State vmState, HostService.State hostState)
        throws Throwable {

    checkState(hostState.metadata.containsKey(HostService.State.METADATA_KEY_NAME_MANAGEMENT_NETWORK_GATEWAY));
    checkState(hostState.metadata.containsKey(HostService.State.METADATA_KEY_NAME_MANAGEMENT_NETWORK_IP));
    checkState(hostState.metadata.containsKey(HostService.State.METADATA_KEY_NAME_MANAGEMENT_NETWORK_NETMASK));
    checkState(/*from w  ww  . j a va 2 s .co  m*/
            hostState.metadata.containsKey(HostService.State.METADATA_KEY_NAME_MANAGEMENT_NETWORK_DNS_SERVER));

    String gateway = hostState.metadata.get(HostService.State.METADATA_KEY_NAME_MANAGEMENT_NETWORK_GATEWAY);
    String ipAddress = hostState.metadata.get(HostService.State.METADATA_KEY_NAME_MANAGEMENT_NETWORK_IP);
    String netmask = hostState.metadata.get(HostService.State.METADATA_KEY_NAME_MANAGEMENT_NETWORK_NETMASK);
    String dnsEndpointList = hostState.metadata
            .get(HostService.State.METADATA_KEY_NAME_MANAGEMENT_NETWORK_DNS_SERVER);
    if (!Strings.isNullOrEmpty(dnsEndpointList)) {
        dnsEndpointList = Stream.of(dnsEndpointList.split(",")).map((dnsServer) -> "DNS=" + dnsServer + "\n")
                .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString();
    }

    DeployerContext deployerContext = HostUtils.getDeployerContext(this);
    String scriptDirectory = deployerContext.getScriptDirectory();

    String userDataConfigFileContent = new String(
            Files.readAllBytes(Paths.get(scriptDirectory, "user-data.template")), StandardCharsets.UTF_8)
                    .replace("$GATEWAY", gateway)
                    .replace("$ADDRESS", new SubnetUtils(ipAddress, netmask).getInfo().getCidrSignature())
                    .replace("$DNS", dnsEndpointList);

    if (currentState.ntpEndpoint != null) {
        userDataConfigFileContent = userDataConfigFileContent.replace("$NTP", currentState.ntpEndpoint);
    }

    String metadataConfigFileContent = new String(
            Files.readAllBytes(Paths.get(scriptDirectory, "meta-data.template")), StandardCharsets.UTF_8)
                    .replace("$INSTANCE_ID", vmState.name).replace("$LOCAL_HOSTNAME", vmState.name);

    Path vmConfigDirectoryPath = Files.createTempDirectory("iso-" + currentState.vmId).toAbsolutePath();
    Path userDataConfigFilePath = vmConfigDirectoryPath.resolve("user-data.yml");
    Files.write(userDataConfigFilePath, userDataConfigFileContent.getBytes(StandardCharsets.UTF_8));
    Path metadataConfigFilePath = vmConfigDirectoryPath.resolve("meta-data.yml");
    Files.write(metadataConfigFilePath, metadataConfigFileContent.getBytes(StandardCharsets.UTF_8));
    Path isoFilePath = vmConfigDirectoryPath.resolve("config.iso");

    List<String> command = new ArrayList<>();
    command.add("./" + SCRIPT_NAME);
    command.add(isoFilePath.toAbsolutePath().toString());
    command.add(userDataConfigFilePath.toAbsolutePath().toString());
    command.add(metadataConfigFilePath.toAbsolutePath().toString());
    command.add(currentState.serviceConfigDirectory);

    File scriptLogFile = new File(deployerContext.getScriptLogDirectory(), SCRIPT_NAME + "-" + vmState.vmId
            + "-" + ServiceUtils.getIDFromDocumentSelfLink(currentState.documentSelfLink) + ".log");

    ScriptRunner scriptRunner = new ScriptRunner.Builder(command, deployerContext.getScriptTimeoutSec())
            .directory(deployerContext.getScriptDirectory())
            .redirectOutput(ProcessBuilder.Redirect.to(scriptLogFile)).build();

    ListenableFutureTask<Integer> futureTask = ListenableFutureTask.create(scriptRunner);
    HostUtils.getListeningExecutorService(this).submit(futureTask);
    Futures.addCallback(futureTask, new FutureCallback<Integer>() {
        @Override
        public void onSuccess(@javax.validation.constraints.NotNull Integer result) {
            try {
                if (result != 0) {
                    logScriptErrorAndFail(currentState, result, scriptLogFile);
                } else {
                    State patchState = buildPatch(TaskState.TaskStage.STARTED, TaskState.SubStage.ATTACH_ISO,
                            null);
                    patchState.vmConfigDirectory = vmConfigDirectoryPath.toAbsolutePath().toString();
                    TaskUtils.sendSelfPatch(CreateDhcpVmTaskService.this, patchState);
                }
            } catch (Throwable t) {
                failTask(t);
            }
        }

        @Override
        public void onFailure(Throwable throwable) {
            failTask(throwable);
        }
    });
}

From source file:com.upplication.s3fs.util.AmazonS3ClientMock.java

@Override
public void deleteObject(String bucketName, String key) throws AmazonClientException {
    Path bucket = find(bucketName);
    Path resolve = bucket.resolve(key);
    if (Files.exists(resolve))
        try {/*from  w w w . java 2 s. c o m*/
            Files.delete(resolve);
        } catch (IOException e) {
            throw new AmazonServiceException("Problem deleting mock object: ", e);
        }
    else {
        resolve = bucket.resolve(key.replaceAll("/", "%2F"));
        if (Files.exists(resolve))
            try {
                Files.delete(resolve);
            } catch (IOException e) {
                throw new AmazonServiceException("Problem deleting mock object: ", e);
            }
    }
}

From source file:com.github.horrorho.liquiddonkey.cloud.Looter.java

void snapshot(HttpClient client, Core core, HttpAgent agent, Backup backup, int id)
        throws BadDataException, IOException, InterruptedException {

    boolean toReport = config.debug().toReport();
    Path path = config.file().base().resolve(backup.backupUDID()).resolve(config.file().reportsDirectory());
    Predicate<ICloud.MBSFile> nonUndecryptableFilter = file -> !file.getAttributes().hasEncryptionKey()
            || backup.keyBagManager().fileKey(file) != null;

    // Retrieve file list.
    int limit = config.client().listLimit();
    Snapshot snapshot = agent/*from w  w w  .  ja  va 2 s  .co m*/
            .execute((c, mmeAuthToken) -> Snapshots.from(c, core, mmeAuthToken, backup, id, limit));

    if (snapshot == null) {
        logger.warn("-- snapshot() > snapshot not found: {}", id);
        return;
    }
    ICloud.MBSSnapshotAttributes attr = snapshot.mbsSnapshot().getAttributes();
    logger.info("-- snapshot() > files: {}", snapshot.filesCount());
    std.println();
    std.println(
            "Retrieving snapshot: " + id + " (" + attr.getDeviceName() + " " + attr.getProductVersion() + ")");

    // Total files.
    std.println("Files(total): " + snapshot.filesCount());
    if (toReport) {
        csvWriter.files(sorted(snapshot), path.resolve("snapshot_" + id + "_files.csv"));
    }

    // Mode summary.
    Map<Mode, Long> modes = snapshot.files().stream()
            .collect(Collectors.groupingBy(Mode::mode, Collectors.counting()));
    logger.info("-- snapshot() > modes: {}", modes);

    // Non-empty files filter.
    snapshot = Snapshots.from(snapshot, file -> file.getSize() != 0 && file.hasSignature());
    logger.info("-- snapshot() > filtered non empty, remaining: {}", snapshot.filesCount());
    std.println("Files(non-empty): " + snapshot.filesCount());

    // User filter
    snapshot = Snapshots.from(snapshot, filter);
    logger.info("-- snapshot() > filtered configured, remaining: {}", snapshot.filesCount());
    std.println("Files(filtered): " + snapshot.filesCount());
    if (toReport) {
        csvWriter.files(sorted(snapshot), path.resolve("snapshot_" + id + "_filtered.csv"));
    }

    // Undecryptable filter
    Snapshot undecryptable = Snapshots.from(snapshot, nonUndecryptableFilter.negate());
    snapshot = Snapshots.from(snapshot, nonUndecryptableFilter);
    logger.info("-- snapshot() > filtered undecryptable, remaining: {}", snapshot.filesCount());
    std.println("Files(non-undecryptable): " + snapshot.filesCount());

    // Dump undecryptables
    //        Map<ICloud.MBSFile, Outcome> undecryptableOutcomes = undecryptables.stream()
    //                .collect(Collectors.toMap(Function.identity(), file -> Outcome.FAILED_DECRYPT_NO_KEY));
    //        outcomesConsumer.accept(undecryptableOutcomes);
    if (toReport) {
        csvWriter.files(sorted(undecryptable), path.resolve("snapshot_" + id + "_undecryptable.csv"));
    }

    // Local filter
    if (config.engine().toForceOverwrite()) {
        logger.debug("-- snapshot() > forced overwrite");
    } else {
        long a = System.currentTimeMillis();
        snapshot = LocalFileFilter.from(snapshot, config.file()).apply(snapshot);
        long b = System.currentTimeMillis();
        logger.info("-- snapshot() > filtered local, remaining: {} delay(ms): {}", snapshot.filesCount(),
                b - a);
        std.println("Files(non-local): " + snapshot.filesCount());
    }

    if (snapshot.filesCount() == 0) {
        return;
    }

    // Retrieve
    Outcomes outcomes = Outcomes.create();
    OutcomesProgressPercentage progress = OutcomesProgressPercentage.from(snapshot, std);
    Consumer<Map<ICloud.MBSFile, Outcome>> outcomesConsumer = outcomes.andThen(progress);
    std.println();
    std.println("Retrieving: " + Bytes.humanize(progress.totalBytes()));

    // Fetch files
    SnapshotDownloader.from(config.engine(), config.file()).download(agent, core, snapshot, outcomesConsumer);

    std.println();
    std.println("Completed:");
    outcomes.print(std);
    std.println();
}

From source file:com.gitpitch.services.OfflineService.java

private int generateZip(PitchParams pp, Optional<SlideshowModel> ssmo) {

    log.debug("generateZip: pp={}, ssmo.isPresent={}", pp, ssmo.isPresent());

    int status = STATUS_UNDEF;

    Path zipRoot = null;

    try {//from w  w  w.ja va  2 s.  c o  m

        zipRoot = prepareZipRoot(pp);

        status = fetchOnlineMarkdown(pp, zipRoot);

        if (status == STATUS_OK)
            status = processMarkdown(pp, zipRoot, ssmo);

        if (status == STATUS_OK)
            status = fetchLandingHTML(pp, zipRoot);

        if (status == STATUS_OK)
            status = fetchSlideshowHTML(pp, zipRoot);

        if (status == STATUS_OK)
            fetchFixedDependencies(pp, zipRoot);

        if (status == STATUS_OK)
            fetchYAMLDependencies(pp, zipRoot);

        if (status == STATUS_OK)
            status = buildZip(pp, zipRoot);

    } catch (Exception zex) {
        log.warn("generateZip: pp={}, ex={}", zex);
    } finally {

        /*
         * Clean up artifacts if failed to generate zip.
         */
        if (status != STATUS_OK && zipRoot != null) {
            diskService.delete(zipRoot.resolve(PITCHME_ZIP));
            diskService.deepDelete(zipRoot.resolve(ZIP_ROOT_DIR).toFile());
        }
    }

    return status;
}