4.1. Writing Service Bundles

A service should provide a public interface that specifies what it does and the necessary implementation classes that realize how it is done. The service must be registered with the framework to be useful for other bundles on the gateway.

The general process of developing a service bundle is as follows:

1.
Design the service interface.
2.
Implement the service.
3.
Write a bundle activator that usually registers the service in its start method and unregisters the service in its stop method.
4.
Declare the packages exported by your bundle in the Export-Package manifest header; the service interface should belong to the exported packages.
5.
Compile the classes and pack everything into a bundle JAR file.

Let's ...

Get Programming Open Service Gateways with Java Embedded Server™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.