Package javax.enterprise.deploy.spi.status

Examples of javax.enterprise.deploy.spi.status.ProgressObject


        if (toUndeploy.size() == 0) {
            System.out.println("Module is running or not deployed: " + getId());
            return;
        }
        moduleIds = (TargetModuleID[]) toUndeploy.toArray(new TargetModuleID[toUndeploy.size()]);
        ProgressObject progress = manager.undeploy(moduleIds);
        DeploymentClient.waitFor(progress);
    }
View Full Code Here


        DeploymentManager manager = getDeploymentManager();

        Target[] targets = manager.getTargets();
        File moduleFile = (getModule() == null)? null: getFile(getModule());
        File planFile = (getPlan() == null)? null: getFile((getPlan()));
        ProgressObject progress = manager.distribute(targets, moduleFile, planFile);
        DeploymentClient.waitFor(progress);
    }
View Full Code Here

        if (toStart.size() == 0) {
            System.out.println("Module is already running or may not be deployed: " + getId());
            return;
        }
        moduleIds = (TargetModuleID[]) toStart.toArray(new TargetModuleID[toStart.size()]);
        ProgressObject progress = manager.start(moduleIds);
        DeploymentClient.waitFor(progress);
    }
View Full Code Here

        for(int i=0; i<args.length; i++) {
            modules.addAll(DeployUtils.identifyTargetModuleIDs(allModules, args[i], false));
        }
        TargetModuleID[] ids = (TargetModuleID[]) modules.toArray(new TargetModuleID[modules.size()]);
        boolean multiple = isMultipleTargets(ids);
        ProgressObject po = runCommand(out, mgr, ids);
        TargetModuleID[] done = po.getResultTargetModuleIDs();
        out.println();
        for(int i = 0; i < done.length; i++) {
            TargetModuleID id = done[i];
            out.print(DeployUtils.reformat(getAction()+" "+id.getModuleID()+(multiple ? " on "+id.getTarget().getName() : "")+(id.getWebURL() == null || !getAction().equals("Started") ? "" : " @ "+id.getWebURL()),4, 72));
            if(id.getChildTargetModuleID() != null) {
                for (int j = 0; j < id.getChildTargetModuleID().length; j++) {
                    TargetModuleID child = id.getChildTargetModuleID()[j];
                    out.print(DeployUtils.reformat("  `-> "+child.getModuleID()+(child.getWebURL() == null || !getAction().equals("Started") ? "" : " @ "+child.getWebURL()),4, 72));
                }
            }
            out.println();
        }
        if(po.getDeploymentStatus().isFailed()) {
            throw new DeploymentException("Operation failed: "+po.getDeploymentStatus().getMessage());
        }
    }
View Full Code Here

            throw new DeploymentException("Operation failed: "+po.getDeploymentStatus().getMessage());
        }
    }

    protected ProgressObject runCommand(PrintWriter out, DeploymentManager mgr, TargetModuleID[] ids) {
        ProgressObject po = mgr.start(ids);
        waitForProgress(out, po);
        return po;
    }
View Full Code Here

                    if (null == targets) {
                        throw new IllegalStateException("No target to distribute to");
                    }
                    targets = new Target[] {targets[0]};
                   
                    ProgressObject po = mgr.distribute(targets, rarFile, tempFile);
                    po.addProgressListener(new ProgressListener() {
                       
                        public void handleProgressEvent(ProgressEvent event)  {
                            DeploymentStatus status = event.getDeploymentStatus();
                            String msg = status.getMessage();
                            if (status.isCompleted()) {
                                response.setRenderParameter("successMsg", msg);
                            } else if (status.isFailed()) {
                                response.setRenderParameter("errorMsg", msg);
                            }
                        }
                       
                    });
                    waitForProgress(po);
                    if(po.getDeploymentStatus().isCompleted()) {
                        TargetModuleID[] ids = po.getResultTargetModuleIDs();
                        po = mgr.start(ids);
                        waitForProgress(po);
                        if(po.getDeploymentStatus().isCompleted()) {
                            ids = po.getResultTargetModuleIDs();
                            log.info("Deployment completed successfully!");
                        }
                    }
                }
            } catch (Exception e) {
View Full Code Here

                for (int i=0; i < moduleIds.length; i++) {
                    String url = moduleIds[i].getWebURL();
                    log.info("Starting module: " + moduleIds[i].getModuleID() + (url == null ? "" : ("; URL: " + url)));
                }

                ProgressObject progress = getDeploymentManager().start(moduleIds);
                DeploymentStatus status = waitFor(progress);

                if (status.isFailed()) {
                    throw new MojoExecutionException("Failed to start modules: " + status.getMessage());
                }
View Full Code Here

        if (null == targets) {
            throw new IllegalStateException("No target to distribute to");
        }
        targets = new Target[] {targets[0]};
       
        ProgressObject progress = manager.distribute(targets, file, plan);
        DeploymentStatus status = waitFor(progress);

        if (status.isFailed()) {
            //
            // FIXME: There must be a better way to handle this.
            //
            if (status.getMessage().indexOf("already exists") < 0 ) {
                throw new MojoExecutionException("Distribution failed: " + status.getMessage());
            }
            log.info("Module already exists");
        }
       

        return (progress != null) ? progress.getResultTargetModuleIDs() : null;
    }
View Full Code Here

                Target[] all = mgr.getTargets();
                if (null == all) {
                    throw new IllegalStateException("No target to distribute to");
                }

                ProgressObject progress;
                if(isRedeploy) {
                    TargetModuleID[] targets = identifyTargets(moduleFile, planFile, mgr.getAvailableModules(null, all));
                    if(targets.length == 0) {
                        throw new PortletException("Unable to identify modules to replace.  Please include a Geronimo deployment plan or use the command-line deployment tool.");
                    }
                    progress = mgr.redeploy(targets, moduleFile, planFile);
                } else {
                    progress = mgr.distribute(new Target[] {all[0]}, moduleFile, planFile);
                }
                while(progress.getDeploymentStatus().isRunning()) {
                    Thread.sleep(100);
                }
               
                String abbrStatusMessage;
                String fullStatusMessage = null;
                if(progress.getDeploymentStatus().isCompleted()) {
                    abbrStatusMessage = "The application was successfully "+(isRedeploy ? "re" : "")+"deployed.<br/>";
                    // start installed app/s
                    if (!isRedeploy && startApp != null && !startApp.equals("")) {
                        progress = mgr.start(progress.getResultTargetModuleIDs());
                        while(progress.getDeploymentStatus().isRunning()) {
                            Thread.sleep(100);
                        }
                        if (progress.getDeploymentStatus().isCompleted()) {
                            abbrStatusMessage += "The application was successfully started";
                        } else {
                            abbrStatusMessage += "The application was not successfully started";
                            fullStatusMessage = progress.getDeploymentStatus().getMessage();
                        }
                    }
                } else {
                    fullStatusMessage = progress.getDeploymentStatus().getMessage();
                    // for the abbreviated status message clip off everything
                    // after the first line, which in most cases means the gnarly stacktrace
                    abbrStatusMessage = "Deployment failed:<br/>"
                                      + fullStatusMessage.substring(0, fullStatusMessage.indexOf('\n'));
                    // try to provide an upgraded version of the plan
View Full Code Here

                if (null == targets) {
                    throw new IllegalStateException("No target to distribute to");
                }
                targets = new Target[] {targets[0]};
               
                ProgressObject progress = mgr.distribute(targets, moduleFile, planFile);
                while (progress.getDeploymentStatus().isRunning()) {
                    Thread.sleep(100);
                }

                String abbrStatusMessage;
                String fullStatusMessage = null;
                if (progress.getDeploymentStatus().isCompleted()) {
                    abbrStatusMessage = "The application was successfully deployed.<br/>";
                    // start installed app/s
                    progress = mgr.start(progress.getResultTargetModuleIDs());
                    while (progress.getDeploymentStatus().isRunning()) {
                        Thread.sleep(100);
                    }
                    abbrStatusMessage += "The application was successfully started";
                } else {
                    fullStatusMessage = progress.getDeploymentStatus().getMessage();
                    // for the abbreviated status message clip off everything
                    // after the first line, which in most cases means the gnarly stacktrace
                    abbrStatusMessage = "Deployment failed:<br/>"
                            + fullStatusMessage.substring(0, fullStatusMessage.indexOf('\n'));
                }
View Full Code Here

TOP

Related Classes of javax.enterprise.deploy.spi.status.ProgressObject

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.