Showing posts with label Struts portlet. Show all posts
Showing posts with label Struts portlet. Show all posts

Monday, April 14, 2014

Liferay Plugin Portlet Development Choices

Introduction:

Liferay is very good portal technology and its completely open source. Liferay have very good support to run other framework applications in portal with the help of little work.

Liferay already have inbuilt portlet framework to develop portlets and some are available for Plugin portlet development and some are not available for Plugin portlet environment.

In liferay we have two choices to create portlet one is  Plugin Portlet environment and other one is Plugins Ext.

We never use EXT for create new portlet and we use only Plugin portlet environment to create new portlet.

Liferay have few inbuilt portlet frameworks to create portlet and run into liferay portal.

The following are the Portlet frameworks which are inbuilt for Liferay Portal.
  1. Generic Portlet
  2. Liferay MVC Portlet
  3. Liferay Struts Portlet

Generic Portlet

This is very basic portlet and comes with javax.Portlet API. This is very default portlet in any portal and all portals have support to run Generic Portlet because Generic Portlet follows JSR Standards. We will implement javax.Portlet Interface for Generic Portlet.

 Liferay IDE have direct support to create Generic Portlet and we can deploy into Liferay Portal. We can use Generic Portlet in Plugin Portlet Development.

Liferay MVC Portlet

 It is inbuilt Liferay frame work and it is very simple to develop and use. Liferay IDE has support to create this portlet skeleton and we can deploy into liferay portal.

This is very easy to create and deploy into liferay portal apart form that we will use JSP for view technology and Liferay Service Builder for Service layer.

Liferay Struts Portlet

We cannot create this portlet in Plugin Portlet Environment we can create using EXT only but it’s not recommended. Liferay Struts Frame work  built it on top of Struts 1.x framework. All liferay portal portlet was developed in Liferay Struts Framework

Out of Box Portlets:

Liferay also support for other web application frame works and those will work in liferay portal. We have many popular frame works in web applications development and we can also use those frame works to create liferay Plugin portlets.

But these frame work won’t work directly in portals because general web application frame work flow is different from portlet flow.

Web application framework use servlets and servlet container to make the components and run the components. So here servlet life cycle is different from portlet lifecycle

To use other web application frame works such as struts, spring, jsf and vaadin in portals, the frame work vendor is responsible for create some bridges which will make web application frame work run in portals or which can run in portlet container.

These bridges are responsible to convert web application flow into portlet flow i.e. servlet lifecycle will be converted into portlet life cycle.

Example:
  • Struts have given Struts Bridges
  • Spring have Spring Portlet MVC library
  • JSF has JSF bridges.

The following is screen shot i.e. what kind of frame works supported by liferay portal


The following are popular frame portlets which supported by Liferay Portal.
  1. Struts 2.x Portlet
  2. Spring Portlet MVC Portlet
  3. JSF 2.x Portlet
  4. Vaadin Portlet
  5. PHP Portlet
  6. Perl and Groovy Portlet

Struts 2.x Portlet:

Struts 2.x portlet will use strut frame work and development is similar to normal struts web application development but we need to add some other configuration files such  as portlet.xml, liferay-portlet.xml and need to add frame work supported portal bridges.

View Technology:
  • We will use JSP for view technology.
  • JSP,JSTL, Struts Tag Library additional benefit to make RIA development and Struts already proven in the market as best web application framework. Struts will use tiles concept to aggregate page and we can also use free marker templates.

Strengths:
  • Struts frame work have very good front end controller to navigate and render views.
  • Rich Built in Struts Tags.

Limitations:
  • Struts have support and full fill only JSR 168 feature and not all JSR 286 standards (You can explore more on this).
  • Liferay have not direct support for struts 2.0. If any environmental problems then our self need to solve or need to approach struts fame work community.
  • Liferay IDE has not direct support to create Struts 2.x portlet we need to manually add configuration files and Libraries.

When it recommends?

If anybody who good at struts frame work and vast experience then we can choose this one.

Development Options:
  1. Struts 2.0+Liferay Service Builder+ JSP (Tiles,JSTL, Struts Tags)
  2. Strust 2.0+ Spring+Hibernate+ JSP (Tiles,JSTL, Struts Tags)

Reference Links:



Note:

Entire Liferay Portal Portlet has built it upon struts 1.x frame work and they have designed Liferay Struts Frame Work on top struts 1.x.

Unfortunately Liferay Struts Frame Work was not available to Plugin Portlet Environment.

Spring Portlet MVC Portlet

Spring Portlet MVC Portlet is another choice in liferay and its very good framework. Spring Portlet MVC Portlet API is a Portlet Bridge to make spring works in Portals and it also follows JSR standards.

Strengths:
  • It very good frame work and Very big Community for spring so definitely we have good support.
  • If we choose spring we have rich flexibility use other technologies because spring frame work already has many Plugins for integration.
  • We can use JSP, JSTL and Spring Tags for UI development.
  • We can use JQuery or Legacy JS for Java Script.
  • We can also use Struts 2.x or JSF 2.x as front Controller

Limitations:
  • It’s Also full filled JSR 168 stands still it need to full fill JSR 286 standards.
  • Liferay with spring have some environmental integration issues especially in Context loading problems. Liferay already used spring and hibernate for Service Layer.
  • Spring Portlet MVC with Liferay Service Builder has some context loading issues.
  • We can go with Spring DAO Implementation with Hibernate but we are missing sharing of services between portlets. So we need to handle differently when we want share portlet services with other portlet.
  • No Direct Liferay Community support but spring community and liferay forum people can support well.
  • Liferay IDE not have support to create Spring Portlet we need create simple MVC portlet and need to add configuration files and libraries manually.

Reference Links:



JSF 2.x Portlet:

JSF is also very popular frame work in web application development and its from Java Community.

JSF 2.x have very good new features and they have used XHTML as view technology it very good choice rather than JSP.

JSF 2.x frame work has very good component libraries for Rich Internet Application development.

We have very popular JSF component libraries such as Prime Faces, Rich Faces and ICE Faces.

JSF 2.x Specification has two different implementations JSF Mojarra and Apache Myfaces.

JSF Mojarra have jsf-api.jar and jsf-impl.jar is two libraries which implemented JSF frame work.

If we use JSF Mojarra we can use Prime faces, Rich Faces and ICE Faces as component libraries.

Apache Myfaces already have their own component libraries such as Trinidad, Tobago and Tomahawk.

We already know to make it work other frame works in liferay portal we need frame work support bridges so that we can use in portlet development.

Liferay have started special community to support JSF framework to run in liferay portals. The project name is Liferay Faces.

Before we have JSF portlet faces have separate community and they started to implemented libraries so that it was used to run JSF frame work in Liferay. Now Liferay Faces is part of Liferay now have rich support for JSF in Liferay.

Liferay Faces have chosen JSF Mojarra implementation, based on this they have implemented JSF portlet bridges that will make JSF works in Liferay Portal. Once we use JSF bridges we can develop portlet and run in liferay portal.

We can use any component libraries which will support by JSF frame work in JSF portlet development such as Prime Faces, ICE faces and Rich Faces. Apart from this Liferay Also stared develop their own component library i.e. Liferay Faces Alloy.

Alloy Faces is JSF component library which  used to Liferay JSF Portlet development as UI complements for RIA (Rich Internet Application) development.

It used Alloy UI Java Script to implement and we already know Alloy UI is one of the projects from Liferay and Entire Liferay Portal have used AUI java script.

So Liferay started developing JSF components with help of AUI i.e. Liferay Faces Alloy.

Liferay Faces have given 3 Libraries As Follows
  1. Liferay Bridge Faces
  2. Liferay Faces Portal
  3. Liferay Faces Alloy

Liferay Faces Bridge

Liferay Faces Bridge is core library which will make JSF work in Liferay Portal and its responsible for convert JSF life cycle into portlet lifecycle and it based on JSF Mojarra implementation.

Liferay Faces Portal

Liferay Portal Faces is library responsible for to use Liferay Portal API in JSF portlet development and have set of classes and interface which interact with Liferay Portal API.

Liferay Faces Alloy

Liferay Faces Alloy is Liferay component Library for JSF portlet development and it has many UI components for rapid application development.

Strengths:
  • Its part Liferay Project so more support when we start JSF portlet development.
  • JSF frame work has many choices for UI component libraries so we can develop portlet applications very fast.
  • JSF have Prime faces, Rich Faces and ICE faces these are very popular component libraries apart from these liferay also have Alloy Faces for JSF portlet development as UI components.
  • JSF Portlet uses XHTML as view technology so it is one of the good advantages.
  • Liferay Faces is already part of Liferay so defiantly they will improve a lot in future and also have very good support.
  • Liferay IDE has direct support to create JSF portlets and deploy into liferay portal.

Limitations:
  • Still its growing project so we may get few challenges.
  • Liferay Faces Alloy still it’s improving and has limited UI components when we compare with other component libraries such as Prime Faces, Rich Faces and ICE Faces.

Development Options:

Liferay Faces = (Liferay Faces Bridge + Liferay Faces Portal + Liferay Faces Alloy)

Any JSF Component Library = (ICE Faces/ Prime Faces/ Rich Faces/ Liferay Faces Alloy)


  1. Liferay Faces + ICE Faces
  2. Liferay Faces+ Prime Faces
  3. Liferay Faces+ Rich Faces
  4. Liferay Faces+ Liferay Faces Alloy
  5. Liferay Faces + (Any JSF Component Library) + Liferay Service Builder
  6. Liferay Faces + (Any JSF Component Library) + Spring DAO Implementation with Hibernate.

Reference Links



My Suggestion and Opinion Choosing Plugin Portlet for Development
  1. Liferay Portlet MVC Portlet with Liferay Service Builder
  2. Liferay JSF Portlet using Liferay Faces+ Liferay Faces Alloy
  3. Spring Portlet MVC with Spring DAO Implementation with Hibernate
  4. Struts 2.x Portlet with Liferay Service Builder

Note:

It’s my rank and it may be differed from other opinions.
Apart from above we have options like vaadin, php , perl, python and groovy portlet.

Author

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

Recent Posts

Recent Posts Widget

Popular Posts