本文整理汇总了Java中org.jboss.as.controller.client.helpers.domain.DeploymentPlan类的典型用法代码示例。如果您正苦于以下问题:Java DeploymentPlan类的具体用法?Java DeploymentPlan怎么用?Java DeploymentPlan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeploymentPlan类属于org.jboss.as.controller.client.helpers.domain包,在下文中一共展示了DeploymentPlan类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeDeploymentPlan
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
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();
}
示例2: DeploymentPlanResultImpl
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
public DeploymentPlanResultImpl(final DeploymentPlan plan, final Map<UUID, DeploymentActionResult> results) {
assert plan != null : "plan is null";
assert results != null : "results is null";
this.plan = plan;
this.idpe = null;
this.results = results;
}
示例3: execute
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
@Override
public Future<DeploymentPlanResult> execute(DeploymentPlan plan) {
if (!(plan instanceof DeploymentPlanImpl)) {
throw ControllerClientLogger.ROOT_LOGGER.cannotUseDeploymentPlan();
}
DeploymentPlanImpl planImpl = DeploymentPlanImpl.class.cast(plan);
Map<UUID, List<String>> actionsById = new HashMap<UUID, List<String>>();
Operation operation = getDeploymentPlanOperation(planImpl, actionsById);
Future<ModelNode> future = client.executeAsync(operation, null);
return new DomainDeploymentPlanResultFuture(planImpl, future, new LinkedHashSet<ServerIdentity>(client.getServerStatuses().keySet()), actionsById);
}
示例4: getServerGroupNames
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
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;
}
示例5: executePlan
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
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);
}
}
}
}
}
}
示例6: undeploy
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
/**
* Undeploys the content specified by the {@code runtimeName} from the server groups.
*
* @param runtimeName the name of the deployment
* @param serverGroups the server groups to undeploy to
*
* @throws DeploymentException if an error occurs during undeployment
*/
public void undeploy(String runtimeName, Set<String> serverGroups) throws DeploymentException {
if (serverGroups.isEmpty()) {
throw new DeploymentException("No target server groups to deploy to.");
}
try {
if (deploymentManager != null) {
final DeploymentResult result = deploymentManager.undeploy(UndeployDescription.of(runtimeName)
.addServerGroups(serverGroups));
if (!result.successful()) {
log.warnf("Cannot undeploy %s: %s", runtimeName, result.getFailureMessage());
}
} else {
DeploymentPlanBuilder builder = deploymentManagerDeprecated.newDeploymentPlan();
UndeployDeploymentPlanBuilder undeployBuilder = builder.undeploy(runtimeName);
ServerGroupDeploymentPlanBuilder serverGroupBuilder = null;
for (String target : serverGroups) {
serverGroupBuilder = (serverGroupBuilder == null ? undeployBuilder.toServerGroup(target) : serverGroupBuilder.toServerGroup(target));
}
@SuppressWarnings("ConstantConditions")
DeploymentPlan plan = serverGroupBuilder.build();
Future<DeploymentPlanResult> future = deploymentManagerDeprecated.execute(plan);
future.get();
}
} catch (Exception ex) {
log.warnf("Cannot undeploy %s: %s", runtimeName, ex.getLocalizedMessage());
}
}
示例7: testGracefulShutdownDomainLevel
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
@Test
public void testGracefulShutdownDomainLevel() throws Exception {
DomainClient client = domainMasterLifecycleUtil.getDomainClient();
DomainDeploymentManager deploymentManager = client.getDeploymentManager();
DeploymentPlan plan = deploymentManager.newDeploymentPlan().add(WEB_SUSPEND_JAR, createDeployment().as(ZipExporter.class).exportAsInputStream())
.andDeploy().toServerGroup(MAIN_SERVER_GROUP)
.build();
deploymentManager.execute(plan).get();
final String address = "http://" + TestSuiteEnvironment.getServerAddress() + ":8080/web-suspend";
ExecutorService executorService = Executors.newSingleThreadExecutor();
try {
Future<Object> result = executorService.submit(new Callable<Object>() {
@Override
public Object call() throws Exception {
return HttpRequest.get(address, 60, TimeUnit.SECONDS);
}
});
Thread.sleep(1000); //nasty, but we need to make sure the HTTP request has started
ModelNode op = new ModelNode();
op.get(ModelDescriptionConstants.OP).set("stop-servers");
op.get(ModelDescriptionConstants.TIMEOUT).set(60);
op.get(ModelDescriptionConstants.BLOCKING).set(false);
client.execute(op);
//make sure requests are being rejected
final HttpURLConnection conn = (HttpURLConnection) new URL(address).openConnection();
try {
conn.setDoInput(true);
int responseCode = conn.getResponseCode();
Assert.assertEquals(503, responseCode);
} finally {
conn.disconnect();
}
//make sure the server is still up, and trigger the actual shutdown
HttpRequest.get(address + "?" + TestUndertowService.SKIP_GRACEFUL + "=true", 10, TimeUnit.SECONDS);
Assert.assertEquals(SuspendResumeHandler.TEXT, result.get());
//make sure our initial request completed
Assert.assertEquals(SuspendResumeHandler.TEXT, result.get());
} finally {
plan = deploymentManager.newDeploymentPlan().undeploy(WEB_SUSPEND_JAR)
.andRemoveUndeployed()
.toServerGroup(MAIN_SERVER_GROUP)
.build();
deploymentManager.execute(plan).get();
}
}
示例8: getDeploymentPlan
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
@Override
public DeploymentPlan getDeploymentPlan() {
return plan;
}
示例9: createPlan
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
private DeploymentPlan createPlan(final DeploymentPlanBuilder builder) throws IOException,
DuplicateDeploymentNameException, DeploymentFailureException
{
DeploymentActionsCompleteBuilder completeBuilder = null;
List<String> existingDeployments = DeploymentInspector.getDeployments(client, name, matchPattern);
switch (type)
{
case DEPLOY:
{
completeBuilder = builder.add(name, content).andDeploy();
break;
}
case FORCE_DEPLOY:
{
if (existingDeployments.contains(name))
{
completeBuilder = builder.replace(name, content);
} else
{
completeBuilder = builder.add(name, content).andDeploy();
}
break;
}
case REDEPLOY:
{
completeBuilder = builder.replace(name, content);
break;
}
case UNDEPLOY:
{
validateExistingDeployments(existingDeployments);
completeBuilder = undeployAndRemoveUndeployed(builder, existingDeployments);
break;
}
case UNDEPLOY_IGNORE_MISSING:
{
validateExistingDeployments(existingDeployments);
if (!existingDeployments.isEmpty())
{
completeBuilder = undeployAndRemoveUndeployed(builder, existingDeployments);
} else
{
return null;
}
}
}
if (completeBuilder != null)
{
ServerGroupDeploymentPlanBuilder groupDeploymentBuilder = null;
for (String serverGroupName : domain.getServerGroups())
{
groupDeploymentBuilder = (groupDeploymentBuilder == null ? completeBuilder
.toServerGroup(serverGroupName) : groupDeploymentBuilder
.toServerGroup(serverGroupName));
}
if (groupDeploymentBuilder == null)
{
throw new DeploymentFailureException(
"No server groups were defined for the deployment.");
}
return groupDeploymentBuilder.withRollback().build();
}
throw new IllegalStateException(String.format("Invalid type '%s' for deployment", type));
}
示例10: build
import org.jboss.as.controller.client.helpers.domain.DeploymentPlan; //导入依赖的package包/类
/**
* Creates the deployment plan.
*
* @return the deployment plan
*/
public DeploymentPlan build() {
return new DeploymentPlanImpl(setPlan, rollbackAcrossGroups);
}