Tuesday 22 November 2016

Liferay 7 (DXP) Module Framework (OSGI)


I am sure you would be happy to see Liferay in some new way of development rather than just what you are doing currently.

Yes, I am talking about Liferay 7.


I know very few people aware that LIFERAY is going to launch the new version of Liferay (Liferay 7) very soon(Maybe early months of 2016).

Friends,

Be ready to see some good changes in Liferay 7 as I heard and attend some workshop from Liferay 7 comes up with OSGi based Module Framework.

Liferay’s module framework makes it easier than ever for developers to create Liferay applications and to Liferay Customization!

How it would be helpful to Liferay Developer :
  •     Easier to manage dependencies across module or plugin level.
  •     And the most interesting feature is,Modules can be installed and uninstalled during running   server itself and no need to bounce the server.
  •     Module versioning will helpful developers to reduce/stop class conflict for individual version of modules
  •     Deployment would be quite easy once you understand the build and deployment process through blade tool
  •     Service contract is loosely coupled. It means services can be published and consume from service registry.
  •     It's very fast due to small and secure with small package/bundle.
  •     One more interesting stuff here is, during development you don't need to be dependent on Liferay SDK until and unless your module or individual project follows Liferay's OSGi standards.
  •     In short, this new framework will give very good flexibility to a developer for the development and will increase productivity as well.

Liferay 6.2 and Liferay 7

You would be thinking that how the old plugin creation approach works using Liferay 7. So yes
Liferay 7 actually supports both the implementation still for backward compatibility.

  •     You can still create the portlet in older fashion the way which you were doing with Liferay 6.2 by following JSR-286 standards and creating WAR files for deployment.

  •     With Liferay 7, It simply creates a jar file as it follows module framework architecture. and this is the recommended approach for your new application development.

But yes here you would have to be familiar with OSGi standards and understand the module and component framework here.

Module:

Module is something which is group of Java classes, other optional resources, and a MANIFEST.MF file, packaged together as into a  single JAR file. Liferay 7 uses three modules/bundles.
Modules can have multiple components.

Component:

Component is nothing but implementation of interface like the way we were doing with *LocalServiceImpl class in older fashion. So here what you need to do is, you just will have to load components through annotations in implementation class.These loaded/declared components would be part of modules.

Here Lifecycle of modules and component will be handled through Liferay's OSGi based module framework.