Package org.jboss.forge.furnace.addons

Examples of org.jboss.forge.furnace.addons.Addon


      while (!listener.isConfigurationScanned())
         Thread.sleep(100);

      registration.removeListener();

      Addon projectsAddon = furnace.getAddonRegistry().getAddon(no_dep);
      Addons.waitUntilStarted(projectsAddon, 10, TimeUnit.SECONDS);

      ClassLoader addonClassLoader = projectsAddon.getClassLoader().loadClass(Addon.class.getName()).getClassLoader();
      ClassLoader appClassLoader = Addon.class.getClassLoader();
      Assert.assertNotEquals(appClassLoader, addonClassLoader);

      Assert.assertTrue(projectsAddon.getStatus().isStarted());
      furnace.stop();
   }
View Full Code Here


      return moduleProviders;
   }

   private ModuleSpec findAddonModule(ModuleIdentifier id)
   {
      Addon addon = currentAddon.get();
      if (addon != null)
      {
         Set<AddonView> views = stateManager.getViewsOf(addon);
         AddonId found = addon.getId();
         for (AddonRepository repository : views.iterator().next().getRepositories())
         {
            if (repository.isEnabled(found) && repository.isDeployed(found))
            {
               Addon mappedAddon = moduleCache.getAddon(id);

               if (mappedAddon != null && mappedAddon.getId().equals(found))
               {
                  Builder builder = ModuleSpec.build(id);

                  builder.addDependency(DependencySpec.createModuleDependencySpec(SystemClasspathSpec.ID));
                  builder.addDependency(DependencySpec.createModuleDependencySpec(XPathJDKClasspathSpec.ID));
View Full Code Here

   {
      AddonId addonId = stateManager.resolveAddonId(views, dependency.getName());
      ModuleIdentifier moduleId = null;
      if (addonId != null)
      {
         Addon addon = lifecycleManager.getAddon(views, addonId);
         moduleId = findCompatibleInstalledModule(addonId);
         if (moduleId != null)
         {
            builder.addDependency(DependencySpec.createModuleDependencySpec(
                     PathFilters.not(PathFilters.getMetaInfFilter()),
View Full Code Here

   private ModuleIdentifier findCompatibleInstalledModule(AddonId addonId)
   {
      ModuleIdentifier result = null;

      Addon addon = currentAddon.get();
      Version runtimeAPIVersion = AddonRepositoryImpl.getRuntimeAPIVersion();

      for (AddonRepository repository : stateManager.getViewsOf(addon).iterator().next().getRepositories())
      {
         List<AddonId> enabled = repository.listEnabledCompatibleWithVersion(runtimeAPIVersion);
View Full Code Here

   {
      try
      {
         initStack();

         Addon self = BeanManagerUtils.getContextualInstance(manager, AddonProducer.class).produceCurrentAddon();
         if (self != null && !(event instanceof InboundEvent))
         {
            Set<Annotation> qualifiers = metadata.getQualifiers();
            if (!isLocal(qualifiers) && !onStack(event, qualifiers))
               try
               {
                  AddonRegistry addonRegistry = BeanManagerUtils.getContextualInstance(manager, AddonRegistry.class);
                  for (Addon addon : addonRegistry.getAddons(AddonFilters.allStarted()))
                  {
                     if (!self.getId().equals(addon.getId()))
                     {
                        EventManager remoteEventManager = addon.getEventManager();
                        if (remoteEventManager != null)
                        {
                           remoteEventManager.fireEvent(event, qualifiers.toArray(new Annotation[qualifiers.size()]));
View Full Code Here

   private void waitForDeploymentCompletion(Deployment deployment, final AddonId addonToDeploy)
            throws DeploymentException
   {
      AddonRegistry registry = runnable.getForge().getAddonRegistry();
      Addon addon = registry.getAddon(addonToDeploy);
      try
      {
         Future<Void> future = addon.getFuture();
         if (!future.isDone())
         {
            future.get();
         }
         if (addon.getStatus().isFailed())
         {
            DeploymentException e = new DeploymentException("AddonDependency " + addonToDeploy
                     + " failed to deploy.");
            deployment.deployedWithError(e);
            throw new DeploymentException("AddonDependency " + addonToDeploy + " failed to deploy.", e);
View Full Code Here

      AddonRegistry registry = runnable.getForge().getAddonRegistry();
      System.out.println("Undeploying [" + addonToUndeploy + "] ... ");

      try
      {
         Addon addonToStop = registry.getAddon(addonToUndeploy);
         if (addonToStop.getStatus().isLoaded())
            ((MutableAddonRepository) addonToStop.getRepository()).disable(addonToUndeploy);
         Addons.waitUntilStopped(addonToStop);
      }
      catch (Exception e)
      {
         throw new DeploymentException("Failed to undeploy " + addonToUndeploy, e);
View Full Code Here

      /*
       * Ensure that the Addon instance we receive is requested before configuration is rescanned.
       */
      addonManager.deploy(exampleId).perform();
      Addon example = registry.getAddon(exampleId);
      Addons.waitUntilStarted(example, 10, TimeUnit.SECONDS);
      Assert.assertEquals(addonCount + 1, registry.getAddons().size());
   }
View Full Code Here

   @Test(timeout = 5000)
   public void testPreShutdownIsCalled() throws Exception
   {
      Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
      AddonRegistry registry = furnace.getAddonRegistry();
      Addon dep2 = registry.getAddon(AddonId.from("dep2", "2"));
      RecordingEventManager manager = registry.getServices(RecordingEventManager.class).get();
      Assert.assertEquals(3, manager.getPostStartupCount());
      MutableAddonRepository repository = (MutableAddonRepository) furnace.getRepositories().get(0);
      repository.disable(dep2.getId());
      Addons.waitUntilStopped(dep2);
      Assert.assertEquals(1, manager.getPreShutdownCount());
   }
View Full Code Here

      AddonRegistry registry = furnace.getAddonRegistry();
      Addons.waitUntilStarted(registry.getAddon(one_dep_a), 10, TimeUnit.SECONDS);
      AddonRegistry leftRegistry = furnace.getAddonRegistry(left);

      Addon addon = leftRegistry.getAddon(one_dep);
      Assert.assertNotNull(addon);

      registration.removeListener();

      furnace.stop();
View Full Code Here

TOP

Related Classes of org.jboss.forge.furnace.addons.Addon

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.