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

Examples of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder


            String contextName = DeploymentHolderService.getContextName(dep);
            DeploymentHolderService.addService(serviceTarget, contextName, dep);

            // Build and execute the deployment plan
            InputStream inputStream = dep.getRoot().openStream();
            DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
            builder = builder.add(contextName, inputStream).andDeploy();
            DeploymentPlan plan = builder.build();
            DeploymentAction deployAction = builder.getLastAction();
            executeDeploymentPlan(plan, deployAction);

        } catch (RuntimeException rte) {
            throw rte;
        } catch (BundleException ex) {
View Full Code Here


    public void uninstallBundle(Deployment dep) {
        log.tracef("Uninstall deployment: %s", dep);

        try {
            // Undeploy through the deployment manager
            DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
            String contextName = DeploymentHolderService.getContextName(dep);
            builder = builder.undeploy(contextName).remove(contextName);
            DeploymentPlan plan = builder.build();
            DeploymentAction removeAction = builder.getLastAction();
            executeDeploymentPlan(plan, removeAction);
        } catch (Exception ex) {
            log.warn("Cannot undeploy bundle: " + dep, ex);
        }
    }
View Full Code Here

    @Override
    public Status execute() throws MojoExecutionException, MojoFailureException {
        Status resultStatus = Status.SUCCESS;
        try {
            final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
            final DeploymentPlanBuilder builder = manager.newDeploymentPlan();
            final DeploymentPlan plan = createPlan(builder);
            if (plan != null) {
                if (plan.getDeploymentActions().size() > 0) {
                    final ServerDeploymentPlanResult planResult = manager.execute(plan).get();
                    // Check the results
View Full Code Here

    public String deploy(Archive<?> archive) throws DeploymentException {
        try {
            final InputStream input = archive.as(ZipExporter.class).exportAsInputStream();
            try {
                DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
                builder = builder.add(archive.getName(), input).andDeploy();
                DeploymentPlan plan = builder.build();
                DeploymentAction deployAction = builder.getLastAction();
                return executeDeploymentPlan(plan, deployAction);
            } finally {
                if(input != null) try {
                    input.close();
                } catch (IOException e) {
View Full Code Here

        }
    }

    public void undeploy(String runtimeName) throws DeploymentException {
        try {
            DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
            DeploymentPlan plan = builder.undeploy(runtimeName).remove(runtimeName).build();
            Future<ServerDeploymentPlanResult> future = deploymentManager.execute(plan);
            future.get();
        } catch (Exception ex) {
            log.warn("Cannot undeploy: " + runtimeName + ":" + ex.getMessage());
        }
View Full Code Here

        deploymentManager = ServerDeploymentManager.Factory.create(address, 9999);
    }

    @Override
    public void deploy(final URL archiveURL) throws Exception {
        final DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan().add(archiveURL).andDeploy();
        final DeploymentPlan plan = builder.build();
        final DeploymentAction deployAction = builder.getLastAction();
        final String uniqueId = deployAction.getDeploymentUnitUniqueName();
        try {
            executeDeploymentPlan(plan, deployAction);
        } finally {
            url2Id.put(archiveURL, uniqueId);
View Full Code Here

        }
    }

    @Override
    public void undeploy(final URL archiveURL) throws Exception {
        final DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
        final String uniqueName = url2Id.get(archiveURL);
        final DeploymentPlan plan = builder.undeploy(uniqueName).remove(uniqueName).build();
        final DeploymentAction deployAction = builder.getLastAction();
        try {
            executeDeploymentPlan(plan, deployAction);
        } finally {
            url2Id.remove(archiveURL);
        }
View Full Code Here

    public static StandaloneDeployment create(final ConnectionInfo connectionInfo, final File content, final String name, final Type type) {
        return new StandaloneDeployment(connectionInfo, content, name, type);
    }

    private DeploymentPlan createPlan(final DeploymentPlanBuilder builder) throws IOException {
        DeploymentPlanBuilder planBuilder = builder;
        switch (type) {
            case DEPLOY: {
                planBuilder = builder.add(name, content).andDeploy();
                break;
            }
            case REDEPLOY: {
                planBuilder = builder.replace(name, content).redeploy(name);
                break;
            }
            case UNDEPLOY: {
                planBuilder = builder.undeploy(name).remove(name);
                break;
            }
            case FORCE_DEPLOY: {
                if (exists()) {
                    planBuilder = builder.replace(name, content).redeploy(name);
                } else {
                    planBuilder = builder.add(name, content).andDeploy();
                }
                break;
            }
            case UNDEPLOY_IGNORE_MISSING: {
                if (exists()) {
                    planBuilder = builder.undeploy(name).remove(name);
                } else {
                    return null;
                }
                break;
            }
        }
        return planBuilder.build();
    }
View Full Code Here

    }

    @Override
    public void deploy(TargetModuleID targetModuleID) throws Exception {
        log.infof("Begin deploy: %s", targetModuleID);
        DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
        builder = builder.add(targetModuleID.getModuleID(), new URL(targetModuleID.getModuleID())).andDeploy();
        DeploymentPlan plan = builder.build();
        DeploymentAction deployAction = builder.getLastAction();
        String runtimeName = executeDeploymentPlan(plan, deployAction);
        runtimeNames.put(targetModuleID, runtimeName);
        log.infof("End deploy: %s", targetModuleID);
    }
View Full Code Here

    @Override
    public void undeploy(TargetModuleID targetModuleID) throws Exception {
        String runtimeName = runtimeNames.remove(targetModuleID);
        if (runtimeName != null) {
            DeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
            DeploymentPlan plan = builder.undeploy(runtimeName).remove(runtimeName).build();
            Future<ServerDeploymentPlanResult> future = deploymentManager.execute(plan);
            future.get();
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder

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.