I have to programmatically ensure a specific start order of several OSGi bundles because the activation procedure has some dependencies to other bundles. I manage the bundle's life cycle from Java code where I try to determine the bundle's wiring to calculate the correct start order. All bundles are installed correctly.
Because the bundle wiring seams to be initialised in the resolved state, I am looking for a way to programmatically resolve a bundle. I only found bundle.start()
which resolves but also starts the bundle. Is there a way to only resolve without start? If I use the OSGi shell manually I can achieve this by resolve <bundle-id>
.
You can resolve a set of bundles with FrameworkWiring.resolveBundles. But resolving a bundle is just a necessary precursor to starting a bundle but has nothing to do with ordering. You can resolve all the bundles at once and then start the bundles in a random order.
As Peter says, if you need to start the bundles in some specific order, something is wrong with your system. How will it handle updating a bundle?