@Override public void execute(FsTaskContext ctx) throws IOException { IoUtils.copy(src, resolveTarget(ctx)); } }
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); } }
/** * 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); }
private void patchDir(final Path fpDir, final Path patchDir) throws ProvisioningException { try { IoUtils.copy(patchDir, fpDir); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(patchDir, fpDir), e); } }
private void copyResources(Path fpDir) throws ProvisioningException { // resources should be copied last overriding the dependency resources final Path fpResources = fpDir.resolve(Constants.RESOURCES); if(Files.exists(fpResources)) { resourcesDir = getWorkDir().resolve(Constants.RESOURCES); try { IoUtils.copy(fpResources, resourcesDir); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(fpResources, resourcesDir), e); } } final Path fpPlugins = fpDir.resolve(Constants.PLUGINS); if(Files.exists(fpPlugins)) { if(pluginsDir == null) { pluginsDir = getWorkDir().resolve(Constants.PLUGINS); } try { IoUtils.copy(fpPlugins, pluginsDir); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(fpPlugins, pluginsDir), e); } } }
continue; IoUtils.copy(stateDir, stagedHistoryDir.resolve(stateId)); writer.write(stateId); writer.newLine();
"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())) {
"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())) {
continue; IoUtils.copy(stateFile, stagedHistoryDir.resolve(stateId)); writer.write(stateId); writer.newLine(); IoUtils.copy(installedConfig, stateDir.resolve(Constants.PROVISIONING_XML)); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(installedConfig, stateDir.resolve(Constants.PROVISIONING_XML)), e);
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)); } } }
if (Files.exists(homePath)) { try { IoUtils.copy(homePath, stagedPath); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(homePath, stagedPath), e);
try { Files.createDirectories(fpDir); IoUtils.copy(f.getDir(), fpDir); } catch (IOException e) { throw new ProvisioningException("Failed to patch feature-pack dir for " + f.getFPID(), e);
log.print(formatMessage(action, added.getRelativePath(), warning)); try { IoUtils.copy(added.getPath(), target); } catch (IOException e) { throw new ProvisioningException(Errors.copyFile(added.getPath(), target), e);
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);
if (Files.exists(pkgSrcDir)) { try { IoUtils.copy(pkgSrcDir, stagedDir); } catch (IOException e) { throw new FeaturePackInstallException(Errors.packageContentCopyFailed(pkg.getName()), e);