About OSGi
The Weave server utilises OSGi (Open Services Gateway Initiative) to provide its internal infrastructure. The specific OSGi framework being used with the default Weave installation is the Eclipse Equinox implementation. In this section we attempt to explain "why OSGi?"
The Problem
Software complexity is increasing at an alarming rate. Today, a large part of this complexity is caused by shortened product cycles, requirements for drastically increased functionality, and an increasing
number of variations of the same product (e.g. different hardware and operating systems). These trends have caused software costs to become a larger percentage of almost any manufacturer’s
development cost.
For an organisation it is now typical for software development to largely consist of adapting existing functionality to perform in a new environment. In the last 20 years, a large number of standard building blocks have become available and they are heavily used in today’s products. A prime example is the success of open software. However, the use of these libraries is not without problems. Integrating many different libraries can be daunting because many libraries have become complex and require their own libraries to function, even if that functionality is never needed for the product. This trend requires monolithic software products to undergo a heavy testing cycle. Add unsynchronized evolution of the different libraries and it becomes clearer why software development is so costly today.
A key issue is that today’s software environments focus on writing new software, instead of integrating existing software into new systems. In reality, integrating existing code has become a large part of
the work of software developers. Therefore, there is a need for tools that standardise the integration aspects of software so that reusing existing components becomes reliable, robust and cheap.
OSGi technology is the dynamic module system for Java. The OSGi Service Platform provides functionality to Java that makes Java the premier environment for software integration and thus for
development. In turn, Java provides the portability that is required to support products on many different platforms. The OSGi technology provides the standardised primitives that allow applications to be constructed from small, reusable and collaborative components. These components can be composed into an application and deployed.
The OSGi Service Platform provides the functions to change the composition dynamically on the device of a variety of networks, without requiring restarts. To minimise the coupling, as well as make these couplings managed, the OSGi technology provides a service-oriented architecture (SOA) that enables these components to dynamically discover each other for collaboration. The OSGi Alliance has developed many standard component interfaces for common functions like HTTP servers, configuration, logging, security, user administration, XML and many more.
OSGi technology enables improved time-to-market and reduced development costs because OSGi technology provides for the integration of pre-built and pre-tested component subsystems. The technology also reduces maintenance costs and enables unique new aftermarket opportunities because components can be dynamically delivered to devices in the field.
The OSGi specifications are so widely applicable because the platform is a small layer that allows multiple Java based components to efficiently cooperate in a single Java Virtual Machine (JVM). It
provides an extensive security model so that components can run in a shielded environment. However, with the proper permissions, components can reuse and cooperate, unlike other Java application
environments. The OSGi Framework provides an extensive array of mechanisms to make this cooperation possible and secure.
The presence of OSGi technology-based middleware in many different industries creates a large software market for OSGi software components. The rigid definition of the OSGi Service Platform
enables components that can run on a variety of devices, from very small to very big. Adoption of the OSGi specifications can reduce software development costs as well as provide new business opportunities to expand Weave in places never previously thought.
Weave and OSGi
Weave is built using the Eclipse Framework. The Eclipse Framework is an implementation of the specification set out by the OSGi alliance. Eclipse moved to the OSGi at version 3.0 to help consolidate
their plugin architecture and help future proof the underlying system. In doing so, a sub project called Equinox was created which deals only with implementing the OSGi specification.
The Equinox Framework also provides utilities and helper classes that enable Weave to easily embed other frameworks and systems on top of it. An example of this is Business Intelligence Reporting
Tool (BIRT). Using a plugin approach enables Weave to be a truly modular application made up of smaller parts that contribute to make the entire system.
Embedding BIRT inside Weave was made easier due to the fact that BIRT itself is built on top of Eclipse and as we have mentioned, Eclipse is built on top of OSGi. A more generic example of
embedding a third party system into Weave is allowing the ActiveMQ to be run as a service within Weave.
ActiveMQ is an open source implementation of the JMS (Java Messaging Service) specification. ActiveMQ allows for both synchronous and asynchronous communications to be sent and received from a variety of sources. These messages can be sent via a variety of protocols, e.g. TCP, STOMP, etc. Weave was able to use the embeddable nature of ActiveMQ to create a bundle to start ActiveMQ on a defined port, and have other bundles listen for messages via the way defined in the JMS specification. The main usage for this has been to asynchronously update vehicle locations on a map without the need to refresh the map.
From now on the terms plugin and bundle are interchangeable. The OSGi specification uses the term bundle and Eclipse uses the term plugin which was used before Eclipse adopted OSGi.