
The component model's execution environment, which is depicted in
figure 1, is composed by a Java virtual machine, the OSGi framework and
the ServiceBinder itself. The ServiceBinder is delivered inside a
bundle
(~70K) which makes it OSGi implementation independent.
The
ServiceBinder's bundle exports a package that contains the
GenericActivator
class that makes it unnecessary to write code for the
bundle activator (only an empty subclass needs to be provided). The
generic activator parses the component descriptor file and creates the
instance managers that correspond to every component entry in the
descriptor. The component descriptor is located through a new property
defined inside the bundle manifest, the Metadata-Location
property.
Subclassing the GenericActivator and writing a component
descriptor is all that is needed to create a component whose
dependencies are managed by the ServiceBinder.
| Manifest Bundle-Activator: org.foo.mybundle.impl.Activator Import-Package: org.ungoverned.gravity.servicebinder; specification-version="1.1.0" ... Metadata-Location: org/foo/simpleservice/res/metadata.xml |
| Activator package org.foo.mybundle.impl; import org.ungoverned.gravity.servicebinder.GenericActivator; public class Activator extends GenericActivator { } |
The concepts presented here are completely compatible with standard
OSGi, as the services provided by component instances can be used by
standard
OSGi bundles, and component instances can use services provided by
standard OSGi bundles.
To use the
ServiceBinder, it is not necessary to activate is. Activating this
bundle results, however, in the registration of an ArchitectureService,
that allows the architecture of the running application to be
introspected. Figure 3 shows and architecture viewer that displays the
structure of the running application. This viewer can be obtained from
the download pages and is installed as a
separate bundle. Usage of the ArchitecureService is discussed later in
this document.

Next : Using the service binder
Previous : Instance management
Index