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

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


                createResourceReport.setStatus(CreateResourceStatus.FAILURE);
                createResourceReport.setErrorMessage("Incorrect extension specified on filename [" + archiveName + "]");
                return;
            }

            DeploymentManager deploymentManager = this.profileServiceConnection.getDeploymentManager();
           
            DeploymentUtils.deployArchive(deploymentManager, archiveFile, false);
           
            // Deployment was successful!
            createResourceReport.setResourceName(archiveName);
View Full Code Here


  }

  @Override
  public void deleteResource() throws Exception {

    DeploymentManager deploymentManager = getConnection()
        .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$
View Full Code Here

          + "'."); //$NON-NLS-1$
    }

    // Now stop the original app.
    try {
      DeploymentManager deploymentManager = getConnection()
          .getDeploymentManager();
      DeploymentProgress progress = deploymentManager
          .stop(this.deploymentUrl);
      DeploymentUtils.run(progress);
    } catch (Exception e) {
      throw new RuntimeException("Failed to stop deployment [" //$NON-NLS-1$
          + this.deploymentUrl + "].", e); //$NON-NLS-1$
    }

    // And then remove it (this will delete the physical file/dir from the
    // deploy dir).
    try {
      DeploymentManager deploymentManager = getConnection()
          .getDeploymentManager();
      DeploymentProgress progress = deploymentManager
          .remove(this.deploymentUrl);
      DeploymentUtils.run(progress);
    } catch (Exception e) {
      throw new RuntimeException("Failed to remove deployment [" //$NON-NLS-1$
          + this.deploymentUrl + "].", e); //$NON-NLS-1$
    }

    // Deploy away!
    log.debug("Deploying '" + tempFile + "'..."); //$NON-NLS-1$ //$NON-NLS-2$
    DeploymentManager deploymentManager = getConnection()
        .getDeploymentManager();
    try {
      DeploymentUtils.deployArchive(deploymentManager, tempFile,
          deployExploded);
    } catch (Exception e) {
View Full Code Here

   }

   public void testDeploymentMgrRedeploy() throws Exception
   {
      // Test redeploy using deploymentManager
      DeploymentManager deployMgr = getDeploymentManager();
      // deployMgr.loadProfile(scannerProfile);
      try
      {
         String name = deployMgr.getRepositoryNames(new String[] { DEPLOYMENT })[0];
         redeployCheckComplete(name);
      }
      finally
      {
         deployMgr.releaseProfile();
      }     
   }
View Full Code Here

   @Override
   protected void setUp() throws Exception
   {
      super.setUp();
      DeploymentManager deployMgr = getDeploymentManager();
      deployMgr.loadProfile(getProfileKey());
   }
View Full Code Here

   }

   @Override
   protected void tearDown() throws Exception
   {
      DeploymentManager deployMgr = getDeploymentManager();
      deployMgr.releaseProfile();
      super.tearDown();
   }
View Full Code Here

   }

   @SuppressWarnings("deprecation")
   protected void testDeployment(String name, String type, ManagedDeploymentTester tester) throws Exception
   {
      DeploymentManager deployMgr = getDeploymentManager();
      URL contentURL = getDeployURL(name);
      assertNotNull(contentURL);
      getLog().debug(contentURL);
      // TODO - hack to get off JDK's url handling
      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

      return ds;
   }
  
   protected String[] deployPackage(String name) throws Exception
   {
      DeploymentManager deployMgr = getDeploymentManager();
      URL contentURL = getDeployURL(name);

      assertNotNull(contentURL);
     
      String[] uploadedNames = {};
View Full Code Here

   }
  
  
   protected void undeployPackage(String[] repositoryNames) throws Exception
   {
      DeploymentManager deployMgr = getDeploymentManager();
      try
      {
         stop(deployMgr, repositoryNames);
      }
      finally
View Full Code Here

    * @throws Exception
    */
   DeploymentProgress distributeAndStart(String deployment, String deploymentName, boolean copyContent, boolean checkStopped) throws Exception
   {
      // The deployment manager
      DeploymentManager deployMgr = getDeploymentManager();

      // Distribute
      DeploymentProgress distribute = deployMgr.distribute(deploymentName,
            getDeployURL(deployment), copyContent);
      distribute.run();
      // Distribute always has to complete
      assertComplete(distribute);
      // check if the app is stopped
      if(checkStopped)
         assertDeploymentState(distribute.getDeploymentID(), DeploymentState.STOPPED);

      // Get the repository names
      String[] uploadedNames = distribute.getDeploymentID().getRepositoryNames();
      assertNotNull(uploadedNames);

      // Start
      DeploymentProgress start = deployMgr.start(uploadedNames);
      start.run();
      // Return the start deployment progress
      return start;
   }
View Full Code Here

TOP

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

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.