Friday, December 13, 2013

Liferay Portal Development Introduction

Liferay is open source portal which follow JSR 168 and JSR 286 standards.

Liferay development can be achieved from Plugins SDK it is Standard Development Kit for liferay portal.

Liferay Portal already has more components apart form that if we want add anything to existed liferay portal we need to develop Plugins.

To develop Plugins liferay have given Standard Development Kit i.e. called Plugins SDK.
Liferay Portal can categorize into following  parts.

  • Portal Kernel
  • Portal Implementation
  • Portal Services


Portal Kernel:

Portal Kernel is set of java classes and interfaces which is core components of liferay portal. This kernel can available to outside of portal. From this we can add or develop new things to liferay portal, means out of box features we can develop. This kernel inherits from JSR 168 and JSR 286 features.

All classes and interfaces they are packaged in portal-keranl.jar in previous version of liferay, now it is available inside portal-service.jar

Portal Implementation

Portal Implementation is set of Implementation classes which are derived from Liferay kernel specific to liferay portal use. This component designed for liferay portal built in functionality. All these are packaged in portal-impl.jar


Portal Services

Portal services are is database services which interact with liferay database means lportal database. Whenever we want connect to portal database from Plugins we will use this service layer to connect to liferay database.

What is Liferay Portal?

Liferay implemented their own frameworks and component in Portal Implementation layer and database services packaged as portal service layer,  if we combine these two then it will be become Liferay Portal and portal kernel is common.

We can say like follows

Liferay Kernel +Liferay Implementation +Liferay Services=Liferay Portal

To add new components or  to modify exited competent we need liferay support to outside, for this they have given Portal Kernel and Portal services to outside availability means which is available to Plugins.

Liferay packaged Liferay Kernel and Liferay Services in portal-services.jar

What is meaning of outside availability?

It is nothing but make it accessible their jar files to other applications means these jar files available in application servers global class path

In tomcat tomcat/lib/ext this global class path if any jar available in this directory then any liferay plug-in can use this classes and interfaces.

In Jboss  jboss-7.1.1\modules\com\liferay\portal\main

When we look at these directories we can find portal-service.jar file. So we can say this jar can available to any application that is deployed in server.


Note:

These directories we can see only in liferay supported application servers, means we download liferay tomcat bundles or liferay jobs bundles with these servers only we can see above directories.

The following diagram shows portal-service.jar in tomcat/lib/ext




As of now we are talking about component and Plugins

What is Liferay Plugins?

Liferay Plugin is piece software or set of classes which follows the standard defined by liferay.
A plug-in is a component which can change or modify the behavior of liferay portal or it can add new behavior to portal.

We already said liferay is software which consist of many components and feature so that we can use directly.

It is huge web application have many features and can support many integration with other application.

Liferay have exposed entire their web application as ROOT.war. This is completely liferay developed application which can get from any bundles which we download form liferay web site.

ROOT.war can see in server’s deployment directory

In tomcat we can see ROOT.war file in Tomcat/webapp  directory as follows


In JBOSS we can see in deployments directory




Well now liferay is already a huge web application and liferay has exposed their core components in Global class path, so that we can start customize or add new feature to the liferay.

To customize or develop new feature to liferay portal we need Standard Development Kit that is called Plugins SDK.

Note:

Liferay portal is web application which contains java classes, XML files, velocity files, property files and JSP pages.

Plugins SDK consist of 5 main parts

  1. Portlet
  2. Hook
  3. Ext
  4. Theme
  5. Layout

When we open downloaded Plugins SDK then we can see 5 main plugins.




Plugin Portlet

Portlets are independent component which can add new behavior or new feature to liferay portal.

It is very flexible components we can add or remove very easy without effect the portal or server. We can develop portlet which can use their own database tables or existed tables. Portlet can also connect to other databases or liferay existed database.

As we discussed earlier portlet can use liferay kernel and liferay services.

We have different kinds of portlet like Liferay MVC portlet, Generic Portlet, Struts Portlet, JSF Portlet and Spring Portlet.

By default Liferay have own portlet frame work i.e. called Liferay MVC frame work which have lot of support in liferay.

Out of box to support other frame work liferay provide some bridges from which we can run any portlet like struts, spring and JSF portlet.

Plugins have well appreciated feature is hot deployment components, means when we deploy the portlet, we need not stop server and change can apply immediately.

If we use Liferay MVC portlet it is easy to create and very light weight.

Note:

In liferay development Liferay IDE supports only Liferay MVC portlet and JSF portlet development. If you want use out box portlets you need manually create portlet and need to add required jar files. Liferay has very good support to JSF frame work portlet.

Advantages:
  • Plug and play
  • Hot deployment feature
  • Can support any J2EE MVC frame work in out box.
  • Once we developed in liferay we can run in other portals with minimum changes.
  • These are very easy to migrate when we upgrade portal from one version to other versions.

Limitations
  • From Plug-in portlet we can’t access portal implementation layer and we can’t change the existed behavior of liferay portal.


Hook

In liferay Hooks are special purpose plugin we can change or modify the existed behavior of liferay portal. Hook can customize the portal but some set of limitations.

Hook can modify the some of the things like properties files, jsp, events and portal services.

Hooks can change the existed portal properties so that we can see the change in portal behavior.

We can change existed portlet jsp pages so that we can add or remove some code in JSP pages.

This is also hot deployment like portlet we need not to stop server we can see the changes.

Advantages
  • It can change the existed behavior of portal
  • It is hot deployment component.
  • Portal existed services also we can change
  • These are very easy to migrate when we upgrade portal from one version to other versions.

Limitation
  • We can’t modify or change the action classes or main core classes in liferay portal.

Ext

Ext is one of the plug-in in liferay portal which have lot of ability can change anything in existed liferay portal.

We can change the portal implementation through ext so that we can change existed behavior in lifery portal.

we can also create new features from ext. these are not hot deployment so every modification we need to stop server and these Ext’s are very tightly coupled component with  liferay portal means which is not much flexible when we add or remove .

Advantages
  • It can change any part of liferay portal

Limitations
  • These are not hot deployments components
  • Very tightly coupled with liferay core portal
  • Very tough when we migrate portal from one version to other version

Note:

 In future liferay may avoid ext completely.

Theme

Theme is the one of the plugin to change the look and feel of portal. Means we can change CSS and java script files from theme.

Liferay portal is using velocity template when portal is rendered in web page this velocity file have capability can accommodate dynamic content like JSP pages.

From themes we can create new look and feel to liferay portal and we can add new CSS and new velocity templates.

Themes also hot deployment component we can deploy theme without down or stop server.

Layout

Layout can decide the page design. It can divide the page into some section in that we can arrange the portlet to complete the web page. Layouts also hot deployment components.

The following is example screen for layouts




Important Points

  • Liferay have given Plugins SDK to develop liferay applications.
  • Liferay plug-in portlets are very flexible and we can migrate very easy when we upgrade portal.
  • We need to minimize development of  Ext
  • Liferay MVC frame work is very flexible to develop plug-in portlet and Liferay IDE has support to develop these portets.
  • Liferay also have rich support to JSF portlet we can use JSF portlet too.
  • Whe we use other frame work to develop portlet we need add some liferay bridges to support other frame work in liferay portal.
  • All Plugins are hot deployments except ext. So we don’t need to stop server when we deploy the Plugins.

Related Articles

Author
Meera Prince

Popular Posts

Recent Posts

Recent Posts Widget