Package org.jboss.forge.addon.projects.facets

Examples of org.jboss.forge.addon.projects.facets.DependencyFacet


   private final boolean preserveHierarchyPrecedence = true;

   private MavenPlugin install(Project project, final MavenPlugin plugin, boolean managed)
   {
      MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      Coordinate pluginCoordinates = CoordinateBuilder.create().setGroupId(plugin.getCoordinate().getGroupId())
               .setArtifactId(plugin.getCoordinate().getArtifactId());
      MavenPlugin managedPlugin = null;
      if (plugins.hasManagedPlugin(pluginCoordinates))
      {
View Full Code Here


public class DependencyInstallerImpl implements DependencyInstaller
{
   @Override
   public Dependency install(final Project project, final Dependency dependency)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      // Exists in deps, no version change requested
      Dependency unversioned = getUnversioned(dependency);
      Dependency existing = deps.getEffectiveDependency(unversioned);
      Dependency existingManaged = deps.getEffectiveManagedDependency(unversioned);

      if (existing != null) // we already have the dep
      {
         if (!Strings.isNullOrEmpty(existing.getCoordinate().getVersion())
                  && (existing.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion())
                  || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())))
         {
            /*
             * The version is the same as requested, or no specific version was requested. No action required.
             */
            return existing;
         }
         else
         {
            /*
             * Version is different. Update it.
             */
            return updateAll(deps, dependency, unversioned);
         }
      }
      else if (existingManaged != null)
      {
         /*
          * we don't have a dependency, or the existing dependency did not have a version, but we do have a managed
          * dependency
          */
         if (!Strings.isNullOrEmpty(existingManaged.getCoordinate().getVersion())
                  && (existingManaged.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion())
                  || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())))
         {
            /*
             * We have a version already, or the version is the same as requested, or no specific version was requested.
             * No need to touch dep management because we already have the right version.
             */
            deps.removeDependency(dependency);
            updateDependency(deps, unversioned);
            return existingManaged;
         }
         else
         {
            /*
             * Version is different or unspecified, and we had no existing version.
             */
            return updateAll(deps, dependency, unversioned);
         }
      }
      else
      {
         Dependency toInstall = dependency;
         if (Strings.isNullOrEmpty(dependency.getCoordinate().getVersion()))
         {
            List<Coordinate> versions = deps.resolveAvailableVersions(DependencyQueryBuilder.create(
                     dependency.getCoordinate()).setFilter(new NonSnapshotDependencyFilter()));

            if (versions.isEmpty())
               versions = deps.resolveAvailableVersions(DependencyQueryBuilder.create(
                        dependency.getCoordinate()));

            if (!versions.isEmpty())
               toInstall = DependencyBuilder.create(dependency).setVersion(
                        versions.get(versions.size() - 1).getVersion());
View Full Code Here

   }

   @Override
   public Dependency installManaged(Project project, Dependency dependency)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);

      if (Strings.isNullOrEmpty(dependency.getCoordinate().getVersion()))
      {
         // we didn't request a specific version
         updateManagedDependency(deps, dependency);
View Full Code Here

   }

   @Override
   public boolean isInstalled(final Project project, final Dependency dependency)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      return deps.hasEffectiveDependency(dependency);
   }
View Full Code Here

   abstract protected Map<Dependency, List<Dependency>> getRequiredDependencyOptions();

   @Override
   public boolean install()
   {
      DependencyFacet deps = origin.getFacet(DependencyFacet.class);
      for (Entry<Dependency, List<Dependency>> group : getRequiredDependencyOptions().entrySet())
      {
         boolean satisfied = false;
         for (Dependency dependency : group.getValue())
         {
            if (deps.hasEffectiveDependency(dependency))
            {
               satisfied = true;
               break;
            }
         }
View Full Code Here

      return dependencyRequirementsMet();
   }

   protected boolean dependencyRequirementsMet()
   {
      DependencyFacet deps = origin.getFacet(DependencyFacet.class);
      for (Entry<Dependency, List<Dependency>> group : getRequiredDependencyOptions().entrySet())
      {
         boolean satisfied = false;
         for (Dependency dependency : group.getValue())
         {
            if (deps.hasEffectiveDependency(dependency))
            {
               satisfied = true;
               break;
            }
         }
View Full Code Here

      }
   }

   private Coordinate getLatestVersion(Coordinate dependency)
   {
      DependencyFacet dependencyFacet = getFaceted().getFacet(DependencyFacet.class);
      Coordinate result = dependency;
      List<Coordinate> versions = dependencyFacet.resolveAvailableVersions(DependencyQueryBuilder.create(dependency)
               .setFilter(new NonSnapshotDependencyFilter()));
      if (versions.size() > 0)
      {
         result = versions.get(versions.size() - 1);
      }
View Full Code Here

   private boolean preserveHierarchyPrecedence = true;

   private MavenPlugin install(Project project, final MavenPlugin plugin, boolean managed)
   {
      MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      Coordinate pluginCoordinates = CoordinateBuilder.create().setGroupId(plugin.getCoordinate().getGroupId())
               .setArtifactId(plugin.getCoordinate().getArtifactId());
      MavenPlugin managedPlugin = null;
      if (plugins.hasManagedPlugin(pluginCoordinates))
      {
View Full Code Here

   private final boolean preserveHierarchyPrecedence = true;

   private MavenPlugin install(Project project, final MavenPlugin plugin, boolean managed)
   {
      MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      Coordinate pluginCoordinates = CoordinateBuilder.create().setGroupId(plugin.getCoordinate().getGroupId())
               .setArtifactId(plugin.getCoordinate().getArtifactId());
      MavenPlugin managedPlugin = null;
      if (plugins.hasManagedPlugin(pluginCoordinates))
      {
View Full Code Here

public class DependencyInstallerImpl implements DependencyInstaller
{
   @Override
   public Dependency install(final Project project, final Dependency request)
   {
      DependencyFacet deps = project.getFacet(DependencyFacet.class);
      final Dependency dependency = deps.resolveProperties(request);

      // Exists in deps, no version change requested
      Dependency unversioned = getUnversioned(dependency);
      Dependency existing = deps.getEffectiveDependency(unversioned);
      Dependency existingManaged = deps.getEffectiveManagedDependency(unversioned);

      if (existing != null) // we already have the dep
      {
         if (!Strings.isNullOrEmpty(existing.getCoordinate().getVersion())
                  && (existing.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion())
                  || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())))
         {
            /*
             * The version is the same as requested, or no specific version was requested. No action required.
             */
            return existing;
         }
         else
         {
            /*
             * Version is different. Update it.
             */
            return updateAll(deps, dependency, unversioned);
         }
      }
      else if (existingManaged != null)
      {
         /*
          * we don't have a dependency, or the existing dependency did not have a version, but we do have a managed
          * dependency
          */
         if (!Strings.isNullOrEmpty(existingManaged.getCoordinate().getVersion())
                  && (existingManaged.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion())
                  || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())))
         {
            /*
             * We have a version already, or the version is the same as requested, or no specific version was requested.
             * No need to touch dep management because we already have the right version.
             */
            deps.removeDependency(dependency);
            updateDependency(deps, unversioned);
            return existingManaged;
         }
         else
         {
            /*
             * Version is different or unspecified, and we had no existing managed dependency.
             */
            return updateAll(deps, dependency, unversioned);
         }
      }
      else
      {
         Dependency toInstall = dependency;
         if (Strings.isNullOrEmpty(dependency.getCoordinate().getVersion()))
         {
            List<Coordinate> versions = deps.resolveAvailableVersions(DependencyQueryBuilder.create(
                     dependency.getCoordinate()).setFilter(new NonSnapshotDependencyFilter()));

            if (versions.isEmpty())
               versions = deps.resolveAvailableVersions(DependencyQueryBuilder.create(
                        dependency.getCoordinate()));

            if (!versions.isEmpty())
               toInstall = DependencyBuilder.create(dependency).setVersion(
                        versions.get(versions.size() - 1).getVersion());
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.projects.facets.DependencyFacet

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.