/** * (Re-)provisions the current installation to the desired specification. * * @param provisioningConfig the desired installation specification * @throws ProvisioningException in case provisioning fails */ public void provision(ProvisioningConfig provisioningConfig) throws ProvisioningException { provision(provisioningConfig, Collections.emptyMap()); }
/** * Provision the state described in the specified XML file. * * @param provisioningXml file describing the desired provisioned state * @throws ProvisioningException in case provisioning fails */ public void provision(Path provisioningXml) throws ProvisioningException { provision(provisioningXml, Collections.emptyMap()); }
@Override protected void doRunCommand(PmCommandInvocation invoc, Map<String, String> options) throws CommandExecutionException { String file = getFile(); if (file == null) { throw new CommandExecutionException("No provisioning file provided."); } try { final Path provisioningFile = getAbsolutePath(file, invoc.getConfiguration().getAeshContext()); if (!Files.exists(provisioningFile)) { throw new CommandExecutionException("Failed to locate provisioning file " + provisioningFile.toAbsolutePath()); } getManager(invoc).provision(provisioningFile, options); } catch (ProvisioningException | IOException e) { throw new CommandExecutionException(invoc.getPmSession(), CliErrors.provisioningFailed(), e); } }
@Override protected void doRunCommand(PmCommandInvocation invoc, Map<String, String> options) throws CommandExecutionException { State state = invoc.getPmSession().getState(); try { getManager(invoc).provision(state.getConfig(), options); } catch (ProvisioningException | IOException ex) { throw new CommandExecutionException(invoc.getPmSession(), CliErrors.provisioningFailed(), ex); } Path home = getInstallationDirectory(invoc.getConfiguration().getAeshContext()); if (home != null && Files.exists(home)) { try { invoc.println("Installation done in " + home.toFile().getCanonicalPath()); } catch (IOException ex) { throw new CommandExecutionException(invoc.getPmSession(), CliErrors.retrievePath(), ex); } } else { invoc.println("Nothing to install"); } }
.setInstallationHome(installDir.toPath()).build(); pm.provision(state.build(), pluginOptions);
pm.provision(state.build(), pluginOptions);