| | The first two articles in the Hello, OSGi series have laid the groundwork for understanding how the OSGi service platform works. In this final installment, you'll learn how OSGi's pluggable, component-based development model applies to Web applications. You'll build a bundles-based OSGi application that can be used to serve static resources, servlets, or JSPs. You'll also gain hands-on experience using the Equinox framework to easily leverage OSGi's modularity, versioning, and dynamic services in your Web applications. | Like many Java developers, Sebastien Arbogast only recently realized OSGi's tremendous potential for bringing modularity to the Java platform. Since then he has become an OSGi enthusiast and founded DZone's OSGi zone. In this discussion with Andrew Glover, Sebastien succinctly introduces OSGi and explains why its contribution to Java modularity is such good news for Java developers on the server side. He also discusses the competing Java modules specifications (JSR 291 and JSR 277), talks about the app-server migration to OSGi, and makes a tentative prediction about what might be coming next for this exciting technology. | The Open Services Gateway Initiative (OSGi) defines an architecture for developing and deploying modular applications and libraries. In this first article in a three-part introduction to OSGi, Sunil Patil gets you started with OSGi development concepts and shows you how to build a simple Hello World application using the Eclipse OSGi container implementation, Equinox. He also touches briefly on building service-oriented applications using OSGi and introduces OSGi's ServiceFactory and ServiceTracker classes. | The twenty-four second explanation: OSGi is a framework for Java in which units of resources called bundles can be installed. Bundles can export services or run processes, and have their dependencies managed, such that a bundle can be expected to have its requirements managed by the container. Each bundle can also have its own internal classpath, so that it can serve as an independent unit, should that be desireable. All of this is standardized such that any valid OSGi bundle can theoretically be installed in any valid OSGi container. | It's always been difficult to get the current time from Java. Sure, you could just use new java.util.Date(), or System.currentTimeMillis() if you're looking for distance from the epoch, but ... those are so difficult, and so inelegant, am I right? Okay, so it's not so hard. But we'll use the clock bundle and the heap display to demonstrate the whiteboard pattern, while understanding that neither of these is particularly hard or interesting in and of themselves. I'm sure readers can think of their own use cases that would be of more interest. The whole idea behind the whiteboard pattern is that bundles register services under a common name, and a consumer comes along and regularly requests information from each of its providers; as such, what we'll do is first design our ClockContentProvider, then our simple Activator, then our handy-dandy manifest file for OSGi. | Right-click or Control-click to download this MP3 file. You can also subscribe to the Java Mobility Podcast Feed to get the latest podcast automatically. If you use iTunes you can open iTunes and subscribe with this link: Java Mobility Podcast in iTunes. | Converged mobile devices perform a wide variety of tasks from personal information management, communication to enterprise data access. That requires client applications with many functional modules. However, monolithic client applications with intertangled code segments are very hard to develop and maintain. In addition, in the enterprise environment, it is very costly to track different versions of the client and manage updates (including critical security patches). Hence, a framework is needed to develop and manage modularized application and service components. Here, I'll introduce the concept of managed smart clients -- self-contained components inside software containers. The container provides common crosscutting services and a framework for components to communicate with each other. The industry standard for lightweight mobile containers is the Open Services Gateway initiative specification. Using several OSGi applications, running in this example on the IBM Service Management Framework, I explain how OSGi-managed smart clients work in real-world applications. In addition to supporting managed clients, OSGi applications can also deliver mobile gateway services, which will also be covered here. | |
|