0 Replies Latest reply on Nov 23, 2009 1:20 PM by thomas.diesler

    Snapshot of resolver issues

    thomas.diesler

      Folks,

      I have now removed the dependencies on the Resolver API and use PackageAdmin instead. Have a look at AbstractImportExportTest. There are currently three variations of this test case.

      * BasicResolver
      * RuleBasedResolver
      * NoExternalResolver

      The goal would be to remove all external resolver implementations and have none installed in the MC Framework. This however is currently not possible because of some non-trivial issues that are fixed by the Resolver approach.

      The most important one is covered by

      https://jira.jboss.org/jira/browse/JBOSGI-151

      Consider

      BundleC
       exports A, B
       imports A
      
      BundleD
       exports A,
       imports A, B
      


      This only resolves when BundleC resolves using a self import for package A.
      If the MC resolver could actually reason over the full set of installed modules, the choice where it gets package A from would be arbitrary. Currently it however works such that it irrevocably uses the first match and cannot try another attempt if resolution is not sucessful.

      Tests in error:
       testCircularInstallDbeforeC(org.jboss.test.osgi.jbosgi151.OSGI151TestCase)
      


      The following list defines the preferences, if multiple choices are possible,
      in order of decreasing priority:

      * A resolved exporter must be preferred over an unresolved exporter.
      * An exporter with a higher version is preferred over an exporter with a lower version.
      * An exporter with a lower bundle ID is preferred over a bundle with a higher ID.

      There is test coverage for this, which also fails with NoExternalResolver.

      A related issue is this code in PackageAdminImpl

       int resolved = 1;
       while (resolved > 0)
       {
       resolved = 0;
       Iterator<OSGiBundleState> it = resolvableBundles.iterator();
       while (it.hasNext())
       {
       OSGiBundleState bundleState = it.next();
       if (bundleManager.resolveBundle(bundleState, false))
       {
       it.remove();
       resolved++;
       }
       }
       }
      


      It iteratively tries to resolve the bundles through the MainDeployer by moving them to stage CLASSLOADER one by one. What's missing is an API that allows PackageAdmin to resolve the given bundles all at once.

      https://jira.jboss.org/jira/browse/JBDEPLOY-226