Liferay Portal 5.2 Systems Development

By Jonas X. Yuan
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Introducing Liferay Portal Architecture and Framework

About this book

Liferay portal is one of the most mature portal frameworks in the market, offering many key business benefits that involve personalization, customization, and workflow. If you are a Java developer who wants to build custom web sites and intranet applications using Liferay portal, this is where your search ends.

This book shows how Java developers can use Liferay as a framework to develop custom intranet systems, based on Liferay portal platform thus helping you to maximize your productivity gains. Get ready for a rich, friendly, intuitive and collaborative end-user experience!

The author's experience customizing Liferay using Java enables him to explain in a clear and precise manner how to build custom systems on top of Liferay portal.

Using this book you can customize Liferay into a single point of access to all an organization's data, content, web content, and other information from both existing in-house applications (HR, CRM) and external sources (such as Alfresco, FatWire, Magnolia, Vignette).

Publication date:
May 2009
Publisher
Packt
Pages
552
ISBN
9781847194701

 

Chapter 1. Introducing Liferay Portal Architecture and Framework

This book will show you how to build custom systems on top of the Liferay portal. In this chapter, we will look at:

  • The features of Liferay portal

  • Why Liferay portal is an excellent choice for building custom systems

  • The framework and architecture of Liferay portal

  • The portal development strategies and how they work

So let's begin by looking at exactly what Liferay portal is.

What's Liferay portal?

As the world's leading open source portal platform, Liferay portal provides a unified web interface to the data and tools scattered across many sources. Within Liferay portal, a portal interface is composed of a number of portlets—self-contained interactive elements that are written to a particular standard. As portlets are developed independent from the portal itself and are loosely coupled with the portal, they are, apparently, Service Oriented Architecture(SOA) .

Liferay portal has a wide range of portlets freely available for things such as blogs, calendar, Document Library, Image Gallery, mail, message boards, polls, RSS feeds, Wiki, web content, and so on. Liferay portal also ships with the Content Management System(CMS) and Web Content Management(WCM) solutions. Liferay CMS provides basic Enterprise Content Management Systems(ECMS) features. Liferay portal is the best ECMS for small team collaborations. Event data can be specific to a small group within a company. In any organization, some data will be relevant at a team level and other data that will be relevant across the whole business. Liferay portal supports such things very well.

As the world's leading open source enterprise portal solution, Liferay portal uses the latest Java, J2EE, and Web 2.0 technologies in order to deliver solutions for enterprises across both public and private sectors. Meanwhile, the built-in web content management and a content integration framework allow us to aggregate and publish existing repository content with new content. This helps create web sites and collaborative workspaces, for example, intranets, extranets, team sites, and so on. In addition, the built-in suite of social computing tools allows multiple forums, Wikis, blogs, and Document Libraries to be created and matched to specific user groups or knowledge areas within the same site.

Liferay currently has the following three main functionalities:

  1. 1. Liferay portal—JSR-168/JSR 286 enterprise portal platform.

  2. 2. Liferay CMS and WCM—JSR-170 content management system and web content management.

  3. 3. Liferay collaboration and social software—collaboration software such as blogs, calendar, web mail, message boards, polls, RSS feeds, Wiki, presence (AJAX chat client, dynamic friend list, activity wall, activity tracker), alert and announcement, and so on.

Generally speaking, a web site built by Liferay might consist of CMS and WCM, a portal, and collaboration and social software.

Liferay portal

As the world's leading open source enterprise portal, Liferay portal provides portal solution for both the public and private sectors. The Liferay portal has at least the following features:

  • Runs on all major application servers and Servlet containers, databases, and operating systems, and over 700 deployment combinations.

  • Uses the latest in Java, J2EE, and Web 2.0 technologies.

  • Uses an open SOA framework.

  • JSR-168/JSR-286 compliant.

  • Out of the box usability over 60 portlets.

  • Personalized pages for all users.

  • AJAX-enabled user interface.

  • Multilanguage support—localizing up to 22 languages.

  • Full LDAP synchronization and secure Single Sign On(SSO) support.

  • Granular role-based authorizations.

  • Control Panel—centralized administration for all content, users, organizations, communities, roles, server resources; full customizability with the ability to hide different parts of the form as desired or add custom ones with portlets.

  • Single-click configuration, dynamic drag-and-drop, search and tagging capability, and work from desktop, for example WebDAV.

  • Built-in CMS, WCM, Collaboration, and Social Networking.

Liferay CMS and WCM

Liferay's built-in CMS and WCM supports portal-based web content publishing and document/content management. Liferay CMS and WCM haves at least the following features:

  • Document Library and Image Gallery—one central place to aggregate and manage all content.

  • Dynamic virtual hosting—allows using the same installation of Liferay portal to spin off an infinite number of other portals.

  • Publishing workflow, versioning, structured content, XSL content, breadcrumb, navigation and Velocity templates, and WYSIWYG editing for end users.

  • The Asset Publisher portlet—publishes any piece of content in your portal as though it were a Web Content portal, either through a set of publishing rules or by manual selection.

  • The Web Content portlet (also called Journal, accessible through the Control Panel)—helps create, edit, and publish articles, as well as article templates for one-click changes in layout. It has built-in workflow, article versioning, search, and metadata.

  • The Web Content List (called Journal Articles)—displaying a dynamic list of all journal articles for a given community.

  • The Web Content Display (called Journal Content)—publishes any article from the Journal CMS on a portal page.

  • The Web Content Search portlet—it's powered by the Apache Lucene search engine; search can be restricted to Journal CMS articles.

  • The Nested Portlets portlet—allows the users to drag-and-drop portlets into other portlets, making complex page layouts possible.

  • Custom attributes—adds custom attributes to users and organization forms. It provides a framework to add custom attributes to any ServiceBuilder entity at runtime.

  • Page staging, scheduling, and publishing, either locally or remotely.

  • Integration with SharePoint—implementation of the SharePoint protocol allows to save documents to Liferay as if it were a SharePoint server.

Liferay collaboration and social networking software

Liferay collaboration and social networking software take advantage of the benefits of today's virtualized work environment. The portal ties all of the collaboration functions together with the latest social networking features for a truly dynamic work experience. By using this, you share what you know. It has the following features:

  • Blogs, Wikis, mail, calendar, enterprise Instant Message (IM), RSS, and more.

  • Micro-format support—calendar and user information can be transferred via Web 2.0 standards. Data in micro formats (hCard, hCalendar, and so on) can be easily used by and integrated with third-party applications.

  • Dynamic tagging—tagging web content, documents, message board threads, and more, to dynamically share important or interesting content with other portal users.

  • Activity tracking—keeping tabs on the most recent activity on blogs, message boards, Wiki, and other tools.

  • Announcements and alerts—broadcasting messages to different groups of users.

  • Social networking services.

  • Capability to build My Social Office.

  • Polls—creating multiple choice polls and keeping track of votes.

  • WSRP 2.0 consumer/producer and full 1.0/2.0 specification support.

  • Integration with Terracotta DSO: setting up large and clustering environments.

 

What's Liferay portal?


As the world's leading open source portal platform, Liferay portal provides a unified web interface to the data and tools scattered across many sources. Within Liferay portal, a portal interface is composed of a number of portlets—self-contained interactive elements that are written to a particular standard. As portlets are developed independent from the portal itself and are loosely coupled with the portal, they are, apparently, Service Oriented Architecture(SOA) .

Liferay portal has a wide range of portlets freely available for things such as blogs, calendar, Document Library, Image Gallery, mail, message boards, polls, RSS feeds, Wiki, web content, and so on. Liferay portal also ships with the Content Management System(CMS) and Web Content Management(WCM) solutions. Liferay CMS provides basic Enterprise Content Management Systems(ECMS) features. Liferay portal is the best ECMS for small team collaborations. Event data can be specific to a small group within a company. In any organization, some data will be relevant at a team level and other data that will be relevant across the whole business. Liferay portal supports such things very well.

As the world's leading open source enterprise portal solution, Liferay portal uses the latest Java, J2EE, and Web 2.0 technologies in order to deliver solutions for enterprises across both public and private sectors. Meanwhile, the built-in web content management and a content integration framework allow us to aggregate and publish existing repository content with new content. This helps create web sites and collaborative workspaces, for example, intranets, extranets, team sites, and so on. In addition, the built-in suite of social computing tools allows multiple forums, Wikis, blogs, and Document Libraries to be created and matched to specific user groups or knowledge areas within the same site.

Liferay currently has the following three main functionalities:

  1. 1. Liferay portal—JSR-168/JSR 286 enterprise portal platform.

  2. 2. Liferay CMS and WCM—JSR-170 content management system and web content management.

  3. 3. Liferay collaboration and social software—collaboration software such as blogs, calendar, web mail, message boards, polls, RSS feeds, Wiki, presence (AJAX chat client, dynamic friend list, activity wall, activity tracker), alert and announcement, and so on.

Generally speaking, a web site built by Liferay might consist of CMS and WCM, a portal, and collaboration and social software.

Liferay portal

As the world's leading open source enterprise portal, Liferay portal provides portal solution for both the public and private sectors. The Liferay portal has at least the following features:

  • Runs on all major application servers and Servlet containers, databases, and operating systems, and over 700 deployment combinations.

  • Uses the latest in Java, J2EE, and Web 2.0 technologies.

  • Uses an open SOA framework.

  • JSR-168/JSR-286 compliant.

  • Out of the box usability over 60 portlets.

  • Personalized pages for all users.

  • AJAX-enabled user interface.

  • Multilanguage support—localizing up to 22 languages.

  • Full LDAP synchronization and secure Single Sign On(SSO) support.

  • Granular role-based authorizations.

  • Control Panel—centralized administration for all content, users, organizations, communities, roles, server resources; full customizability with the ability to hide different parts of the form as desired or add custom ones with portlets.

  • Single-click configuration, dynamic drag-and-drop, search and tagging capability, and work from desktop, for example WebDAV.

  • Built-in CMS, WCM, Collaboration, and Social Networking.

Liferay CMS and WCM

Liferay's built-in CMS and WCM supports portal-based web content publishing and document/content management. Liferay CMS and WCM haves at least the following features:

  • Document Library and Image Gallery—one central place to aggregate and manage all content.

  • Dynamic virtual hosting—allows using the same installation of Liferay portal to spin off an infinite number of other portals.

  • Publishing workflow, versioning, structured content, XSL content, breadcrumb, navigation and Velocity templates, and WYSIWYG editing for end users.

  • The Asset Publisher portlet—publishes any piece of content in your portal as though it were a Web Content portal, either through a set of publishing rules or by manual selection.

  • The Web Content portlet (also called Journal, accessible through the Control Panel)—helps create, edit, and publish articles, as well as article templates for one-click changes in layout. It has built-in workflow, article versioning, search, and metadata.

  • The Web Content List (called Journal Articles)—displaying a dynamic list of all journal articles for a given community.

  • The Web Content Display (called Journal Content)—publishes any article from the Journal CMS on a portal page.

  • The Web Content Search portlet—it's powered by the Apache Lucene search engine; search can be restricted to Journal CMS articles.

  • The Nested Portlets portlet—allows the users to drag-and-drop portlets into other portlets, making complex page layouts possible.

  • Custom attributes—adds custom attributes to users and organization forms. It provides a framework to add custom attributes to any ServiceBuilder entity at runtime.

  • Page staging, scheduling, and publishing, either locally or remotely.

  • Integration with SharePoint—implementation of the SharePoint protocol allows to save documents to Liferay as if it were a SharePoint server.

Liferay collaboration and social networking software

Liferay collaboration and social networking software take advantage of the benefits of today's virtualized work environment. The portal ties all of the collaboration functions together with the latest social networking features for a truly dynamic work experience. By using this, you share what you know. It has the following features:

  • Blogs, Wikis, mail, calendar, enterprise Instant Message (IM), RSS, and more.

  • Micro-format support—calendar and user information can be transferred via Web 2.0 standards. Data in micro formats (hCard, hCalendar, and so on) can be easily used by and integrated with third-party applications.

  • Dynamic tagging—tagging web content, documents, message board threads, and more, to dynamically share important or interesting content with other portal users.

  • Activity tracking—keeping tabs on the most recent activity on blogs, message boards, Wiki, and other tools.

  • Announcements and alerts—broadcasting messages to different groups of users.

  • Social networking services.

  • Capability to build My Social Office.

  • Polls—creating multiple choice polls and keeping track of votes.

  • WSRP 2.0 consumer/producer and full 1.0/2.0 specification support.

  • Integration with Terracotta DSO: setting up large and clustering environments.

 

Why Liferay portal?


Generally speaking, portals offer basic benefits that involve personalization, customization, and workflow. Personalization means that different people with the same role work differently. Different roles require different information via customization. People also have direct access to information and applications they need through workflow. Further, customization ensures that people do not miss anything. Liferay portal is one of the most mature portal frameworks in the market. It offers these basic benefits and much more.

Besides the basic benefits mentioned above, Liferay portal provides a number of the key business benefits, some of which are have been discussed in the following sections:

A rich, friendly, intuitive, and collaborative end user experience

A good user experience is regarded as a key to capture the highest return on an enterprise portal investment. Liferay portal maximizes the productivity gains of portal users and provides a rich, friendly, intuitive, and collaborative end-user experience.

  • Intuitive—users can drag-and-drop portlets to customize the experience to the unique preferences of a user or community.

  • Rich—users can use one of the theme plugins from both the out of the box and the community to change the look and feel of the portal without dealing with complex code. There are more than 60 theme plugins available in the community.

  • Friendly—community members can have their pages with a user-defined friendly URL. This gives the users a better sense of ownership over the technology. Thus, it enhances the user experience, and moreover, generates users' loyalty.

  • Collaborative—users can create true communities of users via collaborative tools such as instant messaging, message boards, blogs, Wikis, and so on.

A single point of access to all information

As we know, it will become very annoying to collaborate across business units or among distinct business entities if the end users have to stop and log into the applications every single time. Fortunately, Liferay portal provides users a single point of access to all organization's data, content, web content, and other information from existing in-house applications (that is, HR, CRM) as well as external sources (for example Alfresco, FatWire, Magnolia, and Vignette). That is, in a web site, users can access all organization's data, content, web content, and other information via a single point of access.

By integration with LDAP, information about users and groups are managed in a centralized server. Liferay portal, portlets, and others applications can share the same users' and groups' information directly.

By integration with SSO, users need to log in once to access all their information needs. For example, after the users have logged in once in the Liferay portal, they can automatically log in the portlets such as Alfresco client, Alfresco content, and other systems.

Moreover, the fine-grained permissioning allows the users to customize and control the user access to sensitive information and functionality. Users get an intuitive frontend, whereas behind the scenes, Liferay portal supports Enterprise Service Bus (ESB) such as Service-Mix and Mule technologies. Thus, it simplifies the integration, upgrade, and substitution of disparate applications for the developers.

In addition, Control Panel provides centralized administration for all content, users, organizations, communities, roles, server resources, and more. It has full customizability with the ability to hide different parts of the form as desired, or add custom ones with portlets.

Especially, as a social collaboration solution for the enterprise, My Social Office provides full virtual workspace, streamlines communication, saves time, builds group cohesion, and raises productivity. With My Social Office, all you have to do is log in and work the way you want at your own convenience.

High adaptability to the demands of fast-changing market

Liferay portal provides high adaptability to the demands of a fast-changing market. In general, Liferay portal can grow according to your organizations. For instance, Liferay portal allows clustering—the addition of hardware to meet growing usage demands. Thus, the capacity for content and applications is boundless.

On the one hand, Liferay portal integrates with workflow engine such as jBPM and Intalio. A Workflow engine is an automation of processes. It involves a combination of human- and machine-based activities, and interaction with applications and tools in particular. By this integration, Liferay portal allows organizations of all sizes to be more agile that makes business processes more dynamic, modular, and adaptable to the demands of fast-changing markets.

On the other hand, Liferay portal was benchmarked using LogicLibrary's Logiscan. No matter how your processes change, you can always be confident about the security of your data. For this reason, Liferay portal is benchmarked as one of the most secure portal platforms in the market.

Further, Liferay portal accommodates global business environment with multilingual support. For example, after adding a language portlet to any page, you can quickly select a different localization with one simple click.

Highest values

Liferay portal also provides the highest value at every level. Liferay portal is based on 100% standards and a set of key technologies. The standards include AJAX and JSON, hCalendar Micro-format and iCalendar, JSR-127 and JSR-314 (compliant JSF), JSR-168 and JSR-286 (compliant portlet), JSR-170 (Content Repository API for CMS), JSR-220 (Hibernate), OpenSearch, WebDAV, WSRP, and so on. The technologies involve ICEFaces, jQuery JavaScript Framework, Ruby on Rails, PHP, Spring and AOP, Struts and Tiles, Velocity, FreeMarker, and so on. More importantly, you have the freedom to integrate with your favorite content repository such as Liferay CMS, Alfresco, FatWire, Magnolia, Vignette, and so on. In short, Liferay portal strengthens the compliance to the standards and reduces the risk of investment.

More interestingly, Liferay portal leverages the existing IT environment and works with any application server, database server, or operating system with over 700 deployment configurations. Surely, your existing technology investments are not discarded. Further, the future changes will not require an overhaul of an existing Liferay portal installation.

 

Architecture and framework


The most important aspect of any portal is its underlying architecture. Liferay portal architecture supports high availability for mission-critical applications using clustering, fully distributed cache, and replication support across multiple servers. The following figure depicts various architectural layers and functionality of portlets:

Service oriented architecture: SOA

Liferay portal uses SOA design principles throughout, and provides the tools and framework to extend SOA to other enterprise applications. Under Liferay enterprise architecture, not only can the users access the portal from traditional and wireless devices, but the developers can also access it from the exposed APIs via REST, SOAP, RMI, XML-RPC, XML, JSON, Hessian, Burlap, and custom tunnel classes.

Liferay portal is designed to deploy portlets that adhere to the portlet API compliant with both JSR-168 and JSR-286. A set of useful portlets are bundled with the portal such as Image Gallery, Document Library, Calendar, Message Boards, Blogs, Wikis, and so on. They can be used as examples for adding custom portlets.

In a word, the key features of Liferay include using SOA design principles throughout, reliable security, integrated with SSO and LDAP, multitier and limitless clustering, high availability, caching pages, dynamic virtual hosting, and so on.

Enterprise service bus: ESB

The Enterprise Service Bus(ESB) is a central connection manager that allows applications and services to be added quickly to an enterprise infrastructure. When an application needs to be replaced, it can be easily disconnected from the bus at a single point. Liferay portal uses Mule or ServiceMix as ESB.

Through ESB, the portal could integrate with SharePoint, BPM (such as jBPM workflow engine, Intalio|BPMS engine), BI Xforms reporting, JCR repository, and so on. It supports JSR 170 for content management system with integration of JCR repository, such as Jackrabbit. It also uses Hibernate and JDBC to connect to any databases. Further, it supports events system with asynchronous messaging and lightweight message bus.

Liferay portal uses Spring framework for its business and data services layers. It also uses Spring framework for its transaction management. Based on service interfaces (Spring framework), Portal-Impl is implemented and is exposed only for the internal usage for the Extension environment, for example. Portal-Kernel and Portal-Service are provided for the external usage (and for the internal usage, either) for Plugins SDK environment, for example. Custom portlets, both JSR-168 and JSR-286, and web services could be built based on the Portal-Kernel and Portal-Service.

In addition, the Web 2.0 Mail portlet and the Web 2.0 Chat portlet are supported as well. More interestingly, scheduled staging and remote staging and publishing are served as a foundation through tunnel web for web content management and publishing.

Liferay portal supports web services to make it easy for different applications in enterprise to communicate with each other. Java, .NET, and proprietary applications can work together easily because web services use XML standards. It also supports REST-style JSON web services for lightweight, maintainable code, and supports AJAX-based user interfaces.

Liferay portal uses industry-standard, government-grade encryption technologies, including advanced algorithms such as DES, MD5, and RSA. Liferay was benchmarked as one of the most secure portal platforms using LogicLibrary's Logiscan suite. Liferay offers customizable Single Sign-On with Yale CAS, JAAS, LDAP, NTLM, Netegrity, Microsoft Exchange, and more. Open ID, Yale CAS, Siteminder, and OpenSSO integration are offered out of the box.

In short, Liferay portal uses the ESB in general to provide an abstraction layer on top of an implementation of an enterprise messaging system. It allows integration architects to exploit the value of messaging without writing code.

 

Portal development strategies


Liferay portal is extensible at least at the following three levels:

  • Plugins SDK environment

  • Extension environment

  • Liferay portal source code

In general, each level of extensibility offers a different compromise of flexibility with different migration requirements to the future version.

Extension environment

The Extension environment provides capability to customize Liferay portal completely. As it is an environment which extends Liferay portal development environment, it has a name Extension, or Ext. By the name Ext, we can modify internal portlets or call the out of the box portlets. Moreover, we can override the JSP files of portal and the out of the box portlets. This kind of customization is kept separate from the Liferay portal source code. That is, Liferay portal source code does not have to be modified and a clear upgrade path is available in Ext.

As shown in following figure, Custom Code will override Liferay Portal Source Code in Ext only. In the deployment process, custom code is merged with Liferay Portal Source code in Ext. That is, developers override the Liferay portal source code. Moreover, the custom code and Liferay portal source code will be constructed as Customized Liferay Portal in Ext first, and then the customized Liferay portal will be deployed from Ext to the Application Server.

During customization, we could use ServiceBuilder to generate models and services. In general, ServiceBuilder is a code generator that uses an XML descriptor. For a given XML file service.xml, it will generate SQL for creating tables, Java Beans, Hibernate configuration, spring configuration, Axis Web Service, and JSON JavaScript Interface, and so on.

JSP files of the portal and the out of the box portlets can be overridden with custom versions in Ext. Note that Ext is used for customizing Liferay portal only, as portlets written in Ext are not hot-deployable. Moreover, Ext is a monolithic environment.

Plugins SDK environment

Plugins SDK is a simple environment for the development of Liferay plugins, including themes, layout templates, portlets, hooks, and webs (that is, web applications). It provides the capability to create hot-deployable portlets, themes, layout templates, hooks, and webs.

How does it work? As shown in following figure, Plugins SDK provides environment for developers to first build themes, layout templates, portlets, hooks, or webs. Afterwards, it uses the Ant target Deploy to form WAR file and copy it to the Auto Deploy Directory. Then, Liferay Portal—together with an Application Server—will detect any WAR files in the auto hot-deploy folder, and automatically extract the WAR files into the Application Server deployment folder.

Portlets go in the /portlets folder, themes go in the /themes folder, layout templates go in the /layouttpl folder, web applications go in the /webs folder, and hooks go in the /hooks folder. By the way, Ant targets are used to build and deploy plugins to local application server. It is surely possible to deploy plugins directly to remote application server via custom Ant targets.

Especially, the portlets developed in Plugins SDK may only import classes from the portal API (Portal-Kernel and Portal-Service) and other JAR files contained in the specific portlet /WEB-INF/lib folder. This forces the portlets to rely completely on the Portal API and not to depend on implementation classes defined in Portal-Impl.

As you can see, portlets can make use of any application framework that Liferay supports—Model-View-Controller (MVC) frameworks. Here is a list of a few application frameworks: Struts, Spring, Tapestry, JSF, Wicket, and so on.

In addition, as mentioned above, Liferay portal can also integrate with certain web applications as webs, for instance solr-web—search engine integration plugin; jbpm-web—workflow engine integration plugin; mule-web and servicemix-web—ESB integration plugins.

Development strategies

As mentioned earlier, there are at least two development environments: Ext and Plugins SDK. Thus, you may ask: Which kind of development environment is suitable for our requirements? When should we use Ext and when should we use Plugins SDK, or even Liferay portal source code? Let's take a deep look at the development strategies.

As shown in following figure, Liferay Portal is extensible at least at three levels, for example Plugins SDK Environment (Level I), Extension Environment (Level II), and Liferay Portal Source Code (Level III). As you can see, each level of extensibility offers a different compromise of flexibility with different migration requirements to the future version. Thus, we need to choose the appropriate level for the requirements at hand which allows for easier future maintainability.

In Level I, we can develop portlets, themes, layout templates, hooks, and webs as independent software components. Moreover, these plugins can be distributed and deployed as WAR files, and can be organized in plugin repositories. Liferay portal provides Plugins SDK to help us with the development of these plugins.

In addition, portlets developed in Plugins SDK can only import classes from the portal API (Portal-Kernel and Portal-Service), and not Portal-Impl. That is, portlet development in Plugins SDK does not even touch portal properties, language properties, and JSP files related to Portal-Impl. Fortunately, Hooks provides the capability to hook up portal properties, language properties, and JSP files related to Portal-Impl.

In Level II, we can manage configuration files, custom source code, custom JSP files, and modified JSP files related to the Portal-Impl. That is, Ext provides different sublevels (for example, configuration files, custom source code, custom JSP files, and modified JSP files) of extensibility.

Among the configuration files, portal-ext.properties has the main configuration options: layouts, deployment, themes, Hibernate, cache, instance settings, users, groups, language, session, auth, integration, events, and so on. Meanwhile, the system-ext.properties file is a convenient way to provide and extend the Java System properties used by Liferay portal. We can also create custom classes for the most common extensibility which needs to be configured through the portal.properties file. Examples are authentication chain, upgrade and verification processes, deployment processes, database access and caching, user fields generation and validation, session events, permissions, model listeners, and so on.

For custom source code, we can use Spring-based dependency injection mechanisms configured in the ext-spring.xml file; add the Servlet extended in the web.xml file; add the Struts action extended in the struts-config.xml file; and moreover, create portlets that access Portal-Impl, or events extending its models and services.

For custom JSP files and modified JSP files, we can customize any of the JSP files used by the out of the box portlets and management tools. This is a very flexible extension mechanism.

Without a doubt, it is easier to develop portlets in Ext, where, you can easily access and use all Portal APIs, taglibs, JSP files, and almost everything. This is not the case in Plugins SDK at the time of writing.

In Level III, we can modify the Liferay portal source code. This approach can only be used for sponsored development. That is, we develop specific features for specific projects first and then contribute back to Liferay portal source code.

In brief, if your requirements are related to customize and/or extend the Portal-Impl (for example UI changing, LDAP import algorithms, Document Library lock mechanism, forms for user registration or organization creation, integration, modifying the out of the box portlets, and so on), you should use Ext. Otherwise, it is better to use Plugins SDK. Note that with Hooks you can hook up portal properties, language properties, and JSP files related to the Portal-Impl.

 

Summary


This chapter looked at what Liferay portal is and why we should use it. Then it introduced the Liferay portal architecture and framework. Finally, it discussed portal development strategies in detail. Liferay portal can be extensible at three levels—Plugins SDK environment, Extension environment, and Liferay portal source code. Both Plugins SDK environment and Extension environment will be helpful to build custom system on top of the Liferay portal.

In the next chapter, we're going to work with the JSR-286 portlets using real examples.

About the Author

  • Jonas X. Yuan

    Jonas X. Yuan is a Chief Architect of ForgeLife LLC and an expert on Liferay Portal, e-commerce, and Content Management Systems (CMS). As an open source community contributor, he has published five Liferay books from 2008 to 2012. He is also an expert on Liferay integration with Ad Server OpenX, different search engines, enterprise content including videos, audio, images, documents, and web contents, and other technologies, such as BPM Intalio and Business Intelligence Pentaho, LDAP, and SSO. He holds a Ph.D. in Computer Science from the University of Zurich, where he focused on Integrity Control in federated database systems. He earned his M.S. and B.S. degrees from China, where he conducted research on expert systems for predicting landslides. Previously, he worked as a Project Manager and a Technical Architect in Web GIS (Geographic Information System). He is experienced in Systems Development Lifecycle (SDLC) and has deep, hands-on skills in J2EE technologies. He developed a BPEL (Business Process Execution Language) engine called BPELPower from scratch at the NASA data center. As the chief architect, Dr. Yuan successfully led and launched several large-scale Liferay/Alfresco e-commerce projects for millions of users each month. He has worked on the following books: Liferay Portal Enterprise Intranets, 2008; Liferay Portal 5.2 Systems Development, 2009; Liferay Portal 6 Enterprise Intranets, 2010; Liferay User Interface Development, 2010; Liferay Portal Systems Development, 2012.

    Browse publications by this author