Java Reference
In-Depth Information
decide to fall back to classic Java class loading by putting troublesome JAR files back on
the application class path and exposing a selection of their packages via the system bun-
dle with the org.osgi.framework.system.packages.extra property. You can go even
further by adding their packages to the org.osgi.framework.bootdelegation prop-
erty, which makes them automatically available to all bundles without needing to explic-
itly import them.
This sounds useful, but there's a catch: if you use boot delegation, you won't be
able to use multiple versions or dynamically deploy them. But if it avoids tangled class-
loading problems and helps keep your developers sane, you may decide this is a fair
trade. You can often achieve more by concentrating on modularizing your own code.
Leave complex third-party library JAR files on the application class path until you
know how to turn them into bundles or until an OSG i-compatible release is available.
Not everything has to be a bundle. As we often say in this topic, you can decide how
much OSG i you want to use: it's definitely not an all-or-nothing approach!
6.3
Summary
In this chapter, we did the following:
Showed how to turn an existing JAR into a bundle (abracadabra!)
Tu r n e d A p a c h e B e a n U t i l s a n d H t t p C l i e n t i n t o e x a m p l e b u n d l e s
Discussed slicing complete applications into one or more bundles
Converted jEdit into an OSG i application that still works outside of OSG i
Explained why you should watch for the sweet spot where you get the most
value per bundle
Looked at why too few bundles make your application less modular and less
flexible
Looked at why too many bundles can lead to exponential test and management
costs
But what is involved in testing bundles? After you've split your application into many
independent parts, how do you keep everything consistent, and how do you upgrade
your application without bringing everything down? The next chapter will discuss this
and more, as we look at testing OSG i applications.
Search WWH ::




Custom Search