|
Pump Up Your Technical Knowledge
Listen and watch as industry luminaries bring you the latest on Java technologies
The advantages of a modularization system have been known since David Parnas' paper about modularity in 1972. Modularity was an oversight in object-orientation, where the focus was very much on information hiding, causing object-oriented programs to be highly coupled. In the last decade, many frameworks have been developed to address this coupling problem. Patterns such as Factories, Dependency Injection, and Inversion of Control are targeted at minimizing the coupling between applications and service providers, but most of these solutions require strict discipline of programming teams and do not enforce even the most basic rules of modularity at runtime. The OSGi Alliance has addressed this issue, by developing a framework that uses the unique Java platform mechanisms of interfaces and class loaders to provide a comprehensive dynamic module system for the Java platform. OSGi modules, called bundles, provide the mechanism to restrict the visibility of packages. Instead of leaving the class path more or less to chance, the sharing of classes is strictly controlled, reducing many common problems developers on the Java platform experience daily. Sharing of classes between bundles is dynamic, meaning that bundles can be installed and uninstalled without restarting of the Java virtual machine. These dynamics require an alternative programming model, called service-oriented programming, because some services can disappear while an application runs. The OSGi framework provides the infrastructure to do service-oriented programming, including handling the dynamics. The OSGi framework has, since its inception in 1998, become the de facto component service model for the Java platform. It is now a key technology for applications in a wide range of industries: enterprise, vehicle, mobile phone, home automation, and industrial automation. It has been adopted by Eclipse, BEA WebLogic, WebSphere, Spring, and many other projects. It provides many benefits over the standard Java platform, the giant on whose shoulders it stands, in the development as well as the deployment phase of a system. As always, the easiest way to use OSGi is to use it in a greenfield application, but anything is easy in a greenfield application in comparison to real-world applications, which usually have large amounts of legacy code to consider. Although OSGi runs most Java technology-based applications out of the box, modularizing existing code is not trivial. As John Wells of BEA once said, "We thought we worked modularly, until we started using OSGi." Converting a large code base to OSGi is therefore a nontrivial undertaking. Many applications have been forced to develop their own plug-in system, and these systems, particularly, tend to conflict with strong modularity. A key pitfall in moving systems to OSGi is overmodularizing an existing application. A better approach is usually to turn the existing system into a single module and then gradually move parts of it to other bundles. This presentation shows the problems you can expect when converting large systems to OSGi and shows how these problems can be circumvented.
Watch The Session |
FREE White Papers on Java SE, Java EE, cloud computing and database technologies.
| ||||||
|
| ||||||||||||