Showing posts with label OSGi Service Registry. Show all posts
Showing posts with label OSGi Service Registry. Show all posts

Tuesday, October 10, 2017

OSGi Whiteboard Design Pattern

Design patterns plays important role in the Software Development. It will define the reusable implementation to the commonly occurred problems. Usually in software development, we can see same problem repeatedly coming in the applications. To address these common problems, expert people came up with solution called design patterns. Design patterns define the solution so that we can implement solution to address the the common problems.

Follow Liferay DXP/7 Tutorial to get more information.

Whiteboard Design pattern is commonly and wide used pattern in OSGi implementations. OSGi Service Registry implemented on White Board Design Patter.

Liferay 7 / DXP have used OSGi Declarative Services (DS) to implements Liferay application modules. It is good to know White Board design pattern and Service Registry. It will give more idea about component services and its working.

When we work with Declarative Service Framework, bundle have several components and these components depends on other components.

Usually component have services and these services shared among other components. Service Registry manage the services registration information and its dependency service information. It will manage services and its references information.

To manage these things OSGi have Service Registry that is based on Whiteboard Design Pattern.

White Board Design pattern will provide the mechanism to register the different component services and the dependency component can easily find it reference service based on their needs. Whenever new service implementation register with Service Registry then dependency will get to know the information so that it can find appropriate dependency service.

Assume Component C1 have service S1 and perform certain task, it needed other service it means service S1 depends on other component services.

Assume S1 service can have several option that can perform task, it means several component provides their services to S1 and S1 can choose any of that service to full fill the requirement. Now S1 have options like C2 component Service S2 and C3 Components Service S3.


To provide these dependency service information or reference service information we need other component so that S1 service can identify its dependent service. To provide this king information we need other component called Whiteboard or Service Registry.

When the component is activated, all the services are register with Whiteboard / Service Registry.


Now C1 component Service S1 can identify, it’s required dependent service from the Whitboard / Service Registry to complete or perform the task.

Here S1 have several option, it can choose any of the service based on its requirement. S1 will use some additional properties to identify the required service at the point of the time. Such a way whiteboard design pattern have used in OSGi to implement Service Registry.



Service Registry is key component in the OSGi implementation and OSGi Declarative Service have used Service Registry to provide dependency mechanism among the component services.  OSGi Declarative Service is core framework to develop OSGi components and its services.

Author

Thursday, November 17, 2016

Open Services Gateway Initiative (OSGi) Terminology

OSGi

Open Services Gateway Initiative is an architecture for modular application development and it’s also knowns as Dynamic Module System for java.

Modularity

Modularity is the way of developing or implementing software as number of unique modules rather than entire software as single unit.

Modules are communicating each other through Application Programming Gateway interface and finally it will form unique system.

OSGi responsibility is to make communication among these modules and manage the lifecycle of modules.

Module

Module is an independent small piece of software and it will fulfill defined business requirements and it can be reuse. Module can work independently or it will associate with other module to prepare complex system. Module consist java files and required configuration files.  

Component

Component is same like module. We can call module and component interchangeably. When compare with scope of component is limited and it’s less than module. A module can be collection of components.

Bundle

A bundle is collection of one or more components. According to the OSGi a bundle is smallest unit of modularization. We can say a bundle is packaged JAR file which consist java classes and required configuration files.

Plugin

Plugin and bundle are similar and in eclipse terminology we call it as plugin.

OSGi Container

OSGi container provides the run time environment to bundles its means it manage the lifecycle of bundles. It will responsible to activate and deactivate bundles and make communication among bundles.

MANIFEST

MANIFEST is configuration file for bundles and OSGi container will read bundle information form this file. It’s same like Deployment descriptor in web applications. It will provides the bundle general information and its dependency with other bundles or components.

OSGi Runtime

OSGi Runtime allows us to register services implementation and consume the existing services.

Service Registry

OSGi Runtime achieved through Service Registry. It maintain the information of services implementation and consume the existing services which are deployed in OSGi container.
OSGi services

OSGi Declarative Service

OSGI Declarative Services is a framework that provide the way to define and consume service by configuring details in the xml file without any dependency in source code to OSGi framework.

Service Component Runtime (SCR)

Service Component Runtime (SCR) is implementation of OSGi Declarative Service from Apache Felix.

OSGi Service Tracker

OSGi Service Tracker responsible to track or finding the services which are registered through service registry in the OSGi runtime.

Bundle Activator

Bundle activator is java class that implements the lifecycle of bundle.

Blueprint

Blueprint is framework form apache which provides the dependency injection nature for OSGi. Its design to deal with dynamic nature of OSGi. It’s similar to Declarative Services.

BnD Tools

BnD provide set of tools to develop OSGi bundles. It’s very easy way to develop OSGi bundles. It will manage bundle dependency and other configurations itself by tool rather developer.

enRoute


The OSGi enRoute project provides a programming model of OSGi applications. The OSGi specifications provide a powerful and solid platform for component oriented programming but by their nature lack ease of use, especially for newcomers to get started.

Author

Recent Posts

Recent Posts Widget

Popular Posts