@Override public UUID getId() { return plan.getId(); }
private Set<String> getServerGroupNames(DeploymentPlan plan) { Set<String> names = new HashSet<String>(); for (Set<ServerGroupDeploymentPlan> sgdps : plan.getServerGroupDeploymentPlans()) { for (ServerGroupDeploymentPlan sgdp : sgdps) { names.add(sgdp.getServerGroupName()); } } return names; }
private void executePlan(final DomainDeploymentManager manager, final DeploymentPlan plan) throws DeploymentExecutionException, ExecutionException, InterruptedException { if (plan.getDeploymentActions().size() > 0) { final DeploymentPlanResult planResult = manager.execute(plan).get(); final Map<UUID, DeploymentActionResult> actionResults = planResult.getDeploymentActionResults(); for (UUID uuid : actionResults.keySet()) { final Map<String, ServerGroupDeploymentActionResult> groupDeploymentActionResults = actionResults.get(uuid).getResultsByServerGroup(); for (String serverGroup2 : groupDeploymentActionResults.keySet()) { final Map<String, ServerUpdateResult> serverUpdateResults = groupDeploymentActionResults.get(serverGroup2).getResultByServer(); for (String server : serverUpdateResults.keySet()) { final Throwable t = serverUpdateResults.get(server).getFailureResult(); if (t != null) { throw new DeploymentExecutionException(t, "Error executing %s", type); } } } } } } }
public String deploy(Archive<?> archive, String target) throws DeploymentException { try { final InputStream input = archive.as(ZipExporter.class).exportAsInputStream(); try { InitialDeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan(); DeploymentPlan plan = builder.add(archive.getName(), input).andDeploy().toServerGroup(target).build(); DeploymentAction deployAction = plan.getDeploymentActions().get(plan.getDeploymentActions().size() - 1); return executeDeploymentPlan(plan, deployAction); } finally { if (input != null) try { input.close(); } catch (IOException e) { log.warnf(e, "Failed to close resource %s", input); } } } catch (Exception e) { throw new DeploymentException("Could not deploy to container", e); } }
DeploymentAction deployAction = plan.getDeploymentActions().get(plan.getDeploymentActions().size() - 1); return executeDeploymentPlan(plan, deployAction); } finally {
private Set<String> getServerGroupNames(DeploymentPlan plan) { Set<String> names = new HashSet<String>(); for (Set<ServerGroupDeploymentPlan> sgdps : plan.getServerGroupDeploymentPlans()) { for (ServerGroupDeploymentPlan sgdp : sgdps) { names.add(sgdp.getServerGroupName()); } } return names; }
@Override public UUID getId() { return plan.getId(); }