Interface Resolver


public interface Resolver
An implementation of a resolver which resolves the constraints of the bundles in a system.

Clients may implement this interface.

Since:
3.1
  • Method Details

    • resolve

      void resolve(BundleDescription[] discard, Dictionary<Object,Object>[] platformProperties)
      Resolves the state associated with this resolver and returns an array of bundle deltas describing the changes.. The state and version bindings for the various bundles and packages in this state are updated and a array containing bundle deltas describing the changes returned.

      This method is intended to be called only by State objects in response to a user invocation of State.resolve(). States will typically refuse to update their constituents (see State.resolveBundle() and State.resolveConstraint()) if their resolve method is not currently being invoked.

      Note the given state is destructively modified to reflect the results of resolution.

      Parameters:
      discard - the list of bundles to discard the resolve status and reresolve. A null value indicates that all currently unresolved bundles in the state should be resolved.
      platformProperties - the platform properties used to match platform filters against. A null value indicates that the system properties should be used to match against
    • flush

      void flush()
      Flushes this resolver of any stored/cached data it may be keeping to facilitate incremental processing on its associated state. This is typicaly used when switching the resolver's state object.
    • getState

      State getState()
      Returns the state associated with this resolver. A state can work with at most one resolver at any given time. Similarly, a resolver can work with at most one state at a time.
      Returns:
      the state for this resolver. null is returned if the resolver does not have a state
    • setState

      void setState(State value)
      Sets the state associated with this resolver. A state can work with at most one resolver at any given time. Similarly, a resolver can work with at most one state at a time.

      To ensure that this resolver and the given state are properly linked, the following expression must be included in this method if the given state (value) is not identical to the result of this.getState().

        if (this.getState() != value) value.setResolver(this);
       
    • bundleAdded

      void bundleAdded(BundleDescription bundle)
      Notifies the resolver a bundle has been added to the state.
      Parameters:
      bundle - the bundle added
    • bundleRemoved

      void bundleRemoved(BundleDescription bundle, boolean pending)
      Notifies the resolver a bundle has been removed from the state.
      Parameters:
      bundle - the bundle description to remove
      pending - indicates if the bundle to be remove has current dependents and will pend complete removal until the bundle has been re-resolved.
    • bundleUpdated

      void bundleUpdated(BundleDescription newDescription, BundleDescription existingDescription, boolean pending)
      Notifies the resolver a bundle has been updated in the state.
      Parameters:
      newDescription - the new description
      existingDescription - the existing description
      pending - indicates if the bundle to be updated has current dependents and will pend complete removal until the bundle has been re-resolved.
    • resolveDynamicImport

      ExportPackageDescription resolveDynamicImport(BundleDescription importingBundle, String requestedPackage)
      Attempts to find an ExportPackageDescription that will satisfy a dynamic import for the specified requestedPackage for the specified importingBundle. If no ExportPackageDescription is available that satisfies a dynamic import for the importingBundle then null is returned.
      Parameters:
      importingBundle - the BundleDescription that is requesting a dynamic package
      requestedPackage - the name of the package that is being requested
      Returns:
      the ExportPackageDescription that satisfies the dynamic import request; a value of null is returned if none is available.
    • setSelectionPolicy

      void setSelectionPolicy(Comparator<BaseDescription> selectionPolicy)
      Sets the selection policy for this resolver. A selection policy is used to sort possible suppliers of a version constraint in descending order. That is an order which is from most desired to least desired. The objects passed to the selection policy Comparator.compare(Object, Object) method will be of type BaseDescription. The selection policy should return a negative number, zero, or a positive number depending on if the first object is more desired, equal amount of desire, or less desired than the second object respectively.

      If no selection policy is set then a default policy will be used which sorts according to the following rules:

      1. The resolution status of the bundle which supplies the base description. Resolved bundles take priority over unresolved ones.
      2. The version of the base description. Higher versions take priority over lower versions.
      3. The bundle ID which supplies the base description. Lower IDs take priority over higher IDs.
      Parameters:
      selectionPolicy - the selection policy for this resolver
      Since:
      3.2
    • getSelectionPolicy

      Comparator<BaseDescription> getSelectionPolicy()
      Returns the selection policy for this resolver or null if it is not set
      Returns:
      the selection policy for this resolver or null if it is not set
      Since:
      3.2