What is OSGi & what’s in it for you?
What is OSGi?
Kai Hackbarth has been working as an evangelist at Bosch Software Innovations since July 2016. He previously worked at ProSyst Software, which Bosch acquired in 2015. Kai Hackbarth plays a pivotal role in technical standardization in the OSGi Alliance, of which he is also a Board of Directors member. He served as Co-Chairman of the OSGi Residential Expert Group from 2008 to 2018. Kai Hackbarth furthermore coordinates a wide range of Internet of Things (IoT) research projects. He specializes in smart homes, automotive applications, and the IoT.
Kai Hackbarth OSGi has several different facets. For starters, there is the OSGi Alliance. An organization founded in 1999, it initially focused on standardization efforts in the context of smart homes. Over the years, the scope of these efforts broadened. Today, they encompass domains that go beyond smart homes. For instance, the Alliance specifies a general-purpose framework based on Java. It’s called the “OSGi framework” which is being used in embedded devices, as well as enterprise application services like IBM WebSphere. The Eclipse IDE is also based on OSGi.
In addition to the OSGi framework, the Alliance defines several general-purpose specifications. These include specifications on logging, user-management, and permission management.
The Alliance also comprises expert groups that deal with more specific topics. One such group works on technical requirements and specifications concerning the IoT. The Enterprise Expert Group on the other hand deals with use cases in enterprise business scenarios, while the Residential Expert Group was dedicated to devices like residential gateways and building automation gateways.
What is the OSGi framework?
Kai Hackbarth OSGi defines a Java-based modular software architecture that follows the principles of a service-oriented architecture (SOA). What does this mean in practice? Let’s say you develop a parking service. A closer look reveals that you can break this service down into smaller chunks: You need a GPS service that tells you where the car is located. You might also need a service that looks for open parking spots in the area and another that reserves a parking spot and pays when you leave. What appears as a parking service on the surface, is made up out of a number of different components beneath. It’s this splitting of the application into bundles such as the GPS service, among other things, that the OSGi framework takes into account.
Working with bundles makes the process of updating parts of an application easier. When you develop an update for an application as a whole, you run the risk of unintentionally creating errors elsewhere. The OSGi framework allows you to target updates for specific bundles without affecting the rest of the application, thus eliminating the need for extensive checks in different places to ensure an update functions properly.
The modular structure also means that you don’t have to develop every new application from the ground up. Should you need location information for another application, you can simply reuse the GPS service you developed for the parking service.
What are the benefits of OSGi from a developer’s perspective?
Kai Hackbarth From a development standpoint, OSGi leads to more structured approaches. Imagine different development teams, potentially located in different parts of the world, working on the same application. When it’s time for the teams to integrate their individual code, discrepancies are almost always a given. The integration of code is rarely a smooth process and it often takes a lot of time and effort to iron out the kinks. This is referred to as “integration hell”.
Since OSGi follows a modular structure, the integration of code becomes much more seamless, thus effectively avoiding integration hell. This also means different development teams can work together more efficiently, even if they are located in different places. As already mentioned, the process of modifying and updating an application after it has been deployed becomes easier as well. Developers can simply focus their attention on the specific part that needs updating.
With lots of different devices comes a variety of different communication protocols. Using the “abstraction layer”, OSGi also helps developers cope with this challenge. This layer allows you to abstract devices from their protocols and develop applications using a single interface. Let’s say you work with a gateway that supports ZigBee, Bluetooth, and Z-Wave. Thanks to the abstraction layer, you don’t have to be an expert in these protocols – your application will simply work with all of them.
Using OSGi, however, also means putting in more thought and effort when starting out with a project. Developers must consider how they want to modularize their application. They must also define dependencies between different application parts. While this process is bound to take time, it also ensures that the rest of the development process runs smoothly.
What are the benefits of OSGi from a company’s perspective?
Kai Hackbarth OSGi helps companies manage the complexity of their applications. In the IoT world, you cannot develop and launch a product and subsequently forget about it. You have to continually update and adapt your applications to meet ever-changing demands from your customers. This is exactly where OSGi can be of help.
To leverage the benefits of OSGi, companies must commit to using it. If a company decides to develop an OSGi-based product or application, while using different technologies for its other products, the benefits are not going to be as significant as the company might have hoped. As with any other technology, using OSGi should be a strategic decision a company takes as a whole. Think about it: If a company develops a number of different OSGi-based products, it can benefit from the modular structure OSGi provides. It allows you to develop a specific component only once and reuse it should the need arise. This can save development resources and allows a company to focus on entirely new features.
Why is OSGi often referred to when talking about the IoT?
Kai Hackbarth The IoT is a heterogeneous environment. It spans a variety of domains with many players offering different solutions and products. To cope with this complexity, standardization and interoperability in one form or another is needed. And OSGi provides just that.
It not only helps you develop applications that are compatible with different platforms. As I already explained, OSGi is also useful when it comes to the way you develop and maintain applications. It enables companies to further evolve their applications and developers to easily provide targeted updates, as well as add new features. Last but not least, OSGi is domain agnostic, making it the perfect fit in a field as diverse as the IoT.