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

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


    throw new AdminProcessingException(e.getMessage(), e);
  }

  public static void execute(DeploymentProgress progress, String errorMessage) throws AdminProcessingException {
      progress.run();
      DeploymentStatus status =  progress.getDeploymentStatus();
     
    if (status.isFailed()) {
      if (status.getFailure() != null) {
        throw new AdminProcessingException(status.getFailure().getMessage(), status.getFailure());
      }
      throw new AdminProcessingException(errorMessage);       
    }
  }
View Full Code Here


        .getDeploymentManager();
   
    log.debug("Stopping deployment [" + this.deploymentUrl + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
    DeploymentProgress progress = deploymentManager
        .stop(this.deploymentUrl);
    DeploymentStatus stopStatus = DeploymentUtils.run(progress);
    if (stopStatus.isFailed()) {
      log.error("Failed to stop deployment '" + this.deploymentUrl //$NON-NLS-1$
          + "'.", stopStatus.getFailure()); //$NON-NLS-1$
      throw new Exception("Failed to stop deployment '" //$NON-NLS-1$
          + this.deploymentName + "' - cause: " //$NON-NLS-1$
          + stopStatus.getFailure());
    }
    log.debug("Removing deployment [" + this.deploymentUrl + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
    progress = deploymentManager.remove(this.deploymentUrl);
    DeploymentStatus removeStatus = DeploymentUtils.run(progress);
    if (removeStatus.isFailed()) {
      log.error("Failed to remove deployment '" + this.deploymentUrl //$NON-NLS-1$
          + "'.", removeStatus.getFailure()); //$NON-NLS-1$
      throw new Exception("Failed to remove deployment '" //$NON-NLS-1$
          + this.deploymentName + "' - cause: " //$NON-NLS-1$
          + removeStatus.getFailure());
    }

  }
View Full Code Here

   * @throws Exception
   */
  private static void deployAndStart(DeploymentManager deploymentManager,
      URL contentURL, String archiveFileName) throws Exception {
    DeploymentProgress progress = null;
        DeploymentStatus distributeStatus;
        Exception distributeFailure = null;
        try {
            progress = deploymentManager.distribute(archiveFileName, contentURL, true);
            distributeStatus = run(progress);
            if (distributeStatus.isFailed()) {
                distributeFailure = (distributeStatus.getFailure() != null) ? distributeStatus.getFailure() :
                        new Exception("Distribute failed for unknown reason."); //$NON-NLS-1$
            }
        }
        catch (Exception e) {
            distributeFailure = e;
        }
        if (distributeFailure != null) {
            throw new Exception("Failed to distribute '" + contentURL + "' to '" + archiveFileName + "' - cause: "  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    + ThrowableUtil.getAllMessages(distributeFailure));
        }

        // Now that we've successfully distributed the deployment, we need to start it.
        String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();
        DeploymentStatus startStatus;
        Exception startFailure = null;
        try {
            progress = deploymentManager.start(deploymentNames);
            startStatus = run(progress);
            if (startStatus.isFailed()) {
                startFailure = (startStatus.getFailure() != null) ? startStatus.getFailure() :
                        new Exception("Start failed for unknown reason."); //$NON-NLS-1$
            }
        }
        catch (Exception e) {
            startFailure = e;
        }
        if (startFailure != null) {
            LOG.error("Failed to start deployment " + Arrays.asList(deploymentNames) //$NON-NLS-1$
                + " during deployment of '" + archiveFileName + "'. Backing out the deployment...", startFailure); //$NON-NLS-1$ //$NON-NLS-2$
            // If start failed, the app is invalid, so back out the deployment.
            DeploymentStatus removeStatus;
            Exception removeFailure = null;
            try {
                progress = deploymentManager.remove(deploymentNames);
                removeStatus = run(progress);
                if (removeStatus.isFailed()) {
                    removeFailure = (removeStatus.getFailure() != null) ? removeStatus.getFailure() :
                        new Exception("Remove failed for unknown reason."); //$NON-NLS-1$
                }
            }
            catch (Exception e) {
                removeFailure = e;
View Full Code Here

      String urlString = contentURL.toExternalForm();
      int p = urlString.indexOf(":/");
      contentURL = new URL("file" + urlString.substring(p));
      getLog().debug(contentURL);

      DeploymentStatus status;
      DeploymentProgress progress = deployMgr.distribute(name, contentURL, true);
      progress.addProgressListener(this);
      progress.run();
      String[] uploadedNames = {};
      try
      {
         status = progress.getDeploymentStatus();
         assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
         // It should not be running yet
         assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
         assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());

         // Get the unique deployment name
         uploadedNames = progress.getDeploymentID().getRepositoryNames();
         getLog().debug("Uploaded deployment names: "+Arrays.asList(uploadedNames));
         // Now start the deployment
         progress = deployMgr.start(uploadedNames);
         progress.addProgressListener(this);
         progress.run();
         try
         {
            status = progress.getDeploymentStatus();
            assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
            assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
            assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
            // Check for a
            ManagementView mgtView = getManagementView();
            ManagedDeployment deployment = mgtView.getDeployment(uploadedNames[0]);
            assertNotNull(deployment);
            getLog().info("Found " + type + " deployment: " + deployment);
            Set<String> types = deployment.getTypes();
            if (types != null && types.isEmpty() == false)
               assertTrue("Missing type: " + type + ", available: " + types, types.contains(type));
            if (tester != null)
            {
               tester.testManagedDeployment();
            }
         }
         finally
         {
            //Thread.sleep(15 * 1000); // 15 secs >> more than it takes for reaper to run :-)

            // Stop/remove the deployment
            progress = deployMgr.stop(uploadedNames);
            progress.addProgressListener(this);
            progress.run();
            status = progress.getDeploymentStatus();
            assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
            assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
         }
      }
      finally
      {
         progress = deployMgr.remove(uploadedNames);
         progress.addProgressListener(this);
         progress.run();
         status = progress.getDeploymentStatus();
         assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
         assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
      }
   }
View Full Code Here

      };
   }

   protected static void checkProgress(DeploymentProgress progress) throws Exception
   {
      DeploymentStatus status = progress.getDeploymentStatus();
      Throwable failure = status.getFailure();
      assertFalse(status.isFailed());
      if (failure != null)
      {
         staticLog.debug(status);
         throw new Exception(failure);
      }
View Full Code Here

   {
      DeploymentProgress progress = deployMgr.start(repositoryNames);
      progress.addProgressListener(this);
      progress.run();
     
      DeploymentStatus status = progress.getDeploymentStatus();
      assertCompleted(status);
   }
View Full Code Here

   {
      DeploymentProgress progress = deployMgr.stop(repositoryNames);
      progress.addProgressListener(this);
      progress.run();
     
      DeploymentStatus status = progress.getDeploymentStatus();
      assertCompleted(status);
   }
View Full Code Here

      String urlString = contentURL.toExternalForm();
      int p = urlString.indexOf(":/");
      contentURL = new URL("file" + urlString.substring(p));
      getLog().debug(contentURL);

      DeploymentStatus status;
      DeploymentProgress progress = deployMgr.distribute(name, contentURL, true);
      progress.addProgressListener(this);
      progress.run();
      String[] uploadedNames = {};
      try
      {
         status = progress.getDeploymentStatus();
         assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
         // It should not be running yet
         assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
         assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());

         // Get the unique deployment name
         uploadedNames = progress.getDeploymentID().getRepositoryNames();
         getLog().debug("Uploaded deployment names: "+Arrays.asList(uploadedNames));
        
         // Now start the deployment
         progress = deployMgr.start(uploadedNames);
         progress.addProgressListener(this);
         progress.run();
         try
         {
            status = progress.getDeploymentStatus();
            assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
            assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
            assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
            // Check for a
            ManagementView mgtView = getManagementView(getNamingContext(0));
            ManagedDeployment deployment = mgtView.getDeployment(uploadedNames[0]);
            assertNotNull(deployment);
            getLog().info("Found " + type + " deployment: " + deployment);
            Set<String> types = deployment.getTypes();
            if (types != null && types.isEmpty() == false)
               assertTrue("Missing type: " + type + ", available: " + types, types.contains(type));
            if (tester != null)
            {
               tester.testManagedDeployment();
            }
         }
         finally
         {
            //Thread.sleep(15 * 1000); // 15 secs >> more than it takes for reaper to run :-)

            // Stop/remove the deployment
            progress = deployMgr.stop(uploadedNames);
            progress.addProgressListener(this);
            progress.run();
            status = progress.getDeploymentStatus();
            assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
            assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
         }
      }
      finally
      {
         progress = deployMgr.remove(uploadedNames);
         progress.addProgressListener(this);
         progress.run();
         status = progress.getDeploymentStatus();
         assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
         assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
      }
   }
View Full Code Here

            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: "
                    + status.getFailure());
              }
            } else {
              throw new RuntimeException("Did not find Deployment " + fullFileName);         
            }
        }
View Full Code Here

        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());
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Removing deployment [" + deploymentName + "]...");
        }
        progress = deploymentManager.remove(deploymentName);
        DeploymentStatus removeStatus = DeploymentUtils.run(progress);
        if (removeStatus.isFailed()) {
            LOG.error("Failed to remove deployment '" + deploymentName + "'.", removeStatus.getFailure());
            throw new Exception("Failed to remove deployment '" + deploymentName + "' - cause: "
                + removeStatus.getFailure());
        }
        ManagementView managementView = connection.getManagementView();
        managementView.load();
    }
View Full Code Here

TOP

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

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.