Package org.jboss.deployers.spi.management.deploy

Examples of org.jboss.deployers.spi.management.deploy.DeploymentProgress


      checkComplete(progress);     
   }
  
   protected void remove(String[] names) throws Exception
   {
      DeploymentProgress progress = this.deploymentMgr.remove(names);
      progress.run();
     
      checkComplete(progress);     
   }
View Full Code Here


        for (int i = 0; i<arr.length; i++) {
          repositoryName = arr[i];
        }
       
        if (repositoryName != null) {
          DeploymentProgress stop   = null;
          try {
            stop = deployMgr.stop(repositoryName);
              if (stop != null)
                stop.run();
          } catch (Throwable t) {
            log.error("Could not find deployment to delete.  " + t.getMessage());  
            return;
          } finally {
              jbossASComponent.disconnectFromProfileService();
          }

          DeploymentStatus stopStatus = stop.getDeploymentStatus();         
          if (stopStatus.isFailed()) {
           
            if ((stopStatus.getFailure() != null) && (stopStatus.getFailure().getCause() != null)
                && (stopStatus.getFailure().getCause() instanceof java.lang.NullPointerException)) {                   
              // jon 2.3 case
              // If we get a NPE here, it means that the .esb deployment has already been deleted
                  // Return here because otherwise JON will not update and remove the deployment
                  log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
                  jbossASComponent.disconnectFromProfileService();

                  return;
              } else if ((stopStatus.getFailure().getCause() != null)
                && (stopStatus.getFailure().getCause() instanceof org.jboss.profileservice.spi.NoSuchDeploymentException)) {
                  // jon 2.4 case
                // If we get a NPE here, it means that the .esb deployment has already been deleted
                  // Return here because otherwise JON will not update and remove the deployment
                  log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
                  jbossASComponent.disconnectFromProfileService();
     
                  return;
              }
              log.error("Failed to stop deployment '" + repositoryName + "'.", stopStatus.getFailure());
              throw new Exception("Failed to stop deployment '" + repositoryName + "' - cause: "
                  + stopStatus.getFailure());
          }       
            DeploymentProgress remove = deployMgr.remove(repositoryName);       
            if (remove != null) {
                remove.run();
              DeploymentStatus status = remove.getDeploymentStatus();
              if (status.isFailed()) {
                log.error("Failed to remove deployment '" + repositoryName + "'.", status.getFailure());
                throw new Exception("Failed to remove deployment '" + repositoryName + ".    "
                    + "If the deployment has already been removed through other means and you want to "
                    + "remove it from JON, uninventory it from the Resources section.   Cause: "
View Full Code Here

            return response;
        }

        // Now stop the original app.
        try {
            DeploymentProgress progress = deploymentManager.stop(deploymentName);
            DeploymentUtils.run(progress);
        } catch (Exception e) {
            throw new RuntimeException("Failed to stop deployment [" + deploymentName + "].", e);
        }

        // And then remove it (this will delete the physical file/dir from the deploy dir).
        try {
            DeploymentProgress progress = deploymentManager.remove(deploymentName);
            DeploymentUtils.run(progress);
        } catch (Exception e) {
            throw new RuntimeException("Failed to remove deployment [" + deploymentName + "].", e);
        }
View Full Code Here

        String deploymentName = getDeploymentName();
        if (deploymentName == null) {
            throw new IllegalStateException("Deployment " + getDeploymentKey() + " has vanished");
        }

        DeploymentProgress progress = deploymentManager.stop(deploymentName);
        DeploymentStatus stopStatus = DeploymentUtils.run(progress);
        if (stopStatus.isFailed()) {
            LOG.error("Failed to stop deployment '" + deploymentName + "'.", stopStatus.getFailure());
            throw new Exception("Failed to stop deployment '" + deploymentName + "' - cause: "
                + stopStatus.getFailure());
View Full Code Here

        }
        List<DeploymentOption> deploymentOptions = new ArrayList<DeploymentOption>();
        if (deployExploded) {
            deploymentOptions.add(DeploymentOption.Explode);
        }
        DeploymentProgress progress = null;
        DeploymentStatus distributeStatus;
        Exception distributeFailure = null;
        try {
            progress = deploymentManager.distribute(archiveFileName, contentURL,
                deploymentOptions.toArray(new DeploymentOption[deploymentOptions.size()]));
            distributeStatus = run(progress);
            if (distributeStatus.isFailed()) {
                distributeFailure = (distributeStatus.getFailure() != null) ? distributeStatus.getFailure()
                    : new Exception("Distribute failed for unknown reason.");
            }
        } catch (Exception e) {
            distributeFailure = e;
        }
        if (distributeFailure != null) {
            throw new Exception("Failed to distribute '" + contentURL + "' to '" + archiveFileName + "' - cause: "
                + ThrowableUtil.getAllMessages(distributeFailure));
        }

        // Now that we've successfully distributed the deployment, try to start it.
        String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();
        DeploymentStatus startStatus;
        Exception startFailure = null;
        try {
            progress = deploymentManager.start(deploymentNames);
            startStatus = run(progress);
View Full Code Here

        if (parentDeployment.getComponents().size() > 1 || !parentDeployment.getChildren().isEmpty()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Redeploying parent deployment '" + parentDeployment.getName()
                    + "' in order to complete removal of component " + toString(managedComponent) + "...");
            }
            DeploymentProgress progress = deploymentManager.redeploy(parentDeployment.getName());
            DeploymentStatus status = DeploymentUtils.run(progress);
            if (status.isFailed()) {
                LOG.error("Failed to redeploy parent deployment '" + parentDeployment.getName()
                    + "during removal of component " + toString(managedComponent)
                    + " - removal may not persist when the app server is restarted.", status.getFailure());
            }
        } else {
            //this is the last component of the deployment and nothing would be left there after
            //the component was removed. Let's just undeploy it in addition to removing the component.
            //This will make sure that the deployment doesn't leave behind any defunct config files, etc.
            if (LOG.isDebugEnabled()) {
                LOG.debug("Undeploying parent deployment '" + parentDeployment.getName()
                    + "' in order to complete removal of component " + toString(managedComponent) + "...");
            }
            parentDeployment = managementView.getDeployment(parentDeployment.getName());
            DeploymentProgress progress = deploymentManager.remove(parentDeployment.getName());
            DeploymentStatus status = DeploymentUtils.run(progress);
            if (status.isFailed()) {
                LOG.error("Failed to undeploy parent deployment '" + parentDeployment.getName()
                    + "during removal of component " + toString(managedComponent)
                    + " - removal may not persist when the app server is restarted.", status.getFailure());
View Full Code Here

     * @throws Exception
     */
    public static void deployFileToAS(String name, File archiveFile, boolean exploded) throws Exception {
        DeploymentManager deploymentManager = getDeploymentManager();

        DeploymentProgress progress = deploymentManager.distribute(name, archiveFile.toURI().toURL(), exploded);
        progress.run();

        DeploymentStatus status = progress.getDeploymentStatus();

        if (status.isFailed()) {
            throw new IllegalStateException("Failed to distribute " + archiveFile.getAbsolutePath() + " with message: "
                + status.getMessage());
        }

        String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();

        progress = deploymentManager.start(deploymentNames);
        progress.run();

        status = progress.getDeploymentStatus();

        if (status.isFailed()) {
            throw new IllegalStateException("Failed to start " + archiveFile.getAbsolutePath() + " with message: "
                + status.getMessage());
        }
View Full Code Here

     */
    public static void undeployFromAS(String archiveName) throws Exception {
        DeploymentManager deploymentManager = getDeploymentManager();

       
        DeploymentProgress progress = deploymentManager.stop(archiveName);
        progress.run();

        DeploymentStatus status = progress.getDeploymentStatus();

        if (status.isFailed()) {
            throw new IllegalStateException("Failed to stop " + archiveName + " with message: "
                + status.getMessage());
        }

        progress = deploymentManager.remove(archiveName);
        progress.run();

        status = progress.getDeploymentStatus();

        if (status.isFailed()) {
            throw new IllegalStateException("Failed to undeploy " + archiveName + " with message: "
                + status.getMessage());
        }
View Full Code Here

            result.setErrorMessage("Did not find deployment with key [" + deploymentKey + "]");
            return result;
        }

        DeploymentManager deploymentManager = connection.getDeploymentManager();
        DeploymentProgress progress;
        if (name.equals("start")) {
            //FIXME: This is a workaround until JOPR-309 will be fixed.
            if (getAvailability() != AvailabilityType.UP) {
                progress = deploymentManager.start(deploymentName);
            } else {
View Full Code Here

   */
  public static void deployFileToAS(String name, File archiveFile,
      boolean exploded) throws Exception {
    DeploymentManager deploymentManager = getDeploymentManager();

    DeploymentProgress progress = deploymentManager.distribute(name,
        archiveFile.toURI().toURL(), exploded);
    progress.run();

    DeploymentStatus status = progress.getDeploymentStatus();

    if (status.isFailed()) {
      throw new IllegalStateException("Failed to distribute "
          + archiveFile.getAbsolutePath() + " with message: "
          + status.getMessage());
    }

    String[] deploymentNames = progress.getDeploymentID()
        .getRepositoryNames();

    progress = deploymentManager.start(deploymentNames);
    progress.run();

    status = progress.getDeploymentStatus();

    if (status.isFailed()) {
      throw new IllegalStateException("Failed to start "
          + archiveFile.getAbsolutePath() + " with message: "
          + status.getMessage());
View Full Code Here

TOP

Related Classes of org.jboss.deployers.spi.management.deploy.DeploymentProgress

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.