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); } }
ServerGroupDeploymentPlanBuilder serverGroupBuilder = null; for (String target : serverGroups) { serverGroupBuilder = (serverGroupBuilder == null ? deployBuilder.toServerGroup(target) : serverGroupBuilder.toServerGroup(target));