Package org.jboss.as.controller.client.helpers.domain

Examples of org.jboss.as.controller.client.helpers.domain.DeploymentActionsCompleteBuilder


    private boolean runDeploymentPlan() throws Exception {

        DomainDeploymentManager deploymentManager = client.getDeploymentManager();
        DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
        ModelNode model = getDomainModel();
        DeploymentActionsCompleteBuilder completionBuilder = null;
        String serverGroup = null;
        Set<String> includedGroups = new HashSet<String>();
        do {
            completionBuilder = deploymentSetBuilder(builder, model);
            if (completionBuilder != null) {
                serverGroup = chooseServerGroup(model, includedGroups);
            }
        }
        while (serverGroup == null && completionBuilder != null);

        if (completionBuilder != null) {
            includedGroups.add(serverGroup);
            ServerGroupDeploymentPlanBuilder groupPlanBuilder = completionBuilder.toServerGroup(serverGroup);
            DeploymentPlan plan = completeDeploymentPlan(groupPlanBuilder, model, includedGroups);
            if (plan != null) {
                Future<DeploymentPlanResult> future = deploymentManager.execute(plan);
                writeDeploymentPlanResult(future.get());
            }
View Full Code Here


                                          final String matchPattern, final MatchPatternStrategy matchPatternStrategy) {
        return new DomainDeployment(client, domain, content, name, type, matchPattern, matchPatternStrategy);
    }

    private DeploymentPlan createPlan(final DeploymentPlanBuilder builder) throws IOException, DuplicateDeploymentNameException, DeploymentFailureException {
        DeploymentActionsCompleteBuilder completeBuilder = null;
        List<String> existingDeployments = DeploymentInspector.getDeployments(client, name, matchPattern);
        switch (type) {
            case ADD: {
                completeBuilder = builder.add(name, content);
                break;
            }
            case FORCE_ADD: {
                if (existingDeployments.contains(name)) {
                    completeBuilder = builder.replace(name, content);
                } else {
                    completeBuilder = builder.add(name, content);
                }
                break;
            }
            case DEPLOY: {
                completeBuilder = builder.add(name, content).andDeploy();
                break;
            }
            case FORCE_DEPLOY: {
                if (existingDeployments.contains(name)) {
                    completeBuilder = builder.replace(name, content).deploy(name);
                } 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.");
            }
View Full Code Here

    }

    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) {
View Full Code Here

        return new DomainDeployment(client, domain, content, name, type);
    }

    private DeploymentPlan createPlan(final DeploymentPlanBuilder builder) throws IOException, DuplicateDeploymentNameException, DeploymentFailureException {
        final boolean deploymentExists = exists();
        DeploymentActionsCompleteBuilder completeBuilder = null;
        switch (type) {
            case DEPLOY: {
                completeBuilder = builder.add(name, content).andDeploy();
                break;
            }
            case FORCE_DEPLOY: {
                if (deploymentExists) {
                    completeBuilder = builder.replace(name, content);
                } else {
                    completeBuilder = builder.add(name, content).andDeploy();
                }
                break;
            }
            case REDEPLOY: {
                completeBuilder = builder.replace(name, content);
                break;
            }
            case UNDEPLOY: {
                completeBuilder = builder.undeploy(name).andRemoveUndeployed();
                break;
            }
            case UNDEPLOY_IGNORE_MISSING: {
                if (deploymentExists) {
                    completeBuilder = builder.undeploy(name).andRemoveUndeployed();
                } 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.");
            }
View Full Code Here

    private boolean runDeploymentPlan() throws Exception {

        DomainDeploymentManager deploymentManager = client.getDeploymentManager();
        DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
        ModelNode model = getDomainModel();
        DeploymentActionsCompleteBuilder completionBuilder = null;
        String serverGroup = null;
        Set<String> includedGroups = new HashSet<String>();
        do {
            completionBuilder = deploymentSetBuilder(builder, model);
            if (completionBuilder != null) {
                serverGroup = chooseServerGroup(model, includedGroups);
            }
        }
        while (serverGroup == null && completionBuilder != null);

        if (completionBuilder != null) {
            includedGroups.add(serverGroup);
            ServerGroupDeploymentPlanBuilder groupPlanBuilder = completionBuilder.toServerGroup(serverGroup);
            DeploymentPlan plan = completeDeploymentPlan(groupPlanBuilder, model, includedGroups);
            if (plan != null) {
                Future<DeploymentPlanResult> future = deploymentManager.execute(plan);
                writeDeploymentPlanResult(future.get());
            }
View Full Code Here

        return new DomainDeployment(connectionInfo, domain, content, name, type);
    }

    private DeploymentPlan createPlan(final DeploymentPlanBuilder builder) throws IOException, DuplicateDeploymentNameException, MojoFailureException {
        final boolean deploymentExists = exists();
        DeploymentActionsCompleteBuilder completeBuilder = null;
        switch (type) {
            case DEPLOY: {
                completeBuilder = builder.add(name, content).andDeploy();
                break;
            }
            case FORCE_DEPLOY: {
                if (deploymentExists) {
                    completeBuilder = builder.replace(name, content);
                } else {
                    completeBuilder = builder.add(name, content).andDeploy();
                }
                break;
            }
            case REDEPLOY: {
                completeBuilder = builder.replace(name, content);
                break;
            }
            case UNDEPLOY: {
                completeBuilder = builder.undeploy(name).andRemoveUndeployed();
                break;
            }
            case UNDEPLOY_IGNORE_MISSING: {
                if (deploymentExists) {
                    completeBuilder = builder.undeploy(name).andRemoveUndeployed();
                } 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 MojoFailureException("No server groups were defined for the deployment.");
            }
View Full Code Here

    private boolean runDeploymentPlan() throws Exception {

        DomainDeploymentManager deploymentManager = client.getDeploymentManager();
        DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
        ModelNode model = getDomainModel();
        DeploymentActionsCompleteBuilder completionBuilder = null;
        String serverGroup = null;
        Set<String> includedGroups = new HashSet<String>();
        do {
            completionBuilder = deploymentSetBuilder(builder, model);
            if (completionBuilder != null) {
                serverGroup = chooseServerGroup(model, includedGroups);
            }
        }
        while (serverGroup == null && completionBuilder != null);

        if (completionBuilder != null) {
            includedGroups.add(serverGroup);
            ServerGroupDeploymentPlanBuilder groupPlanBuilder = completionBuilder.toServerGroup(serverGroup);
            DeploymentPlan plan = completeDeploymentPlan(groupPlanBuilder, model, includedGroups);
            if (plan != null) {
                Future<DeploymentPlanResult> future = deploymentManager.execute(plan);
                writeDeploymentPlanResult(future.get());
            }
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.client.helpers.domain.DeploymentActionsCompleteBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.