@Override public void close() { IoUtils.recursiveDelete(home); }
Path newConfigLayoutDir() { return IoUtils.createRandomDir(cacheManager.getHome()); }
public static void replaceDist(Path stagedDir, Path home, boolean asUndo, Map<String, Boolean> undoTasks, MessageWriter log) throws ProvisioningException { log.verbose("Moving the provisioned installation from the staged directory to %s", home); // copy from the staged to the target installation directory if (Files.exists(home)) { if(asUndo) { StateHistoryUtils.removeLastUndoConfig(home, stagedDir, log); } else { StateHistoryUtils.addNewUndoConfig(home, stagedDir, undoTasks, log); } IoUtils.recursiveDelete(home); } try { IoUtils.copy(stagedDir, home); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(stagedDir, home)); } } }
private void addPlugins(Path fpDir) throws IOException { final Path tmpDir = IoUtils.createRandomTmpDir(); try { byte[] bytes = new byte[65536]; IoUtils.recursiveDelete(tmpDir);
public static Path createTmpDir(String name) { final Path dir = TMP_DIR.resolve(name); try { Files.createDirectories(dir); } catch (IOException e) { failedToMkDir(dir); } return dir; }
public static Path createRandomTmpDir() { return createTmpDir(UUID.randomUUID().toString()); }
public FeaturePackCacheManager(Path home, OverwritePolicy overwritePolicy) { this.home = home == null ? IoUtils.createRandomTmpDir() : home; this.overwritePolicy = overwritePolicy == null ? new DefaultOverwritePolicy() : overwritePolicy; }
groupId + '_' + artifactId + '_' + versionDir.getFileName().toString() + ".zip"); if(Files.exists(zippedFP)) { IoUtils.recursiveDelete(zippedFP); "zip", versionDir.getFileName().toString(), null, zippedFP.toFile()); Path target = Paths.get(project.getBuild().getDirectory()).resolve(project.getBuild().getFinalName() + ".zip"); IoUtils.copy(zippedFP, target); installReq.addArtifact(artifact); if (pomFile != null && Files.exists(pomFile.toPath())) {
public static Path createRandomDir(Path parentDir) { final Path dir = parentDir.resolve(UUID.randomUUID().toString()); try { Files.createDirectories(dir); } catch (IOException e) { failedToMkDir(dir); } return dir; }
groupId + '_' + artifactId + '_' + versionDir.getFileName().toString() + ".zip"); if(Files.exists(zippedFP)) { IoUtils.recursiveDelete(zippedFP); "zip", versionDir.getFileName().toString(), null, zippedFP.toFile()); Path target = Paths.get(project.getBuild().getDirectory()).resolve(project.getBuild().getFinalName() + ".zip"); IoUtils.copy(zippedFP, target); installReq.addArtifact(artifact); if (pomFile != null && Files.exists(pomFile.toPath())) {
@Override public void accept(Path t) { if (!fpPaths.contains(t.getFileName())) { IoUtils.recursiveDelete(t); } } });
@Override public void execute(FsTaskContext ctx) throws IOException { IoUtils.copy(src, resolveTarget(ctx)); } }
if (Files.exists(homePath)) { try { IoUtils.copy(homePath, stagedPath); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(homePath, stagedPath), e); IoUtils.recursiveDelete(stagedPath);
public void clearLayoutCache() throws IOException { try { IoUtils.recursiveDelete(getLayoutCache()); } finally { Files.deleteIfExists(layoutContentFile); } } }
private static void glnew(final Path target) throws ProvisioningException { try { IoUtils.copy(target, target.getParent().resolve(target.getFileName() + Constants.DOT_GLNEW)); } catch (IOException e) { throw new ProvisioningException("Failed to persist " + target.getParent().resolve(target.getFileName() + Constants.DOT_GLNEW), e); } }
if(Files.exists(target)) { log.print(formatMessage(REMOVED, removed.getRelativePath(), null)); IoUtils.recursiveDelete(target); } else { log.verbose(formatMessage(REMOVED, removed.getRelativePath(), HAS_BEEN_REMOVED_FROM_THE_UPDATED_VERSION)); log.print(formatMessage(action, update.getRelativePath(), warning)); try { IoUtils.copy(update.getPath(), target); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(update.getPath(), target), e);
public void remove(FeaturePackLocation.FPID fpid) throws ProvisioningException { IoUtils.recursiveDelete(LayoutUtils.getFeaturePackDir(home, fpid, false)); }
/** * Exports the current provisioning configuration of the installation to * the specified file. * * @param location file to which the current installation configuration should be exported * @throws ProvisioningException in case the provisioning configuration record is missing * @throws IOException in case writing to the specified file fails */ public void exportProvisioningConfig(Path location) throws ProvisioningException, IOException { Path exportPath = location; final Path userProvisionedXml = PathsUtils.getProvisioningXml(home); if(!Files.exists(userProvisionedXml)) { throw new ProvisioningException("Provisioned state record is missing for " + home); } if(Files.isDirectory(exportPath)) { exportPath = exportPath.resolve(userProvisionedXml.getFileName()); } IoUtils.copy(userProvisionedXml, exportPath); }
public void install(Path dir) throws ProvisioningException { try { universeResolution = false; buildDir = dir; for (FeaturePackBuilder fp : fps) { fp.build(); } } finally { buildDir = null; universeResolution = true; if (workDir != null) { IoUtils.recursiveDelete(workDir); } } }