Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When creating an OSGi-based application there are two main orthogonal issues to consider:

  1. Service model vs. extender model
  2. Bundled application vs. hosted framework

The first issue is actually a general issue when creating OSGi-based applications. There are two different general approaches that can be used when creating an extensible OSGi application. The service -based model approach uses the OSGi service concept and the service registry as the extensibility mechanism. The extender -based model approach uses the OSGi installed bundle set as the extensibility mechanism. Both approaches have their advantages and disadvantages and they can be used independently or together.

The second issue is related to whether your application is run completely on top of the OSGi framework as a set of bundles or whether your application acts as a host for hosts an embedded OSGi framework instance. Creating applications completely as a set of bundles is the preferred approach since it allows the application to run on any OSGi framework, but this it not always possible. In such cases where it is not possible or desired, then you may embed host a framework instance inside your application, which will likely tie your application to that framework implementation.

...

The example application is a very simple drawing paint program that effectively functions identically whether using services/extensions or running embedded/hosted. The application, called the host, defines a SimpleShape service/extension that it uses to draw shapes. Different implementations of the SimpleShape can be created to allow the application to draw different shapes. Each shape service/extension has name and icon properties that the application uses for manipulating the services/extensions. Available shapes are displayed in the application's tool bar. To draw a shape, click on its button in the tool bar and then click in the drawing canvas. Shapes cannot can be resizeddragged, but they can be dragged aroundnot resized. When new shape services/extensions appear they are automatically added to the tool bar and they are automatically removed when the shape services/extensions disappear. Closing the applications application window causes the framework and the JVM to shut down. The following is a screen shot of the application.

...

The host bundle from the previous section also implements the embedded, hosted framework service-based approach. The host bundle activator has a static main() method that creates an embedded instance of Felix and loads the shape service bundles. The shape service implementations are the same for both bundle-based and stand-alone applications the bundled and hosted framework application versions in this case. To execute the stand-alone hosted framework application, issue the following command:

...

To successfully execute the stand-alone hosted framework version of the application, you must be in the "servicebased.host" project directory when issuing the above command and you must have already built all of the other projects (i.e., circle, square, triangle).

...

The host bundle from the previous section also implements the embedded, hosted framework extender-based approach. The host bundle activator has a static main() method that creates an embedded instance of Felix and loads the shape extension bundles. The shape extension implementations are the same for both bundle-based and stand-alone applications bundled and hosted framework application versions in this case. To execute the stand-alone hosted framework application, issue the following command:

...

To successfully execute the stand-alone hosted framework version of the application, you must be in the "extenderbased.host" project directory when issuing the above command and you must have already built all of the other projects (i.e., circle, square, triangle).

...