private DeploymentActionsCompleteBuilder undeployAndRemoveUndeployed( final DeploymentPlanBuilder builder, final List<String> deploymentNames) { DeploymentActionsCompleteBuilder completeBuilder = null; for (String deploymentName : deploymentNames) { DeploymentPlanBuilder actualBuilder = (completeBuilder == null ? builder : completeBuilder); completeBuilder = actualBuilder.undeploy(deploymentName).andRemoveUndeployed(); if (matchPatternStrategy == MatchPatternStrategy.FIRST) { break; } } return completeBuilder; }
@Override public UUID getDeploymentActionId() { return deploymentAction.getId(); }
@Override public UUID getId() { return plan.getId(); }
private String executeDeploymentPlan(DeploymentPlan plan, DeploymentAction deployAction) throws Exception { Future<DeploymentPlanResult> future = deploymentManager.execute(plan); DeploymentPlanResult planResult = future.get(); Map<String, ServerGroupDeploymentPlanResult> actionResults = planResult.getServerGroupResults(); for (Entry<String, ServerGroupDeploymentPlanResult> result : actionResults.entrySet()) { for (Entry<String, ServerDeploymentPlanResult> planServerResult : result.getValue().getServerResults().entrySet()) { ServerUpdateResult actionResult = planServerResult.getValue().getDeploymentActionResults() .get(deployAction.getId()); if (actionResult != null) { Exception deploymentException = (Exception) actionResult.getFailureResult(); if (deploymentException != null) throw deploymentException; } } } return deployAction.getDeploymentUnitUniqueName(); } }
public void undeploy(String runtimeName, String target) throws DeploymentException { try { DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan(); DeploymentPlan plan = builder.undeploy(runtimeName).remove(runtimeName).toServerGroup(target).build(); Future<DeploymentPlanResult> future = deploymentManager.execute(plan); future.get(); } catch (Exception ex) { log.warn("Cannot undeploy: " + runtimeName + ":" + ex.getMessage()); } }
private boolean stopServer() throws Exception { ServerIdentity server = chooseServer(ServerStatus.STARTED); if (server != null) { System.out.println("\nStopping server " + server.getServerName() + "\n"); ServerStatus status = client.stopServer(server.getHostName(), server.getServerName(), -1, TimeUnit.SECONDS); System.out.println("Stop executed. Server status is " + status); } return continuePrompt(); }
private boolean restartServer() throws Exception { ServerIdentity server = chooseServer(ServerStatus.STARTED); if (server != null) { System.out.println("\nRestarting server " + server.getServerName() + "\n"); ServerStatus status = client.restartServer(server.getHostName(), server.getServerName(), -1, TimeUnit.SECONDS); System.out.println("Restart executed. Server status is " + status); } return continuePrompt(); }
private boolean startServer() throws Exception { ServerIdentity server = chooseServer(ServerStatus.STOPPED, ServerStatus.DISABLED); if (server != null) { System.out.println("\nStarting server " + server.getServerName() + "\n"); ServerStatus status = client.startServer(server.getHostName(), server.getServerName()); System.out.println("Start executed. Server status is " + status); } return continuePrompt(); }
@Override public int compare(ServerIdentity o1, ServerIdentity o2) { int val = o1.getHostName().compareTo(o2.getHostName()); if (val == 0) { val = o1.getServerName().compareTo(o2.getServerName()); } return val; } }
/** * Get a shared domain client. * * @return the domain client */ public synchronized DomainClient getDomainClient() { return DomainClient.Factory.create(internalGetOrCreateClient()); }
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; }
public ServerGroupDeploymentPlan createRollingToServers() { return new ServerGroupDeploymentPlan(serverGroupName, rollback, true, maxFailures, maxFailurePercentage); }
private String executeDeploymentPlan(DeploymentPlan plan, DeploymentAction deployAction) throws Exception { Future<DeploymentPlanResult> future = deploymentManagerDeprecated.execute(plan); DeploymentPlanResult planResult = future.get(); Map<String, ServerGroupDeploymentPlanResult> actionResults = planResult.getServerGroupResults(); for (Entry<String, ServerGroupDeploymentPlanResult> result : actionResults.entrySet()) { for (Entry<String, ServerDeploymentPlanResult> planServerResult : result.getValue().getServerResults().entrySet()) { ServerUpdateResult actionResult = planServerResult.getValue().getDeploymentActionResults() .get(deployAction.getId()); if (actionResult != null) { Exception deploymentException = (Exception) actionResult.getFailureResult(); if (deploymentException != null) throw deploymentException; } } } return deployAction.getDeploymentUnitUniqueName(); } }
@Override public UUID getDeploymentActionId() { return deploymentAction.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; }
public ServerGroupDeploymentPlan createRollingToServers() { return new ServerGroupDeploymentPlan(serverGroupName, rollback, true, maxFailures, maxFailurePercentage); }
@Override public UUID getId() { return plan.getId(); }
public ServerGroupDeploymentPlan createRollback() { return new ServerGroupDeploymentPlan(serverGroupName, true, rollingToServers, maxFailures, maxFailurePercentage); }
public ServerGroupDeploymentPlan createRollback() { return new ServerGroupDeploymentPlan(serverGroupName, true, rollingToServers, maxFailures, maxFailurePercentage); }
public ServerGroupDeploymentPlan createAllowFailurePercentage(int serverFailurePercentage) { if (serverFailurePercentage < 1 || serverFailurePercentage > 99) throw MESSAGES.invalidValue("serverFailurePercentage", serverFailurePercentage, 0, 100); return new ServerGroupDeploymentPlan(serverGroupName, true, rollingToServers, maxFailures, serverFailurePercentage); }