Java Reference
In-Depth Information
As you can see, the bundle-provided shape ser-
vices and the application-provided shape service inte-
grate nicely in the paint frame. You didn't need to do
anything to make this happen, other than ensure that
the application and the bundles used the same ser-
vice interface. Cool.
T h a t ' s a l l t h e r e i s t o t h e OSG i R4.2 standard launch-
ing and embedding API . Don't be afraid to use it.
13.4
Summary
The OSG i specification doesn't define a standard
launcher with a standard way to configure and launch
a framework. Consequently, most OSG i framework
implementations provide their own approach. The standard launching and embedding
API introduced in OSG i R4.2 is the next best thing to a standard launcher, because it
allows you to create a single launcher that works across framework implementations. In
this chapter, you learned the following:
The OSG i R4.2 specification introduced the Framework interface to represent a
framework instance.
The Framework interface extends the existing Bundle interface, which extends
your existing knowledge of managing bundles to framework instances.
The Framework instance represents the system bundle, which provides access to
the system bundle's bundle context for performing normal bundle tasks (such
as installing bundles and registering services).
The META-INF /services approach finds a FrameworkFactory provider, which
enables framework creation without knowing a concrete framework implemen-
tation class name.
The OSG i specification defines numerous framework configuration properties to
further improve framework implementation independence; you can pass these
into FrameworkFactory.newInstance() when creating a framework instance.
Although using completely bundled applications is the preferred approach, the
launching and embedding API also simplifies embedding framework instances
into existing applications.
When you embed a framework instance into an application, the main con-
straint involves dealing with the difference between being on the outside versus
the inside. If direct interaction with bundles is required, you often need to
share common class definitions from the class path.
Other than some additional constraints, embedding a framework instance is
nearly identical to launching a framework instance.
With this knowledge under your belt, you can use it to create your own framework launch-
ers for specific purposes and do so in a framework implementation-neutral way. In the
next chapter, we'll look into configuring framework instances to deal with security.
Figure 13.5
The standalone paint program
Search WWH ::




Custom Search