Class P2Query


  • public class P2Query
    extends java.lang.Object
    Follows the dependency information of a set of P2Unit so that they can be installed from maven or directly from p2 if necessary.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAllUnits()
      Adds every unit in the session, subject to the query filters.
      void exclude​(java.lang.String toExclude)
      Excludes the unit with the given id.
      void excludePrefix​(java.lang.String prefix)
      Excludes all units whose id start with the given prefix.
      void excludeSuffix​(java.lang.String prefix)
      Excludes all units whose id end with the given suffix.
      void filterProp​(java.lang.String key, java.lang.String value)  
      java.util.List<P2Unit> getAllAvailableUnitsById​(java.lang.String id)
      Returns every unit available in the parent session with the given id, possibly multiple versions of the same id.
      java.util.Set<P2Session.Requirement> getAmbiguousRequirements()
      Returns every requirement for which there were multiple providers and no clear winner.
      java.util.List<P2Unit> getCategories()
      Returns all categories.
      java.util.List<P2Unit> getFeatures()
      Returns all features.
      P2Unit getInstalledUnitById​(java.lang.String id)
      Returns the unit, if any, which has been installed at the given id.
      java.util.List<P2Unit> getJars()
      Returns all jars.
      java.util.List<P2Unit> getJarsNotOnMavenCentral​(boolean useMavenCentral)
      Returns all jars which are not on maven central.
      java.util.List<java.lang.String> getJarsOnMavenCentral​(boolean useMavenCentral)
      Returns all jars which are on maven central.
      java.util.Map<P2Session.Requirement,​java.util.Set<P2Unit>> getOptionalRequirementsNotInstalled()
      Returns all optional requirements which were not installed, along with every unit which optionally wanted it.
      java.util.List<P2Unit> getUnitsWithProperty​(java.lang.String key, java.lang.String value)
      Returns all units which have the given property set to the given value.
      java.util.List<P2Unit> getUnitsWithProperty1or2​(java.lang.String key1, java.lang.String value1, java.lang.String key2, java.lang.String value2)
      Returns all units which have the given property set to the given value.
      java.util.Map<P2Session.Requirement,​java.util.Set<P2Unit>> getUnmetRequirements()
      Returns every unmet requirement mapped to the units which needed it.
      void install​(java.lang.String idToResolve)
      Resolves the given P2Unit by eagerly traversing all its dependencies.
      boolean isInstalled​(P2Unit unit)
      Returns true of the given unit was installed.
      void platform​(com.diffplug.common.swt.os.SwtPlatform platform)
      Sets the platform filter to match true against only the given platform.
      void platformAll()
      Sets the platform filter to match true against all platforms.
      void platformNone()
      Sets the platform filter to match true against no platforms.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • exclude

        public void exclude​(java.lang.String toExclude)
        Excludes the unit with the given id.
      • excludePrefix

        public void excludePrefix​(java.lang.String prefix)
        Excludes all units whose id start with the given prefix.
      • excludeSuffix

        public void excludeSuffix​(java.lang.String prefix)
        Excludes all units whose id end with the given suffix.
      • platform

        public void platform​(com.diffplug.common.swt.os.SwtPlatform platform)
        Sets the platform filter to match true against only the given platform.
      • platformAll

        public void platformAll()
        Sets the platform filter to match true against all platforms.
      • platformNone

        public void platformNone()
        Sets the platform filter to match true against no platforms.
      • filterProp

        public void filterProp​(java.lang.String key,
                               java.lang.String value)
      • install

        public void install​(java.lang.String idToResolve)
        Resolves the given P2Unit by eagerly traversing all its dependencies.
      • getInstalledUnitById

        public P2Unit getInstalledUnitById​(java.lang.String id)
        Returns the unit, if any, which has been installed at the given id.
      • getAllAvailableUnitsById

        public java.util.List<P2Unit> getAllAvailableUnitsById​(java.lang.String id)
        Returns every unit available in the parent session with the given id, possibly multiple versions of the same id.
      • getJars

        public java.util.List<P2Unit> getJars()
        Returns all jars.
      • getFeatures

        public java.util.List<P2Unit> getFeatures()
        Returns all features.
      • getCategories

        public java.util.List<P2Unit> getCategories()
        Returns all categories.
      • getUnitsWithProperty

        public java.util.List<P2Unit> getUnitsWithProperty​(java.lang.String key,
                                                           java.lang.String value)
        Returns all units which have the given property set to the given value.
      • getUnitsWithProperty1or2

        public java.util.List<P2Unit> getUnitsWithProperty1or2​(java.lang.String key1,
                                                               java.lang.String value1,
                                                               java.lang.String key2,
                                                               java.lang.String value2)
        Returns all units which have the given property set to the given value.
      • getJarsOnMavenCentral

        public java.util.List<java.lang.String> getJarsOnMavenCentral​(boolean useMavenCentral)
        Returns all jars which are on maven central.
      • getJarsNotOnMavenCentral

        public java.util.List<P2Unit> getJarsNotOnMavenCentral​(boolean useMavenCentral)
        Returns all jars which are not on maven central.
      • addAllUnits

        public void addAllUnits()
        Adds every unit in the session, subject to the query filters.
      • getAmbiguousRequirements

        public java.util.Set<P2Session.Requirement> getAmbiguousRequirements()
        Returns every requirement for which there were multiple providers and no clear winner.
      • getUnmetRequirements

        public java.util.Map<P2Session.Requirement,​java.util.Set<P2Unit>> getUnmetRequirements()
        Returns every unmet requirement mapped to the units which needed it.
      • isInstalled

        public boolean isInstalled​(P2Unit unit)
        Returns true of the given unit was installed.
      • getOptionalRequirementsNotInstalled

        public java.util.Map<P2Session.Requirement,​java.util.Set<P2Unit>> getOptionalRequirementsNotInstalled()
        Returns all optional requirements which were not installed, along with every unit which optionally wanted it.