Plugin Customization in Liferay

Plugin is the core of Liferay portal development in its various forms. “Plug-in” as the word enunciates is an add-on to perform additional features. It can be blended into an application to enhance primary capabilities. Liferay provides a wide variety of Out Of Box (OOB) features and ways of integration with external parties using its very own Marketplace plugins like:

•          SAML2.0 Provider EE

•          Calendar

•          Wiki             

The above instances of plugins are powerful tools which support multiple ways to extend the functionality of Liferay portal.

Customization and its necessity:

Liferay SDK is assorted with a number of functional portlets, hooks, themes, layout templates and web modules. In order to extend a specific functionality and its integration with business requirement the customization of plugins is essential.

Hence, extending Liferay with hook as a plugin type mitigates the Liferay portal to do almost anything. By extending a plugin, you can use all its features in your new plugin while keeping your changes/extensions separate from the existing plugin’s source code.

The below diagram depicts the flow of customizing plugins in Liferay:

Customizing hook plugin in Liferay:

The plugin customization is an implementation to create the "hook of Liferay plugin".

Here, we state the elaborated steps for customization of a Liferay OOB plugin.

NOTE : We have chosen SAML plugin to demonstrate the customization.

 

  1. Create a SDK hook plugin project using Liferay IDE.
     
  2. Remove all the auto-generated files except build.xml and the docroot folder.
  3. Copy the original WAR file of the plugin to be extended available at marketplace (here :saml-portlet-6.2.10.3.war) to the root folder of your new plugin.
  4. Make the following changes to build.xml inside the <project> tag to reference the original WAR .

    Add the property name and value corresponding to original.war.file and the plugin name to be customized respectively.

  5.  Copy all the files from the original plugin (here : saml-portlet-6.2.10.3.war) to the new plugin project.

  6. Run the “ant-merge” target.

  7. Build services for the plugin which will give a plugin service.jar (SAMLPlugin-hook-service.jar) to be placed in the server lib directory based on the server type distinguished as follows :

  8. Restart the server and deploy the war.

Tomcat installation

Jboss installation

Place the jar docroot\WEB-INF\lib\SAMLPlugin-hook-service.jar to the ext/lib in the tomcat structure.

 

Place the jar docroot\WEB-INF\lib\SAMLPlugin-hook-service.jar to /jboss/jboss-eap-6.1/modules/com/liferay/portal/main/SAMLPlugin-hook-service.jar

 

Add the below entry in module.xml

<resource-root path="SAMLPlugin-hook-service.jar" />

Benefits of plugin customization:

 The plugin customization in Liferay gives us following advantages:

  • Availability of additional features along with the OOB features.
  • API amendment to fulfil the requirements.
  • Supports integration with other application.
  • Flexibility to develop and customize.
  • Forward compatibility.
  • Reduces cost and effort.

Conclusion :

Thus, plugin customization in Liferay makes it possible to embed the additional features while Liferay plugin integration to the application.

0