Package org.jboss.forge.furnace.manager.impl

Examples of org.jboss.forge.furnace.manager.impl.AddonManagerImpl


   private void remove(String addonCoordinates)
   {
      try
      {
         AddonDependencyResolver resolver = new MavenAddonDependencyResolver();
         AddonManagerImpl addonManager = new AddonManagerImpl(furnace, resolver);
         AddonId addon = null;
         String coordinates;
         // This allows forge --remove maven
         if (addonCoordinates.contains(","))
         {
            if (addonCoordinates.contains(":"))
            {
               addon = AddonId.fromCoordinates(addonCoordinates);
            }
            else
            {
               addon = AddonId.fromCoordinates(FORGE_ADDON_GROUP_ID + addonCoordinates);
            }
            coordinates = addon.getName();
         }
         else
         {
            if (addonCoordinates.contains(":"))
            {
               coordinates = addonCoordinates;
            }
            else
            {
               coordinates = FORGE_ADDON_GROUP_ID + addonCoordinates;
            }
         }
         REPOS: for (AddonRepository repository : furnace.getRepositories())
         {
            for (AddonId id : repository.listEnabled())
            {
               if (coordinates.equals(id.getName()))
               {
                  addon = id;
                  if (repository instanceof MutableAddonRepository)
                  {
                     RemoveRequest request = addonManager.remove(id, (repository));
                     System.out.println(request);
                     if (!batchMode)
                     {
                        String result = System.console().readLine("Confirm uninstallation [Y/n]? ");
                        if ("n".equalsIgnoreCase(result.trim()))
View Full Code Here


      {
         addonRepository.mkdirs();
      }
      AddonRepository repository = forge.addRepository(AddonRepositoryMode.MUTABLE, addonRepository);
      AddonDependencyResolver addonResolver = new MavenAddonDependencyResolver(this.classifier);
      AddonManager addonManager = new AddonManagerImpl(forge, addonResolver);

      for (String addonId : addonIds)
      {
         AddonId id = AddonId.fromCoordinates(addonId);
         InstallRequest install = addonManager.install(id, repository);
         if (!install.getActions().isEmpty())
         {
            getLog().info("" + install);
            install.perform();
         }
View Full Code Here

public class AddonManagerProducer
{
   @Produces
   public AddonManager produceAddonManager(Furnace furnace, AddonDependencyResolver resolver)
   {
      return new AddonManagerImpl(furnace, resolver);
   }
View Full Code Here

      }
      AddonRepository repository = forge.addRepository(AddonRepositoryMode.MUTABLE, addonRepository);
      MavenAddonDependencyResolver addonResolver = new MavenAddonDependencyResolver(this.classifier);
      addonResolver.setSettings(settings);
      addonResolver.setResolveAddonAPIVersions(!skipAddonAPIVersionResolution);
      AddonManager addonManager = new AddonManagerImpl(forge, addonResolver);

      for (String addonId : addonIds)
      {
         AddonId id = AddonId.fromCoordinates(addonId);
         InstallRequest install = addonManager.install(id, repository);
         if (!install.getActions().isEmpty())
         {
            getLog().info("" + install);
            install.perform();
         }
View Full Code Here

   {
      Version runtimeAPIVersion = AddonRepositoryImpl.getRuntimeAPIVersion();
      try
      {
         AddonDependencyResolver resolver = new MavenAddonDependencyResolver();
         AddonManagerImpl addonManager = new AddonManagerImpl(furnace, resolver);

         AddonId addon;
         // This allows forge --install maven
         if (addonCoordinates.contains(","))
         {
            if (addonCoordinates.contains(":"))
            {
               addon = AddonId.fromCoordinates(addonCoordinates);
            }
            else
            {
               addon = AddonId.fromCoordinates(FORGE_ADDON_GROUP_ID + addonCoordinates);
            }
         }
         else
         {
            AddonId[] versions;
            String coordinate;
            if (addonCoordinates.contains(":"))
            {
               coordinate = addonCoordinates;
               versions = resolver.resolveVersions(addonCoordinates).get();
            }
            else
            {
               coordinate = FORGE_ADDON_GROUP_ID + addonCoordinates;
               versions = resolver.resolveVersions(coordinate).get();
            }

            if (versions.length == 0)
            {
               throw new IllegalArgumentException("No Artifact version found for " + coordinate);
            }
            else
            {
               AddonId selected = null;
               for (int i = versions.length - 1; selected == null && i >= 0; i--)
               {
                  String apiVersion = resolver.resolveAPIVersion(versions[i]).get();
                  if (apiVersion != null
                           && Versions.isApiCompatible(runtimeAPIVersion, new SingleVersion(apiVersion)))
                  {
                     selected = versions[i];
                  }
               }
               if (selected == null)
               {
                  throw new IllegalArgumentException("No compatible addon API version found for " + coordinate
                           + " for API " + runtimeAPIVersion);
               }

               addon = selected;
            }
         }

         AddonActionRequest request = addonManager.install(addon);
         System.out.println(request);
         if (!batchMode)
         {
            String result = System.console().readLine("Confirm installation [Y/n]? ");
            if ("n".equalsIgnoreCase(result.trim()))
View Full Code Here

   private void remove(String addonCoordinates)
   {
      try
      {
         AddonDependencyResolver resolver = new MavenAddonDependencyResolver();
         AddonManagerImpl addonManager = new AddonManagerImpl(furnace, resolver);
         AddonId addon = null;
         String coordinates;
         // This allows forge --remove maven
         if (addonCoordinates.contains(","))
         {
            if (addonCoordinates.contains(":"))
            {
               addon = AddonId.fromCoordinates(addonCoordinates);
            }
            else
            {
               addon = AddonId.fromCoordinates(FORGE_ADDON_GROUP_ID + addonCoordinates);
            }
            coordinates = addon.getName();
         }
         else
         {
            if (addonCoordinates.contains(":"))
            {
               coordinates = addonCoordinates;
            }
            else
            {
               coordinates = FORGE_ADDON_GROUP_ID + addonCoordinates;
            }
         }
         REPOS: for (AddonRepository repository : furnace.getRepositories())
         {
            for (AddonId id : repository.listEnabled())
            {
               if (coordinates.equals(id.getName()))
               {
                  addon = id;
                  if (repository instanceof MutableAddonRepository)
                  {
                     RemoveRequest request = addonManager.remove(id, (repository));
                     System.out.println(request);
                     if (!batchMode)
                     {
                        String result = System.console().readLine("Confirm uninstallation [Y/n]? ");
                        if ("n".equalsIgnoreCase(result.trim()))
View Full Code Here

   {
      Version runtimeAPIVersion = AddonRepositoryImpl.getRuntimeAPIVersion();
      try
      {
         AddonDependencyResolver resolver = new MavenAddonDependencyResolver();
         AddonManagerImpl addonManager = new AddonManagerImpl(furnace, resolver);

         AddonId addon;
         // This allows forge --install maven
         if (addonCoordinates.contains(","))
         {
            if (addonCoordinates.contains(":"))
               addon = AddonId.fromCoordinates(addonCoordinates);
            else
               addon = AddonId.fromCoordinates(FORGE_ADDON_GROUP_ID + addonCoordinates);
         }
         else
         {
            String coordinate = FORGE_ADDON_GROUP_ID + addonCoordinates;
            AddonId[] versions = resolver.resolveVersions(coordinate).get();
            if (versions.length == 0)
            {
               throw new IllegalArgumentException("No Artifact version found for " + coordinate);
            }
            else
            {
               AddonId selected = null;
               for (int i = versions.length - 1; selected == null && i >= 0; i--)
               {
                  String apiVersion = resolver.resolveAPIVersion(versions[i]).get();
                  if (apiVersion != null && Versions.isApiCompatible(runtimeAPIVersion, new SingleVersion(apiVersion)))
                  {
                     selected = versions[i];
                  }
               }
               if (selected == null)
               {
                  throw new IllegalArgumentException("No compatible addon API version found for " + coordinate
                           + " for API " + runtimeAPIVersion);
               }

               addon = selected;
            }
         }

         AddonActionRequest request = addonManager.install(addon);
         System.out.println(request);
         if (!batchMode)
         {
            String result = System.console().readLine("Confirm installation [Y/n]? ");
            if ("n".equalsIgnoreCase(result.trim()))
View Full Code Here

   private void remove(String addonCoordinates)
   {
      try
      {
         AddonDependencyResolver resolver = new MavenAddonDependencyResolver();
         AddonManagerImpl addonManager = new AddonManagerImpl(furnace, resolver);
         AddonId addon = null;
         String coordinates;
         // This allows forge --remove maven
         if (addonCoordinates.contains(","))
         {
            if (addonCoordinates.contains(":"))
               addon = AddonId.fromCoordinates(addonCoordinates);
            else
               addon = AddonId.fromCoordinates(FORGE_ADDON_GROUP_ID + addonCoordinates);
            coordinates = addon.getName();
         }
         else
         {
            coordinates = FORGE_ADDON_GROUP_ID + addonCoordinates;
         }
         REPOS: for (AddonRepository repository : furnace.getRepositories())
         {
            for (AddonId id : repository.listEnabled())
            {
               if (coordinates.equals(id.getName()))
               {
                  addon = id;
                  if (repository instanceof MutableAddonRepository)
                  {
                     RemoveRequest request = addonManager.remove(id, (repository));
                     System.out.println(request);
                     if (!batchMode)
                     {
                        String result = System.console().readLine("Confirm uninstallation [Y/n]? ");
                        if ("n".equalsIgnoreCase(result.trim()))
View Full Code Here

   private void install(String addonCoordinates)
   {
      try
      {
         AddonDependencyResolver resolver = new MavenAddonDependencyResolver();
         AddonManagerImpl addonManager = new AddonManagerImpl(forge, resolver);

         AddonId addon;
         // This allows forge --install maven
         if (addonCoordinates.contains(","))
         {
            addon = AddonId.fromCoordinates(addonCoordinates);
         }
         else
         {
            String coordinate = "org.jboss.forge.addon:" + addonCoordinates;
            AddonId[] versions = resolver.resolveVersions(coordinate);
            if (versions.length == 0)
            {
               throw new IllegalArgumentException("No Artifact version found for " + coordinate);
            }
            addon = versions[versions.length - 1];
         }

         // FIXME: May prompt for confirmation
         AddonActionRequest request = addonManager.install(addon);
         System.out.println(request);
         request.perform();
      }
      catch (Exception e)
      {
View Full Code Here

      {
         throw new MojoExecutionException(
                  "No AddonDependencyResolver implementation found. Please add one in the <dependencies> section of the forge-maven-plugin.");
      }
      AddonDependencyResolver addonResolver = it.next();
      AddonManager addonManager = new AddonManagerImpl(forge, addonResolver, false);

      for (String addonId : addonIds)
      {
         AddonId id = AddonId.fromCoordinates(addonId);
         InstallRequest install = addonManager.install(id, repository);
         if (!install.getActions().isEmpty())
         {
            getLog().info("" + install);
            install.perform();
         }
View Full Code Here

TOP

Related Classes of org.jboss.forge.furnace.manager.impl.AddonManagerImpl

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.