Liferay Development

Liferay Consulting

Liferay Training

Your Trusted Liferay Solutions Partner

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

Popular Posts

Recent Posts

Recent Posts Widget