Chapter 6. Moving toward bundles

 

This chapter covers

  • Choosing a bundle identity for a JAR file
  • Determining which packages a bundle should export and/or import
  • Migrating an application to OSGi
  • Dividing an application into a set of bundles

The first part of this book introduced the three layers of OSGi: module, lifecycle, and service. We’ll now take a more practical look at how you can migrate existing code to OSGi by using one or more of these layers, beginning with examples of turning real-world JAR files into bundles. After that, we’ll examine different ways of migrating a complete application to OSGi and finish up with a short discussion of situations where you might decide not to bundle.

By the end of this chapter, you’ll know how to take your current application and all of its third-party libraries and turn them into bundles, step by step. You’ll be able to move existing projects to OSGi, plan new projects with OSGi in mind, and understand when it may not be the right solution for you. In other words, you should be able to explain in detail to your manager and co-workers how OSGi will affect your project. But before we reach that stage, we first need to consider a simple question that often comes up on the OSGi mailing lists: how can you turn your JAR file into a bundle?

6.1. Turning JARs into bundles

6.2. Splitting an application into bundles

6.3. Summary

sitemap