On 11/25/09 21:49, Ivan wrote:
Hi, While trying the Felix as the OSGI runtime, I have some questions about the resolve policy, please help to give some comments, thanks ! 1. Can an import connection be wired to an installed (not resolved) bundle ? I found there is description in the spec 3.7, which says "A resolved exporter must be preferred over an unresolved exporter.". So does it mean that the answer is yes ?
All bundles must be resolved to have wires and to have wires to them. The spec is just saying you should prefer already resolved bundles over bundles that you must yet resolve.
2. I have a bunlde A and bundle B, bundle A needs to import some packages from bundle B. But my installation order is that first A, then B. From the log messages, I could see after installing A, FelixDispatchQueue said that bunldle A is in the installed state. Then I install B, the messages showed that " Bundle B resolved, Bundle A resloved". I wonder when the resolve action will occured ? Will Felix check whether all the installed bundle could be resolved once a new bundle is installed or resolved ?
Felix does not try to resolve bundles automatically, it only resolves them on demand. Typically this is when you try to start a bundle, which will resolve that bundle plus the bundles on which it depends transitively.
3. Related to question 2, if I have ten bundles and I am sure that each bundle could find export packages from other nine bundles. But I do not install them according to their dependency relations. Then, will the logic below work correctly ? In my tests, it seems that they could work correctly. String[] locations = {......}; Bundle[] bundles = new Bundles[locations.length]; for(int i=0;i<locations.length;i++) { bundles[i] = bundleContext.installBundle(locations[i]); } for(Bundle b : bundles) { b.start(); }
Yes. For example, if all of your bundles are installed and started, on a subsequent restart of the framework, it will first reinstall all bundles in one pass, then start them in another pass, which ensures dependencies can be satisfied.
The above code does the same thing. -> richard
Ivan
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org