I suppose it depends on how good the bundles are.
There is a good example in "OSGi in Action" book, on page 73.
To try it yourself:
- Download the examples,
- Unpack the file and build the "chapter03" examples with Ant (
osgi-in-action/chapter03/build.xml
),
- Copy
chapter03/paint-example/bundles/*-3.0.jar
files into e.g. chapter03/shell-example/1
,
In order to make the examples work (see issue) you need to do this:
- Download latest Apache Felix Framework distribution from this page, at the moment it's 4.2.1,
- Extract the
org.apache.felix.main.distribution-4.2.1.zip
file,
- Extract the
felix-framework-4.2.1/bin/felix.jar
file,
- Copy the
default.properties
file into the OSGi example's chapter03/shell-example/launcher.jar
.
Now that you have everything ready:
// In console window #1:
$ cd chapter03/shell-example/
$ java -jar launcher.jar bundles
// In console window #2:
$ telnet localhost 7070
-> install file:1/paint-3.0.jar
-> install file:1/shape-3.0.jar
-> start 2
-> install file:1/circle-3.0.jar
-> install file:1/square-3.0.jar
-> start 4
-> start 5
-> install file:1/triangle-3.0.jar
-> start 6
// You can now draw all three shapes.
// Simulate upgrade/patch of "circle" bundle:
-> stop 4
// A "work in progress" sign is in place of the circles.
// You can still move them.
// Start the "circle" bundle again and they're back in the UI:
-> start 4
You can check the example source code to see how they did it.
I hope this answers your question.