Liferay offers several benefits over similar frameworks in the market:
• Ease of use
• Support for a wide variety of applications
• Liberal licensing and open source code
• Internationalization support
• Integration with other tools
• Adherence to industry standards
Ease of Use
Like the Yahoo! portal, portals created using Liferay are easy to use. You can add variousapplications to portal pages by using Liferay’s drag-and-drop feature, and you can move themaround by clicking and dragging. You can remove an existing application from the page with asingle click on the close icon, and you can easily change the page layout by applying a differentpage template. You can also change the look and feel of a page by applying a theme providedby Liferay or third parties. So you can create a portal easily and allow the user to configure it asdesired. You can take advantage of all these features without writing a single line of code.
Support for a Wide Variety of Applications
Liferay provides a wide range of applications or portlets that you can use, including wikis,blogs, chat, and discussion forums, to name a few. In addition to these, you can incorporateapplications made available by user communities. You will be using several of these applicationsas you work through the examples in this book.
Liberal Licensing and Open Source Code
The use of Liferay on your servers is entirely free. The company has a liberal licensing policy:you don’t need a license to use the product, even for commercial purposes.
Plus, Liferay has made the portal’s entire source code available to the developer community.The ability to modify the source has the following implications:
• You can add features to your portals by modifying the code.
• Contributors can improve Liferay itself
• Developers can add features to Liferay by creating plugins.
Liferay is easily extensible. You can add new features to it without making any changes to thesource code. This makes it easy to migrate to newer versions of Liferay upon their release.
Liferay is highly scalable. It can handle a large user base.
Liferay provides excellent support for internationalization. If your portal boasts many usersfrom non-English-speaking countries, you can extend it to use other languages. You do not need to do any coding to accomplish this; you simply use the appropriate resource bundles.You can easily support languages such as German, Spanish, French, Italian, Japanese, andmany more.
Integration with Other Tools
Liferay integrates easily with many third-party tools. For example, Liferay has its own contentmanagement system (CMS), but it also supports the more powerful Alfresco (http://www.alfresco.com). Liferay can also integrate with third-party Lightweight Directory Access Protocol(LDAP) servers. You’ll find this integration useful when your existing data is storedin LDAP. In addition, Liferay supports several popular databases such as Oracle, IBM DB2,Apache Derby, MySQL, Informix, SQL Server, Sybase, and others.
Adherence to Industry Standards
Liferay is based on standard technologies, so it easily integrates with other standards-basedtechnologies. For example, it easily integrates with the following:
• Apache ServiceMix: A popular open source ESB (Enterprise Service Bus
• Mule: A lightweight messaging framework and highly distributable object broke
• Ehcache: A distributed cache for general-purpose cachin
• Hibernate: A relational persistence service for Java and .NET
• jBPM: A platform for executable process languages ranging from business processmanagement (BPM) over workflow to service orchestration
• Intalio/BPP: Open source BPM and SOA (service-oriented architecture) software
• JGroups: A toolkit for reliable multicast communication
• Apache Lucene: A full-featured text search engine library written entirely in Java• PHP: A general-purpose scripting language especially suited for web development; youcan embed it into HTML
• Ruby: A dynamic, open source programming language
• JBoss Seam: An application framework for building next-generation Web 2.0 applicationsby unifying and integrating technologies such as Ajax, JSF (JavaServer Faces),EJB3 (Enterprise JavaBeans), Java portlets, and BPM
• Spring and aspect-oriented programming (AOP): A leading Java/J2EE applicationframework
• Apache Tapestry: An open source framework for creating dynamic, scalable web applicationsin Java
• FreeMarker: A generic tool to generate text output based on templates
In addition to its integration with the preceding technologies, Liferay itself is writtenentirely in Java, a standard programming language. So you can easily modify, extend, andmaintain Liferay.
Page Internal Structure
The internals of a typical portal page are illustrated in Figure 1-14.As Figure 1-14 shows, a portal page runs a portlet container that embeds several portlets.Each portlet has its own decoration and controls. Using these controls, you can customize thecorresponding portlet. For example, you can easily change a portlet’s look and feel by settingits border and background colors, width, text style, window title, margins, and so on. You willexplore several of these features as you read the book and develop your own portals.With the configuration control, you can set permissions on each individual portlet so thatonly designated users are authorized to use it. You can import or export data, and you caneven share the entire portlet by giving its code to other users.You can customize the location of each portlet on the displayed page by applying a templateto change the layout. You can also create your own custom layouts and apply them toyour pages. You can add and remove portlets to and from a web page at any time.Portlets can communicate with other portlets on the same page, irrespective of the technologiesthey’re using. The portlet container is responsible for providing all the features I just described.
Page Creation Process
When you display a portal page in your browser, certain activities take place in the portalserver and container. These are illustrated in Figure 1-15.
Assume that the portal page is to be rendered as six portlets embedded on the page (seeFigure 1-15). Here’s the process that occurs during page generation:1. Each portlet—A, B, C, D, E, and F—generates the contents for the user. The contentsmight be static or generated dynamically, depending on the logic of the portlet application.Note that each portlet is basically a Java application that runs some code whenactivated.2. The container receives the contents generated by several portlets.3. The container hands over the contents to the portal server.4. The portal server creates the portal page, which is essentially a sequence of HTML codethat the browser can use. During page creation, the portal server applies the designatedpage layouts to place each portlet at the appropriate location.5. The server sends the created page to the client device (the browser).6. The browser displays the contents to the user.At this stage, the portal is ready for further interactions with the user. The user looks at thepresented contents and can decide to fetch further information by clicking one of the items onthe displayed page. Let’s examine what actions take place in the portal server and portlet containerwhen a user requests additional data.
Examining the sequence (object interaction) diagram of a typical user action is the best way tounderstand the actions that take place in the portal server, portlet container, and portlets inresponse to a user request.
Suppose the portal page contains three portlets: A, B, and C. The user initiates an actionon the portal page that requires the contents of portlets A, B, and C to be modified. The eventsthat take place during this interaction are illustrated in the sequence diagram presented inFigure 1-16.
Here are the events in the order they take place:
1. The user requests a data update by clicking the portal page.
2. The user request generates an action event on the portal server.
3. The portal server generates an event on the portlet container.
4. The container determines that the user request requires data in portlets A and C to beupdated.
5. The container makes an Action request to portlet A to perform the data update.
6. Portlet A performs the requested action and returns the result, if any, to the container.
7. The container makes an Action request to portlet C
8. Portlet C performs the action and sends the result, if any, to the container.
9. At this stage, the Action phase of the user request is completed. The container has allthe data that it needs to render the page for the user.
10. The rendering phase of the user request starts.
11. The container fires a Render event to all three portlets—either sequentially or inparallel.
12. The container gathers the responses of all three portlets.
13. The container returns the updated page to the server.
14. The server displays the page on the user’s browser.
15. At this stage, the user request is fully processed.
16. The server now awaits another interaction from the user.
You’ve now studied Liferay’s internal architecture.