Chapter 4. Developing Bundles

In this chapter we describe how to develop bundles. First, we outline the steps to develop a bundle that provides a service, to supply multiple implementations for the same service interface, and to retrieve resources packaged inside the bundle. We then cover how to use services provided by another bundle. Next we discuss how to program service factories and their usefulness. In the section that follows, we explore how to develop library bundles that make class libraries available to be shared by other bundles. Lastly, we explain how to develop bundles that carry native code.

During the process of developing bundles, we introduce you to relevant APIs in the OSGi framework with examples. The complete API specification can be found in Appendix B.

Two more elaborate examples are presented to broaden your understanding of the development of service and library bundles. A section on common mistakes is included to help you avoid many of the errors that frustrate newcomers.

The main goal of this chapter is to familiarize you with the process of developing individual bundles. However, keep in mind that any bundle hardly functions alone in the framework. How to write cooperative bundles is covered in detail in Chapter 5.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.60.62