Java Reference
In-Depth Information
REVISITING MEGA BUNDLES
You've successfully created a mega bundle for jEdit with a small amount of effort.
What are the downsides of a mega bundle? Well, your application is still one single
unit. You can't replace or upgrade sections of it without shutting down the complete
application, and doing so may shut down the entire JVM process if the application
calls System.exit() . Because nothing is being shared, you can end up with duplicate
content between applications.
Effectively, you're in the same situation as before moving to OSG i, but with a few
additional improvements in isolation and management. This doesn't mean the mega
bundle approach is useless—as a first step, it can be reassuring to be able to run your
application on an OSG i framework with the minimum of fuss. It also provides a solid
foundation for further separating (or slicing) your application into bundles, which is
the focus of the next section.
6.2.2
Slicing code into bundles
You now have a single mega bundle containing your entire application. The next step
toward a full-fledged flexible OSG i application is to start breaking it into bundles that
can be upgraded independently of one another. How and where should you draw the
lines between bundles?
Bundles import and export packages in order to share them, so it makes sense to
draw lines that minimize the number of imports and exports. If you have a high-level
design document showing the major components and their boundaries, you can take
each major component and turn it into a bundle. If you don't have such a document,
you should look for major areas of responsibility such as business logic, data access,
and graphical components. Each major area can be represented by a bundle, as
depicted in figure 6.9.
Another way to approach this is to review the benefits of modularity (described in
section 2.2) and think about where they make the most sense in your application. For
example, do any areas need to be upgraded or fixed independently? Does the applica-
tion have any optional parts? Are common utilities shared throughout the application?
UI
UI
Logic
Logic
Data
Data
Figure 6.9 Slicing
code into bundles
Search WWH ::




Custom Search