Java Reference
In-Depth Information
Application
Isolation boundary
Framework instance
B
A
Application objects
C
Figure 13.2 The embedded framework instance forms an isolation boundary between the bundles
on the inside and the application objects on the outside.
Avoid being on the outside
The best approach for dealing with the inside/outside divide is to eliminate it by con-
verting your entire application to bundles. If you're on the fence about this issue, you
can start with an embedding approach and later convert the rest of your application
to bundles. But if you have a choice up front, start with all bundles.
If you decide to embed a framework instance, what are some of the things you'll likely
want to do with it? You'll probably want to
Interact with and manage the embedded framework instance
Provide services to bundles and use services from bundles
Let's look at what you need to do in each of these cases.
INTERACTING WITH THE EMBEDDED FRAMEWORK
You already know how to interact with an embedded framework instance: through the
standard launching and embedding API . When you create an instance of an R4.2-
compatible framework implementation, you get an object that implements the Frame-
work interface. As you saw previously, this interface gives you access to all the API nec-
essary to control and inspect the framework instance. The framework instance
represents the system bundle and provides you a passage from the outside to the
inside of the framework, as depicted in figure 13.3.
From the system bundle, you can start and stop the framework as well as deploy, man-
age, and interact with bundles. If you're using an embedded framework instance as a
plugin mechanism in your application, you use this API to deploy plugin bundles by
loading them from a directory or providing a GUI for user access, for example. It's also
through this API that you can provide services to bundles and use services from bundles.
Search WWH ::




Custom Search