Introduction to OSGi introduction-osgi

An introduction to OSGi, a dynamic modular architecture for Java applications that is the basis for Adobe Experience Manager.

" " Hello and welcome everyone. My name is Abhishek Dwevedi and in this video, we are going to learn about OSGi. After completing this video, you should be able to define OSGi and explain benefits of using OSGi.
And you should also be able to described terms like bundle, components, and service.
OSGi is a fundamental element in the technology stack of AEM. OSGi technology is a set of specifications, that define a dynamic component system for Java. These specifications enable a development model, where an application is composed of several components, which are packaged in bundles. These components can communicate locally and across the network through services. The key reason OSGi technology is so successful, is that it provides a very mature component system, that actually works in surprising number of environments. The OSGi component system is actually used, to build highly complex applications like Eclipse ID, application servers like GlassFish, IBM WebSphere, JBoss. It is also used to create application frameworks, industrial automation etc. OSGi is one of the important technologies stack in AEM. It supports modular deployment of bundles. It is a fundamental layer in AEM stack, which is used to control the composite bundle of AEM and the configuration. It enables applications to be created from smaller, reusable and collaborative components. An OSGi application is a collection of bundles, that interact using service interfaces. Each OSGi components is contained in a bundle. Bundles are independently developed and deployed. Bundles can be installed, started or stopped individually. Bundles and their services may appear or disappear anytime. Interdependencies between modules are automatically handled. Now let’s see some of the benefits of OSGi. For businesses, the benefits of OSGi is that; it is modular and dynamic model, which reduces operational cost and integrates multiple devices in a network environment. It helps in tackling costly application development, maintenance and remote service management. There are many benefits for developers as well. OSGi reduces complexity by providing a modular architecture, for today’s large scale distributed systems, as well as small and embedded applications. Building systems from in-house and off the shelf module, significantly reduces complexity and thus development and maintenance expenses as well. The OSGi programming model realizes the promises of component based system. The OSGi component model makes it very easy to, use many third party components in an application. An increasing number of open source projects, provide their jars ready for OSGi. This helps in re-usage of available technologies and functionalities. The OSGi technology is not just a standard for components, it also specifies how components are installed and managed. This makes the deployment easier for OSGi application. The OSGi component model is a dynamic model. Bundles can be installed, started, stopped, updated and uninstalled without bringing down the whole system.
This makes the updates easier and dynamic. Using OSGi is surprisingly simple, despite the powerful dependency management, configuration and dynamics. One of the prime responsibilities of OSGi framework, is loading the class file bundles. In traditional Java the jars are completely visible and placed on linear list. Searching class requires searching through this list. In contrast, OSGi provides bundles and knows for each bundle exactly, which bundle provides the class. This lack of searching, significantly increase the speed of the system. Now let’s see, the architecture of overshare. On the bottom we have native operating system and we have Java VM. On the side we have bundle, bundle as we discussed are OSGi components which are made by our developers and that’s going to contain our components and services. The service layer connects the bundle in dynamic way, by offering a publish-find-bind model, for plain old Java object. The execution environment defines, what methods and classes are available in a specific platform. Modules is a layer that defines how a bundle can import and export a code. Lifecycle is the API to install, start, stop, update and install the bundle and the security is the layer, that handles the security aspects. Now let’s see what bundle is. Typically a bundle is just a jar file, but it has some additional metadata, that is added to its manifest. This manifest may include the bundle name, bundle version, lists of services imported and exported by the bundle and optional information like; minimum Java version required vendor copyright statement, etc. Now let’s talk about the components.
Now components are main building block, for oversea application and they are provided by a bundle. Bundles will contain and provide one or more component. Now what is a component? Component is a piece of software managed by over a container. It’s a Java object created and managed by container.
So on this graphic if you see that white part is a component and this blue part is a bundle. So a bundle can have one or more components. The OSGi container manages component configuration and lists all the services that it will consume or expose. So a component can provide a service and a component can implement one or more Java interfaces as service. One of the main part of a component is service and oversee service is a Java object instance, registered into an OSGi framework with a set of properties. Each bundle may register zero or more services. Each bundle may also use zero or more services… that exist no limit on number of services, more than the ones given by memory limits or Java security permissions. The service concept is a very general purpose too, some examples are; you can export functionality from a bundle to other bundle, you can import a functionality, from one of the third party bundle into your own bundle. You can restart listeners for event and your service can be used for different kinds of functions required for business. Now you should be able to define OSGi, you should be able to explain benefits of using OSGi and you’re also able to describe terms like bundle, components and service. Thank you for watching this video. Have a great day. -