private static Map<String, ServerGroupDeploymentPlanResult> buildServerGroupResults(Map<UUID, DeploymentActionResult> deploymentActionResults) { Map<String, ServerGroupDeploymentPlanResult> serverGroupResults = new HashMap<String, ServerGroupDeploymentPlanResult>(); for (Map.Entry<UUID, DeploymentActionResult> entry : deploymentActionResults.entrySet()) { UUID actionId = entry.getKey(); DeploymentActionResult actionResult = entry.getValue(); Map<String, ServerGroupDeploymentActionResult> actionResultsByServerGroup = actionResult.getResultsByServerGroup(); for (ServerGroupDeploymentActionResult serverGroupActionResult : actionResultsByServerGroup.values()) { String serverGroupName = serverGroupActionResult.getServerGroupName(); ServerGroupDeploymentPlanResultImpl sgdpr = (ServerGroupDeploymentPlanResultImpl) serverGroupResults.get(serverGroupName); if (sgdpr == null) { sgdpr = new ServerGroupDeploymentPlanResultImpl(serverGroupName); serverGroupResults.put(serverGroupName, sgdpr); } for (Map.Entry<String, ServerUpdateResult> serverEntry : serverGroupActionResult.getResultByServer().entrySet()) { String serverName = serverEntry.getKey(); ServerUpdateResult sud = serverEntry.getValue(); ServerDeploymentPlanResultImpl sdpr = (ServerDeploymentPlanResultImpl) sgdpr.getServerResult(serverName); if (sdpr == null) { sdpr = new ServerDeploymentPlanResultImpl(serverName); sgdpr.storeServerResult(serverName, sdpr); } sdpr.storeServerUpdateResult(actionId, sud); } } } return serverGroupResults; }
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); } } } } } } }
private static Map<String, ServerGroupDeploymentPlanResult> buildServerGroupResults(Map<UUID, DeploymentActionResult> deploymentActionResults) { Map<String, ServerGroupDeploymentPlanResult> serverGroupResults = new HashMap<String, ServerGroupDeploymentPlanResult>(); for (Map.Entry<UUID, DeploymentActionResult> entry : deploymentActionResults.entrySet()) { UUID actionId = entry.getKey(); DeploymentActionResult actionResult = entry.getValue(); Map<String, ServerGroupDeploymentActionResult> actionResultsByServerGroup = actionResult.getResultsByServerGroup(); for (ServerGroupDeploymentActionResult serverGroupActionResult : actionResultsByServerGroup.values()) { String serverGroupName = serverGroupActionResult.getServerGroupName(); ServerGroupDeploymentPlanResultImpl sgdpr = (ServerGroupDeploymentPlanResultImpl) serverGroupResults.get(serverGroupName); if (sgdpr == null) { sgdpr = new ServerGroupDeploymentPlanResultImpl(serverGroupName); serverGroupResults.put(serverGroupName, sgdpr); } for (Map.Entry<String, ServerUpdateResult> serverEntry : serverGroupActionResult.getResultByServer().entrySet()) { String serverName = serverEntry.getKey(); ServerUpdateResult sud = serverEntry.getValue(); ServerDeploymentPlanResultImpl sdpr = (ServerDeploymentPlanResultImpl) sgdpr.getServerResult(serverName); if (sdpr == null) { sdpr = new ServerDeploymentPlanResultImpl(serverName); sgdpr.storeServerResult(serverName, sdpr); } sdpr.storeServerUpdateResult(actionId, sud); } } } return serverGroupResults; }