Class Candidates

java.lang.Object
org.apache.felix.resolver.Candidates

class Candidates extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • getNbResources

      public int getNbResources()
    • getRootHosts

      public Map<org.osgi.resource.Resource,org.osgi.resource.Resource> getRootHosts()
    • addHost

      private void addHost(org.osgi.resource.Resource res, Map<org.osgi.resource.Resource,org.osgi.resource.Resource> hosts)
    • getDelta

      public Object getDelta()
      Returns the delta which is the differences in the candidates from the original Candidates permutation.
      Returns:
      the delta
    • populate

      public void populate(Collection<org.osgi.resource.Resource> resources)
    • isEffective

      private boolean isEffective(org.osgi.resource.Requirement req)
    • populateSubstitutables

      private void populateSubstitutables()
    • populateSubstitutables

      private void populateSubstitutables(org.osgi.resource.Resource resource)
    • checkSubstitutes

      ResolutionError checkSubstitutes()
    • isSubstituted

      private boolean isSubstituted(org.osgi.resource.Capability substitutableCap, Map<org.osgi.resource.Capability,Integer> substituteStatuses)
    • populateDynamic

      public ResolutionError populateDynamic()
    • processCandidates

      private ResolutionError processCandidates(LinkedList<org.osgi.resource.Resource> toPopulate, org.osgi.resource.Requirement req, List<org.osgi.resource.Capability> candidates)
    • isPopulated

      public boolean isPopulated(org.osgi.resource.Resource resource)
    • getResolutionError

      public ResolutionError getResolutionError(org.osgi.resource.Resource resource)
    • addCandidates

      private void addCandidates(org.osgi.resource.Requirement req, List<org.osgi.resource.Capability> candidates)
      Adds a requirement and its matching candidates to the internal data structure. This method assumes it owns the data being passed in and does not make a copy. It takes the data and processes, such as calculating which requirements depend on which capabilities and recording any fragments it finds for future merging.
      Parameters:
      req - the requirement to add.
      candidates - the candidates matching the requirement.
    • addCandidates

      private void addCandidates(Map<org.osgi.resource.Requirement,List<org.osgi.resource.Capability>> candidates)
      Adds requirements and candidates in bulk. The outer map is not retained by this method, but the inner data structures are, so they should not be further modified by the caller.
      Parameters:
      candidates - the bulk requirements and candidates to add.
    • getWrappedHost

      public org.osgi.resource.Resource getWrappedHost(org.osgi.resource.Resource r)
      Returns the wrapped resource associated with the given resource. If the resource was not wrapped, then the resource itself is returned. This is really only needed to determine if the root resources of the resolve have been wrapped.
      Parameters:
      r - the resource whose wrapper is desired.
      Returns:
      the wrapper resource or the resource itself if it was not wrapped.
    • getCandidates

      public List<org.osgi.resource.Capability> getCandidates(org.osgi.resource.Requirement req)
      Gets the candidates associated with a given requirement.
      Parameters:
      req - the requirement whose candidates are desired.
      Returns:
      the matching candidates or null.
    • getFirstCandidate

      public org.osgi.resource.Capability getFirstCandidate(org.osgi.resource.Requirement req)
    • removeFirstCandidate

      public void removeFirstCandidate(org.osgi.resource.Requirement req)
    • clearMultipleCardinalityCandidates

      public CandidateSelector clearMultipleCardinalityCandidates(org.osgi.resource.Requirement req, Collection<org.osgi.resource.Capability> caps)
    • prepare

      public ResolutionError prepare()
      Merges fragments into their hosts. It does this by wrapping all host modules and attaching their selected fragments, removing all unselected fragment modules, and replacing all occurrences of the original fragments in the internal data structures with the wrapped host modules instead. Thus, fragment capabilities and requirements are merged into the appropriate host and the candidates for the fragment now become candidates for the host. Likewise, any module depending on a fragment now depend on the host. Note that this process is sort of like multiplication, since one fragment that can attach to two hosts effectively gets multiplied across the two hosts. So, any modules being satisfied by the fragment will end up having the two hosts as potential candidates, rather than the single fragment.
      Returns:
      ResolutionError if the removal of any unselected fragments result in the root module being unable to resolve.
    • getHostFragments

      private Map<org.osgi.resource.Capability,Map<String,Map<org.osgi.framework.Version,List<org.osgi.resource.Requirement>>>> getHostFragments()
    • removeResource

      private void removeResource(org.osgi.resource.Resource resource, ResolutionError ex)
      Removes a module from the internal data structures if it wasn't selected as a fragment or a singleton. This process may cause other modules to become unresolved if they depended on the module's capabilities and there is no other candidate.
      Parameters:
      resource - the module to remove.
      ex - the resolution error
    • remove

      private void remove(org.osgi.resource.Resource resource, Set<org.osgi.resource.Resource> unresolvedResources)
      Removes the specified module from the internal data structures, which involves removing its requirements and its capabilities. This may cause other modules to become unresolved as a result.
      Parameters:
      resource - the module to remove.
      unresolvedResources - a list to containing any additional modules that that became unresolved as a result of removing this module and will also need to be removed.
    • remove

      private void remove(org.osgi.resource.Requirement req)
      Removes a requirement from the internal data structures.
      Parameters:
      req - the requirement to remove.
    • remove

      private void remove(org.osgi.resource.Capability c, Set<org.osgi.resource.Resource> unresolvedResources)
      Removes a capability from the internal data structures. This may cause other modules to become unresolved as a result.
      Parameters:
      c - the capability to remove.
      unresolvedResources - a list to containing any additional modules that that became unresolved as a result of removing this module and will also need to be removed.
    • removeCandidate

      private CandidateSelector removeCandidate(org.osgi.resource.Requirement req, org.osgi.resource.Capability cap)
    • copy

      public Candidates copy()
      Creates a copy of the Candidates object. This is used for creating permutations when package space conflicts are discovered.
      Returns:
      copy of this Candidates object.
    • dump

      public void dump(ResolveContext rc)
    • permutate

      public Candidates permutate(org.osgi.resource.Requirement req)
    • canRemoveCandidate

      public boolean canRemoveCandidate(org.osgi.resource.Requirement req)