Package org.jboss.deployers.client.spi.main

Examples of org.jboss.deployers.client.spi.main.MainDeployer


      // Install the ShrinkWrapDeployer
      final URL shrinkwrapDeployerJBossBeans = Thread.currentThread().getContextClassLoader()
            .getResource(FILENAME_SHRINKWRAP_DEPLOYER_XML);
      assert shrinkwrapDeployerJBossBeans != null : "ShrinkWrap Deployer beans XML not found";
      final MainDeployer mainDeployer = (MainDeployer) server.getKernel().getController()
            .getContextByClass(MainDeployer.class).getTarget();
      final VirtualFile file;
      try
      {
         file = VFS.getChild(shrinkwrapDeployerJBossBeans);
      }
      catch (final URISyntaxException e)
      {
         throw new LifecycleException("Could not create virtual file for " + shrinkwrapDeployerJBossBeans, e);
      }
      if (file == null)
      {
         throw new IllegalStateException();
      }
      final VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
      try
      {
         mainDeployer.addDeployment(deployment);
         mainDeployer.process();
         mainDeployer.checkComplete();
      }
      catch (final org.jboss.deployers.spi.DeploymentException de)
      {
         throw new LifecycleException("Could not install ShrinkWrapDeployer", de);
      }
View Full Code Here


   }

   protected void internalRun() throws Throwable
   {
      Thread.sleep(new Random().nextInt(50));
      MainDeployer mainDeployer = (MainDeployer)main;
      mainDeployer.shutdown();
   }
View Full Code Here

      assertEquals(expected, deployer.getUndeployedUnits());
   }

   public void testDeployShutdown() throws Throwable
   {
      MainDeployer main = (MainDeployer)getMainDeployer();

      Deployment context = createSimpleDeployment("shutdown");
      main.deploy(context);
      List<String> expected = new ArrayList<String>();
      expected.add(context.getName());
      assertEquals(expected, deployer.getDeployedUnits());

      main.shutdown();
      assertEquals(expected, deployer.getUndeployedUnits());
   }
View Full Code Here

/*     */   }
/*     */
/*     */   protected void loadProfile(String name)
/*     */     throws Exception
/*     */   {
/* 193 */     MainDeployer deployer = getMainDeployer();
/* 194 */     if (deployer == null)
/* 195 */       throw new NullPointerException("MainDeployer has not been set");
/* 196 */     ProfileService ps = getProfileService();
/* 197 */     if (ps == null) {
/* 198 */       throw new NullPointerException("ProfileService has not been set");
/*     */     }
/*     */
/* 201 */     ProfileKey key = new ProfileKey(name);
/* 202 */     Profile profile = ps.getProfile(key);
/*     */
/* 205 */     VFSDeployment first = null;
/*     */
/* 208 */     Collection boostraps = profile.getDeployments(ManagedDeployment.DeploymentPhase.BOOTSTRAP);
/* 209 */     for (VFSDeployment d : boostraps)
/*     */     {
/* 211 */       deployer.addDeployment(d);
/* 212 */       if (first == null)
/* 213 */         first = d;
/*     */     }
/* 215 */     deployer.process();
/* 216 */     deployer.checkComplete();
/*     */
/* 218 */     Thread thread = Thread.currentThread();
/* 219 */     ClassLoader old = thread.getContextClassLoader();
/*     */
/* 221 */     MainDeployerImpl hack = (MainDeployerImpl)deployer;
/* 222 */     ClassLoader cl = null;
/* 223 */     if (first != null)
/*     */     {
/* 225 */       DeploymentContext ctx = hack.getDeploymentContext(first.getName());
/* 226 */       if (ctx != null)
/* 227 */         cl = ctx.getClassLoader();
/*     */     }
/* 229 */     if (cl != null) {
/* 230 */       thread.setContextClassLoader(cl);
/*     */     }
/*     */
/*     */     try
/*     */     {
/* 235 */       Collection profileDeployers = profile.getDeployments(ManagedDeployment.DeploymentPhase.DEPLOYER);
/* 236 */       for (VFSDeployment d : profileDeployers)
/* 237 */         deployer.addDeployment(d);
/* 238 */       deployer.process();
/* 239 */       deployer.checkComplete();
/*     */
/* 242 */       Collection profileDeployments = profile.getDeployments(ManagedDeployment.DeploymentPhase.APPLICATION);
/* 243 */       for (VFSDeployment d : profileDeployments)
/* 244 */         deployer.addDeployment(d);
/* 245 */       deployer.process();
/* 246 */       deployer.checkComplete();
/*     */     }
/*     */     finally
/*     */     {
/* 250 */       thread.setContextClassLoader(old);
/*     */     }
View Full Code Here

TOP

Related Classes of org.jboss.deployers.client.spi.main.MainDeployer

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.