Package javax.enterprise.deploy.spi.status

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


                    if (null == targets) {
                        throw new IllegalStateException("No target to distribute to");
                    }
                    targets = new Target[] {targets[0]};
                   
                    ProgressObject po = mgr.distribute(targets, rarFile, tempFile);
                    waitForProgress(po);
                    if(po.getDeploymentStatus().isCompleted()) {
                        TargetModuleID[] ids = po.getResultTargetModuleIDs();
                        po = mgr.start(ids);
                        waitForProgress(po);
                        if(po.getDeploymentStatus().isCompleted()) {
                            ids = po.getResultTargetModuleIDs();
                            portlet.addInfoMessage(request, portlet.getLocalizedString(request, "activemq.infoMsg02"));
                            log.info("Deployment completed successfully!");
                        }
                    } else if (po.getDeploymentStatus().isFailed()){
                        portlet.addErrorMessage(request, portlet.getLocalizedString(request, "activemq.errorMsg02"), po.getDeploymentStatus().getMessage());
                    }
                }
            } catch (Exception e) {
                log.error("Unable to save connection pool", e);
            } finally {
View Full Code Here


    protected String getAction() {
        return "Deployed";
    }

    protected ProgressObject runCommand(DeploymentManager mgr, ConsoleReader out, boolean inPlace, Target[] tlist, File module, File plan) throws DeploymentException {
        ProgressObject po = super.runCommand(mgr, out, inPlace, tlist, module, plan);
        waitForProgress(out, po);
        if(po.getDeploymentStatus().isFailed()) {
            throw new DeploymentException("Unable to deploy "+(module == null ? plan.getName() : module.getName())+": "+po.getDeploymentStatus().getMessage());
        }
        return mgr.start(po.getResultTargetModuleIDs());
    }
View Full Code Here

            if (found.length == 0) {
                throw new MojoExecutionException("Module is not deployed: " + moduleId);
            }

            log.info("Starting module: " + moduleId);
            ProgressObject progress = manager.start(found);
           
            DeploymentStatus status = waitFor(progress);
            if (status.isFailed()) {
                throw new MojoExecutionException("Failed to start module: " + moduleId);
            }
View Full Code Here

           if (found.length == 0) {
               throw new MojoExecutionException("Module not deployed: " + moduleId);
           }

           log.info("Stopping module: " + moduleId);
           ProgressObject progress = manager.stop(found);

           DeploymentStatus status = waitFor(progress);
           if (status.isFailed()) {
               throw new MojoExecutionException("Failed to stop module: " + moduleId);
           }
View Full Code Here

              continue;
              //throw new Exception("Module is not deployed: " + moduleId);
          }

          log.info("Undeploying module: " + moduleId);
          ProgressObject progress = manager.undeploy(found);

          DeploymentStatus status = waitFor(progress);
          if (status.isFailed()) {
              throw new MojoExecutionException("Failed to undeploy module: " + moduleId);
          }
View Full Code Here

    private void executeOnline(ServerConnection connection, boolean inPlace, List targets, ConsoleReader out, File module, File plan) throws DeploymentException, IOException {
        final DeploymentManager mgr = connection.getDeploymentManager();
        TargetModuleID[] results;
        boolean multipleTargets;
        ProgressObject po;
        if(targets.size() > 0) {
            Target[] tlist = identifyTargets(targets, mgr);
            multipleTargets = tlist.length > 1;
            po = runCommand(mgr, out, inPlace, tlist, module, plan);
            waitForProgress(out, po);
        } else {
            Target[] tlist = mgr.getTargets();
            if (null == tlist) {
                throw new IllegalStateException("No target to distribute to");
            }
            tlist = new Target[] {tlist[0]};

            multipleTargets = tlist.length > 1;
            po = runCommand(mgr, out, inPlace, tlist, module, plan);
            waitForProgress(out, po);
        }

        // print the results that succeeded
        results = po.getResultTargetModuleIDs();
        for (TargetModuleID result : results) {
            out.printString(DeployUtils.reformat(
                    getAction() + " " + result.getModuleID() + (multipleTargets ? " to " + result.getTarget().getName() : "") + (result.getWebURL() == null || !getAction().equals("Deployed") ? "" : " @ " + result.getWebURL()), 4, 72));
            if (result.getChildTargetModuleID() != null) {
                for (int j = 0; j < result.getChildTargetModuleID().length; j++) {
                    TargetModuleID child = result.getChildTargetModuleID()[j];
                    out.printString(DeployUtils.reformat("  `-> " + child.getModuleID() + (child.getWebURL() == null || !getAction().equals("Deployed") ? "" : " @ " + child.getWebURL()), 4, 72));
                }
            }
        }

        // if any results failed then throw so that we'll return non-0
        // to the operating system
        if(po.getDeploymentStatus().isFailed()) {
            throw new DeploymentException("Operation failed: "+po.getDeploymentStatus().getMessage());
        }
    }
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);
                }

                if (progress.getDeploymentStatus().isCompleted()) {
                    progress = mgr.start(progress.getResultTargetModuleIDs());
                    while (progress.getDeploymentStatus().isRunning()) {
                        Thread.sleep(100);
                    }
                    statusMsgs[0] = "infoMsg01";
                } else {
                    statusMsgs[0] = "errorMsg02";
                    statusMsgs[1] = progress.getDeploymentStatus().getMessage();
                }
            } finally {
                mgr.release();
            }
        } catch (Exception e) {
View Full Code Here

            if (null == targets) {
                throw new IllegalStateException("No target to distribute to");
            }
            targets = new Target[] {targets[0]};

            ProgressObject po;

            if (FileUtils.isJarFile(file) || file.isDirectory()) {
                po = mgr.distribute(targets, file, null);
            } else {
                po = mgr.distribute(targets, null, file);
            }
            waitForProgress(po);
            if (po.getDeploymentStatus().isCompleted()) {
                modules = po.getResultTargetModuleIDs();
                po = mgr.start(modules);
                waitForProgress(po);
                if (po.getDeploymentStatus().isCompleted()) {
                    completed = true;
                } else {
                    log.warn("Unable to start some modules for " + file.getAbsolutePath());
                }
                modules = po.getResultTargetModuleIDs();
                for (int i = 0; i < modules.length; i++) {
                    TargetModuleID result = modules[i];
                    log.info(DeployUtils.reformat("Deployed " + result.getModuleID() + (targets.length > 1 ? " to " + result.getTarget().getName() : "") + (result.getWebURL() == null ? "" : " @ " + result.getWebURL()), 4, 72));
                    if (result.getChildTargetModuleID() != null) {
                        for (int j = 0; j < result.getChildTargetModuleID().length; j++) {
                            TargetModuleID child = result.getChildTargetModuleID()[j];
                            log.info(DeployUtils.reformat("  `-> " + child.getModuleID() + (child.getWebURL() == null ? "" : " @ " + child.getWebURL()), 4, 72));
                        }
                    }
                }
            } else {
               //Try to delete the module , that failed to successfully hot-deploy 
              log.error("Unable to deploy: " + po.getDeploymentStatus().getMessage());
              String delfile=file.getAbsolutePath();
                File fd = new File(delfile);
                if(fd.isDirectory()){
                     log.info("Deleting the Directory: "+delfile);
                     if(DeploymentUtil.recursiveDelete(fd))
View Full Code Here

        try {
            mgr = getDeploymentManager();
            Target[] targets = mgr.getTargets();
            TargetModuleID[] ids = mgr.getAvailableModules(null, targets);
            ids = (TargetModuleID[]) DeployUtils.identifyTargetModuleIDs(ids, configId, true).toArray(new TargetModuleID[0]);
            ProgressObject po = mgr.undeploy(ids);
            waitForProgress(po);
            if (po.getDeploymentStatus().isCompleted()) {
                TargetModuleID[] modules = po.getResultTargetModuleIDs();
                for (int i = 0; i < modules.length; i++) {
                    TargetModuleID result = modules[i];
                    log.info(DeployUtils.reformat("Undeployed " + result.getModuleID() + (targets.length > 1 ? " to " + result.getTarget().getName() : ""), 4, 72));
                }
            } else {
                log.error("Unable to undeploy " + file.getAbsolutePath() + "(" + configId + ")" + po.getDeploymentStatus().getMessage());
                return false;
            }
        } catch (DeploymentManagerCreationException e) {
            log.error("Unable to open deployer", e);
            return false;
View Full Code Here

        try {
            mgr = getDeploymentManager();
            Target[] targets = mgr.getTargets();
            TargetModuleID[] ids = mgr.getAvailableModules(null, targets);
            ids = (TargetModuleID[]) DeployUtils.identifyTargetModuleIDs(ids, configId, true).toArray(new TargetModuleID[0]);
            ProgressObject po;
            if (FileUtils.isJarFile(file) || file.isDirectory()) {
                po = mgr.redeploy(ids, file, null);
            } else {
                po = mgr.redeploy(ids, null, file);
            }
            waitForProgress(po);
            if (po.getDeploymentStatus().isCompleted()) {
                modules = po.getResultTargetModuleIDs();
                for (int i = 0; i < modules.length; i++) {
                    TargetModuleID result = modules[i];
                    log.info(DeployUtils.reformat("Redeployed " + result.getModuleID() + (targets.length > 1 ? " to " + result.getTarget().getName() : "") + (result.getWebURL() == null ? "" : " @ " + result.getWebURL()), 4, 72));
                    if (result.getChildTargetModuleID() != null) {
                        for (int j = 0; j < result.getChildTargetModuleID().length; j++) {
                            TargetModuleID child = result.getChildTargetModuleID()[j];
                            log.info(DeployUtils.reformat("  `-> " + child.getModuleID() + (child.getWebURL() == null ? "" : " @ " + child.getWebURL()), 4, 72));
                        }
                    }
                }
            } else {
                log.error("Unable to undeploy " + file.getAbsolutePath() + "(" + configId + ")" + po.getDeploymentStatus().getMessage());
            }
        } catch (DeploymentManagerCreationException e) {
            log.error("Unable to open deployer", e);
        } catch (Exception e) {
            log.error("Unable to undeploy", e);
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.