OSGi
≈ 5 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
OSGi (formerly known as the Open Services Gateway initiative) is an open specification and open source project which describes a modular system and a service platform for the Java programming language that implements a complete and dynamic component model, something that does not exist in standalone Java or VM environments. It has a service-oriented architecture based on micro services each implemented as an extended Java class file archive (JAR (file format)). The OSGi Alliance, an open standards organization for software founded in March 19991, originally specified and maintained the OSGi standard. The alliance transferred its work to the Eclipse Foundation at the end of 2020.
OSGi (formerly known as the Open Services Gateway initiative) is an open specification and open source project which describes a modular system and a service platform for the Java programming language that implements a complete and dynamic component model, something that does not exist in standalone Java or VM environments. It has a service-oriented architecture based on micro services each implemented as an extended Java class file archive (JAR (file format)). The OSGi Alliance, an open standards organization for software founded in March 1999, originally specified and maintained the OSGi standard. The alliance transferred its work to the Eclipse Foundation at the end of 2020.
Description
OSGi is built around a service-oriented architecture. Applications or components, come in the form of bundles for deployment, can be remotely installed, started, stopped, updated, and uninstalled without requiring a reboot. Management of Java packages/classes is specified in great detail. Application life cycle management is implemented via APIs that enable remote downloading of management policies. The service registry enables bundles to detect the addition of new services or the removal of services, and adapt accordingly. The OSGi specifications have evolved beyond the original focus of service gateways, and are now used in applications ranging from mobile phones to the open-source Eclipse IDE. Other application areas include automobiles, industrial automation, building automation, PDAs, grid computing, entertainment, fleet management and application servers. In October 2020, the OSGi Alliance announced the transition of the standardization effort to the Eclipse Foundation, subsequent to which it would shut down. All artifacts have been transferred to the Eclipse Foundation, where an “OSGi Working Group" continues to maintain and evolve the specification.
Bundles
A bundle is a group of Java classes and additional resources equipped with a detailed manifest MANIFEST.MF file on all its contents, as well as additional services needed to give the included group of Java classes more sophisticated behaviors, to the extent of deeming the entire aggregate a component. Below is an example of a typical MANIFEST.MF file with OSGi Headers: Bundle-Name: Hello World Bundle-SymbolicName: org.wikipedia.helloworld Bundle-Description: A Hello World bundle Bundle-ManifestVersion: 2 Bundle-Version: 1.0.0 Bundle-Activator: org.wikipedia.Activator Export-Package: org.wikipedia.helloworld;version="1.0.0" Import-Package: org.osgi.framework;version="1.3.0" The meaning of the contents in the example is as follows: Bundle-Name: Defines a human-readable name for this bundle, Simply assigns a short name to the bundle. Bundle-SymbolicName: The only required header, this entry specifies a unique identifier for a bundle, based on the reverse domain name convention (used also by the java packages). Bundle-Description: A description of the bundle's functionality. Bundle-ManifestVersion: Indicates the OSGi specification to use for reading this bundle. Bundle-Version: Designates a version number to the bundle. Bundle-Activator: Indicates the class name to be invoked once a bundle is activated. Export-Package: Expresses which Java packages contained in a bundle will be made available to the outside world. Import-Package: Indicates which Java packages will be required from the outside world to fulfill the dependencies needed in a bundle. package org.wikipedia; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { private BundleContext context; @Override public void start(BundleContext context) throws Exception { System.out.println("Starting: Hello World"); this.context = context; } @Override public void stop(BundleContext context) throws Exception { System.out.println("Stopping: Goodbye Cruel World"); this.context = null; } }
Services
Standard services
The OSGi Alliance has specified many services. Services are specified by a Java interface. Bundles can implement this interface and register the service with the Service Registry. Clients of the service can find it in the registry, or react to it when it appears or disappears. The table below shows a description of OSGi System Services: The table below shows a description of OSGi Protocol Services: The table below shows a description of OSGi Miscellaneous Services:
Further reading
External links
Oredev 2008 - Architecture - OSGi Now and Tomorrow Eclipse Equinox Article Index - Articles on an open source OSGi implementation
Text derived from https://en.wikipedia.org/w/index.php?oldid=1370705870 under CC BY-SA 4.0; modifications have been made.
References
- ↩Wikipedia “OSGi” date of foundation (×1) · confidence 0.95 revision URL