26,04 €
Liferay employs a specialized theming system, which allows you to change the look and feel of the user interfaces. As a developer, by using the right tools to create and manipulate themes with Liferay Portal, you can get your site to look any way you want it to; but the Liferay theming system can be difficult to get started with. This practical guide provides you with a well organized manual for working with Liferay as a programmer to help you get started.
Liferay User Interface Development is a pioneer in explaining Liferay's powerful theming system by taking you through examples to get you to create your own themes as quickly as possible. It focuses on how portal pages are created and styled and also discusses some simple configuration and customization to change the look and feel of a portal page. Its explicit instructions are accompanied by plenty of source code. With the open source nature of Liferay, you will find a user-friendly environment to design themes with the latest user interface technologies.
Liferay User Interface Development unlocks the potential of using Liferay as a framework to develop a rich user interface.
The book starts off with how you should go about structuring a Liferay Portal web page. It identifies the components of a portal page: theme, layout, and portlets. This hands-on tutorial explains themes, portlets, and Alloy UI, which is the latest output from the Alloy Project of Liferay, in an easy-to-understand way. It covers all aspects of a theme from its inception and rendering through its consumption by an end user, with in-depth discussion.
By the end of this book, you will clearly understand themes, layouts, and the Alloy API. Most importantly you will obtain the skills to write a theme and layout templates, apply them to a portal, and also control the portlet UI through different mechanisms.
This clear, concise, and practical tutorial will ensure that you have developed skills to become a competent Liferay themer. The detailed text is accompanied with source code that allows you to play with the examples, update the code, and add custom features.
A practical guide to customizing the look and feel of Liferay-based portal applications
This is a basic tutorial that teaches you how to use the tools provided by Liferay to create your own applications. It covers a lot of the material that has API references and documentation of the architecture and illustrates its key concepts with examples.
If you have basic knowledge of Java Web applications, know the basic operational functionality of Liferay, and have written a servlet or JSP file, you are ready to get the most out of this book. Whether you are a web portal engineer or an experienced Liferay Portal developer, you can benefit from this book. You are not expected to have prior knowledge of Liferay theming.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 449
Veröffentlichungsjahr: 2010
Copyright © 2010 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2010
Production Reference: 1191110
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-849512-62-6
www.packtpub.com
Cover Image by Asher Wishkerman (<[email protected]>)
Authors
Jonas X. Yuan
Xinsheng Chen
Frank Yu
Reviewer
Milen Dyankov
Acquisition Editor
Eleanor Duffy
Development Editor
Hyacintha D'Souza
Technical Editors
Kavita Iyer
Pooja Pande
Indexers
Hemangini Bari
Monica Ajmera Mehta
Rekha Nair
Editorial Team Leader
Aanchal Kumar
Project Team Leader
Lata Basantani
Project Coordinator
Leena Purkait
Proofreaders
Lesley Harrison
Mario Cecere
Graphics
Nilesh Mohite
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
Dr. Jonas X. Yuan is an expert on Liferay Portal and Content Management Systems (CMS). As an open source community contributor, he had published three Liferay books from 2008 to 2010. He is also an expert on Liferay integration with Ad Server OpenX, different search engines, enterprise contents including videos, audios, 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 has 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 has developed a BPEL (Business Process Execution Language) Engine called BPELPower from scratch in NASA data center. As the chief architect, Dr. Yuan led and successfully launched several large scale Liferay/Alfresco projects which are used by millions of users each month.
He has worked on the following books: Liferay Portal Enterprise Intranets, 2008, ISBN 13: 978-1-847192-72-1; Liferay Portal 5.2 Systems Development, 2009, ISBN 13: 978-1-847194-70-1; and Liferay Portal 6 Enterprise Intranets, 2010, ISBN 13: 978-1-849510-38-7.
I would like to thank all my team members at Liferay, specially Raymond Auge, Brian Chan, Bryan Cheung, Jorge Ferrer, Michael Young, Jerry Niu, Ed Shin, Craig Kaneko, Brian Kim, Bruno Farache, Thiago Moreira, Amos Fong, Scott Lee, David Truong, Alexander Chow, Mika Koivisto, Julio Camarero, Douglas Wong, Ryan Park, Eric Min, John Langkusch, Marco Abamonga, Ryan Park, Eric Min, John Langkusch, Marco Abamonga, Michael Han, Samuel Kong, Nate Cavanaugh, Arcko Duan, Richard Sezov, Joshua Asbury, Shuyang Zhou, and Juan Fernández for providing all the support and valuable information. Much thanks to all the friends in the Liferay community.
I sincerely thank and appreciate Leena Purkait and Hyacintha D'Souza, Project Coordinator and Development Editor respectively, at Packt Publishing, for criticizing and fixing my writing style. Thanks to Priya Mukherji and the entire team at Packt Publishing; it was really joyful to work with them.
Last but not least, I would like to thank my parents and my wife, Linda, for their love, understanding and encouragement. My special thanks to my wonderful and understanding kid Joshua.
Xinsheng Chen is an architect for Liferay portal projects, a computer game developer, and a software testing engineer. He holds an MS degree in Computer Science from California State University, San Bernardino. His focus was on online banking applications. He also has a bachelor's degree from Wuhan University, China. Mr. Chen was a QA engineer at VMware, Inc. He later led a team in developing four educational computer games for the Escambia County School District, Florida. He worked on Geographical Information Systems (GIS). Mr. Chen has rich experience in J2EE technologies. He has extensive experience in content management systems (CMS), including Alfreso. He is an expert in web portal technologies. Mr. Chen has hands-on experience in eight Liferay portal projects.
I would sincerely thank Leena Purkait, the Project Coordinator and Hyacintha D'Souza, the Development Editor at Packt Publishing. Thank you for reviewing my chapters. I appreciate your invaluable advice; it has helped me improve the quality of my writing. Also, I want to thank Priya Mukherji, Eleanor Duffy, and the team at Packt Publishing. It has been a happy experience working together with you!
I would also thank Dr. Jonas X. Yuan and Frank Yu for their friendship and encouragement along the way.
Frank Yu is a senior architect with 10 years of portal experience and co-founder of ForgeLife LLC, a San Francisco-based firm specializing in Liferay and CMS consulting and custom development. He manages multiple onshore and offshore teams to build portal and CMS applications. His team leadership, technical know-how, detail-oriented attitude, and result-driven approaches are highly valued by his clients.
Frank has extensive software engineering experience in Vignette-based and Liferay-based portal design, development, architecture, and project management, particularly in healthcare portal application development. He has hands-on experience of Liferay training, JSR 168, and JSR 286 portlets, portal themes and skins, the customization of portal frameworks, CMS, architecture, performance tuning, the administration of dozens of Amazon Elastic Compute Cloud (EC2) instances, and so on. He also has broad knowledge of system integration with multiple backends and major RDBMS and Java application servers. Previously, he worked on different portal products or applications at CIGNEX, InterComponentWare, Pay By Touch, and McKesson, a Fortune-14 healthcare company. Frank holds an M.S. degree in Computer & Information Sciences. He received his B.S. degree from Nanjing University, China.
I thank my co-authors, each of whom played a valuable role in ensuring that we were able to achieve coverage of a wide range of Liferay user interface feature set. It has been a great pleasure working with them.
I greatly appreciate the help from Milen Dyankov for reviewing my chapters. Thanks to Leena Purkait and Hyacintha D'Souza, the Production Coordinator and Development Editor respectively, at PACKT Publishing, for criticizing and editing my writing. Thanks also to Priya Mukherji and the entire team at PACKT Publishing.
I'm grateful for the many colleagues who have helped me over the years in different areas. Particularly, I would like to thank Alok Mathur, the CTO at Medicity, who hired me and introduced me to the portal technologies at McKesson in 2000.
I also thank my clients, my partners, and my team members across U.S. and China. It is they who make my projects successful and enjoyable. I thank the entire Liferay community, without them neither the project nor this book would be what it is today.
Last but not least, I would like to thank my wife, Yuting, for her continuing love and support, and for understanding that there is no separation between working time and spare time in the Liferay consulting world. My special thanks to my two wonderful daughters Marissa and Selina, who make me a proud father every single day.
Milen Dyankov is a Senior IT Architect at AMG.net specializing in designing corporate portals and e-commerce solutions for major telecommunication and financial companies in Poland and abroad. He is also owner of Commsen International, an IT consulting company providing open source solutions for middle size companies. He holds a master's degree of computer science from "Sv. Sv. Kiril i Metodi'" university in Veliko Turnovo, Bulgaria.
Since 1997, Milen has been monitoring, using and contributing to a number of Java and JEE open source initiatives. He is the author of "JStopwatch", "APropOS" and "JWebThumb" open source projects. Since 2008, Milen is active Liferay community member and in 2009 he released "liferay-maven-sdk" - an open source port of Liferay 5.2 SDK based on Maven2. In 2010 he started a "Commsen Liferay Plug-ins" project providing various open source portlets for Liferay Portal such like "Custom Global Markup" and "Tailgate".
Dr. Jonas X. Yuan
This book is dedicated to my wife Linda, my son Joshua, and my parents, Daxian and Zhengzi.
This book would not have been possible without your love and understanding.
Thank you from the bottom of my heart.
Xinsheng Chen
This book is dedicated to my elder sister Xinli Chen, who has always been supporting me behind the scene.
This book would not have been possible without your encouragement.
Thank you from the bottom of my heart
Frank Yu
This book is dedicated to my father and the memory of my mother.
Liferay employs a specialized theming system, which allows you to change the look and feel of the user interfaces. As a developer, by using the right tools to create and manipulate themes with Liferay Portal, you can get your site to look any way you want it to. However, the Liferay theming system can be difficult to get started with. This practical guide provides you with a well organized manual for working with Liferay.
Liferay User Interface Development is a pioneer in explaining Liferay's powerful theming system by leading you through examples to get you to create your own themes as quickly as possible. It focuses on how portal pages are created and styled and also discusses some simple configuration and customization to change the look and feel of a portal page. Its explicit instructions are accompanied by plenty of source code. With the open source nature of Liferay, you will find a user-friendly environment to design themes with the latest user interface technologies.
Liferay User Interface Development unlocks the potential of using Liferay as a framework to develop a rich user interface.
The book starts off with how you should go about structuring a Liferay Portal web page. It identifies the components of a portal page: theme, layout, and portlets. This hands-on tutorial explains themes, portlets, and Alloy UI, which is the latest output from the Alloy Project of Liferay, in an easy-to-understand way. It covers all aspects of a theme from its inception and rendering through its consumption by an end user, with in-depth discussion.
By the end of this book, you will clearly understand themes, layouts, and the Alloy API. Most importantly you will obtain the skills to write a theme and layout templates, apply them to a portal, and also control the portlet UI through different mechanisms.
This clear, concise, and practical tutorial will ensure that you have developed skills to become a competent Liferay themer. The detailed text is accompanied with source code that allows you to play with the examples, update the code, and add custom features.
A practical guide to customizing the look and feel of Liferay-based portal applications
Chapter 1, Customizing your Liferay Portal, discussed Liferay architecture and framework, different kinds of plugins, and related development strategies.
Chapter 2, Basic Theme Development, addressed basic theme development, page structure, Plugins SDK, Liferay IDE, and so on. It also covered how to update each individual file in the subfolder, including CSS, images, JavaScript, and templates, and how to package, deploy, and test the themes.
Chapter 3, Layout Templates, addressed layout templates in detail. It introduced the basic concepts of Liferay Portal layout template, and how the theme, layout, and portlets work together to generate a portal page, how to create your own layout template, and page rendering code flow, and so on.
Chapter 4, Styling Pages, gave you specific and detailed answers on how to style your pages. It reviewed some Liferay terminologies, how to set up an organization, UI and usability features in Liferay Portal 6, internationalization (i18n) and localization (L10n) at different levels, UI customization of portal page, portlets, how to Add Application pop-up panel, use the Control Panel, and so on.
Chapter 5, Advanced Theme, provided details about what can be done for advanced themes. It covered how to change the value of the theme.parent property for theme creation, and addressed how to add color schemes, how to use Configurable settings in a theme and pre-defined theme settings, how to embed portlets in a theme, and other topics like theme upgrade, creating a FreeMarker-template theme, browser compatibility, Liferay IDE, and other development tools.
Chapter 6, Portlet User Interface, focused on how to customize portlet user interface. Of course, velocity templates will be useful. This chapter addressed multiple portlets support, portlet deployment, portlet and Layout, portlet content and portlet template, portlet chrome customization, Normal view and maximized view of a portlet, AJAX for portlet UI, Portable Document Format (PDF) reports and Excel reports, Vaadin portlets, common tags in portlets, portlet UI customization using hook.
Chapter 7, Velocity Templates, walked through velocity templates with you. This chapter introduced velocity template language, Velocity template, Velocimacro Velocity portlet, Five basic Velocity templates for a theme, Velocity templates and site performance, theme customization through Velocity templates, Velocity template for Web Content portlet, and freeMarker template.
Chapter 8, Alloy User Interface, focused on what's Alloy UI and how to use it. This chapter addressed the story of Alloy UI, What Alloy UI consists of, what Liferay wants to achieve with Alloy UI, Alloy form tags, node and nodelist, Ajax in Alloy UI, Alloy Plugin Widgets, and other Alloy UI features.
Chapter 9, UI Taglib gave specific details about UI tag libraries—what are they and how to use them in customization. Particularly, this chapter addressed important UI taglib, such as asset tag and categories, search container, custom attributes, tab, toggle, calendar, breadcrumb, navigation, panel, social activity, social bookmarks, discussion, ratings, diff, flags, icon, input, and many other useful UI tags.
Chapter 10, User Interface in Production, showed us how to use jQuery UI, Workflow capabilities, custom attributes capabilities in plugins; how to leverage friendly URL routing and mapping; how to use social UI, such as Open Social, Social Activities, and Social Equity; and how to add CAPTCHA or reCAPTCHA, to hook portal core UI and to deploy themes in production.
This book uses Liferay portal version 6.0.5 with following settings:
Although this book has explored in depth the various technologies used in Liferay user interface, it explains all the topics in an easy-to-understand way. This book is for any Java developers.
If you have some basic knowledge in web applications including servlets and portlets, you will understand better the discussions in this book.
Most importantly, if you like problem-solving and have an eye for perfection, this book is written for you.
We have opened our arms to welcome you to the Liferay world.
If you have basic knowledge of Java Web applications, know the basic operational functionality of Liferay, and have written a servlet or JSP file, you are ready to get the most out of this book. Whether you are a web portal engineer or an experienced Liferay Portal developer, you can benefit from this book. You are not expected to have prior knowledge of Liferay theming.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "The layout is a fragment that fits inside a page generated by the velocity file portal_normal.vm of a Liferay theme "
A block of code is set as follows:
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
Any command-line input or output is written as follows:
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Therefore, it is necessary for administrators or other users with ManagePages permission".
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code for this book
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
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 independently from the portal itself and are loosely coupled with the portal, they are apparently ServiceOrientedArchitecture (SOA).
This book will show you how to develop and / or customize user interface of intranets or Internets with Liferay. In this chapter, we will look at:
So let's begin by looking at exactly what Liferay portal and Social Office are, how to customize user interfaces, and how they work.
Liferay currently has the following four main functionalities:
Generally speaking, a website built by Liferay might consist of a portal, CMS and WCM, collaboration, and / or social office.
Image Gallery is a useful tool to manage images. For instance, within Image Gallery, you would be able to add folders and subfolders for images and moreover, manage folders and subfolders. You can also add images in folders and manage those images, and furthermore, set up permissions on folders and images. Document Library is a useful tool to manage any documents. For example, within Document Library, you can add folders and subfolders for documents to manage and publish documents. The Image Gallery and Document Library make up the ContentManagementSystems (CMS) available for intranets or Internet. Both of them are equipped with customizable folders and act as a web-based shared drive for all your team members, no matter where they are. As content is accessible only by those authorized by administrators, each individual file (document or image) is as open or as secure as you would need it to be.
Your company may have a lot of HTML text, audios, videos, images, and documents using different structures and templates, and you may need to manage all these HTML text, images, and documents as well. Therefore, you require the ability to manage a lot of web content, and then publish web content in intranets or Internet.
We will see how to manage web content and how to publish web content within Liferay. Liferay Journal (called Web Content) does not only provide the availability to publish, manage, and maintain web content and documents, but it also separates content from layout. WCM allows us to create, edit, and publish web content (called Journal articles) as well as article templates for one-click changes in layout. It has built-in workflow, article versioning, search, and metadata features.
All users can get a personal space that can be either made public (published as a website with a unique, friendly URL) or kept private. In fact users can have both private and public pages at the same time. You can also customize how the space looks, what tools and applications are included, what goes into the Document Library and Image Gallery, and who can view and access all of this content.
In addition, you can use your own language. Multilingual organizations get out-of-the-box support for up to 36 languages or called locales (such as Hindi, Hebrew, Ukrainian, and so on). Users can toggle among different language settings with just one click and produce/publish multilingual documents and web content. You can also easily add other languages in your public, private pages, or other organizations.
You can use workflow to manage definitions, instances, and tasks. You can also use the Web Content article two-step workflow, StagingWorkflow, jBPMworkflow, Kaleoworkflow, Activiti workflow and Intlio|BPMS. jBPMworkflow and / or Kaleoworkflow and / or Activiti workflow that can be applied on any assets such as Web Content articles, Document Library documents, Image Gallery images, and so on. In addition, Liferay portal allows you to define publishing workflow that tracks changes to web content as well as the pages of the site in which they live.
Liferay portal supports social networking—you can easily own your accounts in Liferay with Facebook, MySpace, Twitter, and so on. In addition, you can easily manage your instant messenger accounts such as AIM, ICQ, Jabber, MSN, Skype, YM, and so on in Liferay portal.
SocialOffice gives us a social collaboration on top of the portal—a full virtual workspace that streamlines communication and builds up group cohesion. All components in Social Office are tied together seamlessly, getting everyone on the same page by sharing the same look and feel. More importantly, the dynamic activity tracking gives us a bird's-eye view of who has been doing what and when within each individual site.
The portal tagging system allows us to tag web content, documents, message board threads, and more, and dynamically publish assets by tags. Tags provide a way of organizing and aggregating content. Folksonomies are a user-driven approach to organizing content through tags, cooperative classification, and communication through shared metadata. The portal implements folksonomies through tags. Taxonomies are a hierarchical structure used in scientific classification schemes. The portal implements taxonomies as vocabularies and categories, including category hierarchy, in order to tag contents and classify them.
In particular, the portal provides integrating framework so that you could integrate external applications easily. For example, you can integrate external applications such as Alfresco, OpenX, LDAP, SSO CAS, Orbeon Forms, KonaKart, PayPal, Solr, Coveo, Salesforce, SugarCRM, JasperForge, Drools, jBPM, and so on with the portal. Integrating standalone Java Web applications into the portal is not an easy task. However, Liferay makes it possible to achieve near-native integration with minimal effort via WAI (Web Application Integrator) portlet or IFrame portlet.
In addition, the portal uses the OSGi framework. That is, the portal is going to support a module system and service platform for the Java programming language that implements a complete and dynamic component model. For more information, refer to http://www.osgi.org.
In a word, the portal offers compelling benefits to today's enterprises—reduced operational costs, improved customer satisfaction, and streamlined business processes.
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 the various architectural layers and functionality of portlets.
Liferay portal uses Service Oriented Architecture (SOA) design principles throughout and provides the tools and framework to extend SOA to other enterprise applications. Under the Liferay enterprise architecture, not only can the users access the portal from traditional and / or 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 nutshell, the key features of Liferay include using SOA design principles throughout, such as reliable security, integrating with SSO and LDAP, multitier and limitless clustering, high availability, caching pages, dynamic virtual hosting, and so on.
The EnterpriseServiceBus (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 could use Mule or ServiceMix as ESB.
Through ESB, the portal could integrate with SharePoint, BPM (such as jBPM workflow engine, Intalio | BPMS engine), rule engine, BI Xforms reporting, JCR repository, and so on. It supports JSR 170 for Content Management Systems with the integration of JCR repositories such as Jackrabbit. It also uses Hibernate and JDBC to connect to any database. Furthermore, it supports events' system with asynchronous messaging and lightweight message bus.
Liferay portal uses the Spring framework for its business and data services layers. It also uses the Spring framework for its transaction management. Based on service interfaces (Spring framework), portal-implementationis implemented and exposed only for the internal usage—for example, they are used for the extension environment or ext plugins. portal-kerneland portal-service(these two are merged into one package, called portal-service) are provided for the external usage (or for the internal usage)—for example, they are used for the Plugins SDK environment. Custom portlets, both JSR-168 and JSR-286, and web services can be built based on portal-kernel and portal-service.
In addition, Web 2.0 Mail portlet and Chat portlet are supported as well. More interestingly, scheduled staging and remote staging, and publishing serve 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 an 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 furthermore, it 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, Facebook, and more. Open ID, OpenAuth, Yale CAS, Facebook, Siteminder, and OpenSSO (renamed as OpenAM) integration are offered by the portal out of the box.
In short, Liferay portal uses the ESB in general, in order 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. As you can see, understanding the framework and architecture would be helpful if you would want to customize the user interface in a proper way.
Liferay portal is built based on "Standards". This is a more technical benefit, however, a very useful one if you ever want to use Liferay in a more specialized way.
Liferay is developed based on standard technologies that are popular with developers and other IT experts. The features of Liferay are listed as follows:
Many of these standards are things that you will never need to know much about, so don't worry if you've never heard of them. Liferay is better for using them, but mostly, you won't even know they are there. Of course, the user interface could be standardized, too. Therefore when developing and / or customizing user interface, you can leverage these standards.
Liferay is, first and foremost, a platform, where you can build your own applications using the tools you feel most comfortable with, such as JSF 2, Icefaces, Struts 2, Spring MVC, Vaadin, jQuery, Dojo, and so on.
Of course, you're not required to write a lot of code for yourself. You can use Service-Builder to generate a lot of code. Generally speaking, the Service-Builder is a tool built by Liferay to automate the creation of interfaces and classes that are used by a given portal or portlets. The Service-Builder is used to build Java services that can be accessed in a variety of ways, including local access from Java code, remote access using web services, and so on.
In general, the Service-Builder is a code generator. Using an XML descriptor, it generates:
Plugins SDK Environment is a simple environment for the development of Liferay plugins, for example, ext, themes, layout templates, portlets, hooks, and webs (web applications). It is completely separate from the Liferay portal core services and uses external services only if required.
The portal supports six different types of plugins out-of-the-box. They are Portlets, Themes, Layout Templates, Webs, Hooks, and Ext.
As you can see, you can generate code for plugins Portlets, Webs, and Ext. Normally you can have one project for one plugin, for example, theme, layout template, hook, ext, and web; you can have many portlets in one plugin project portlet. Hook plugins could be standalone, or stand with portlets or webs. That is, in one plugin project portlet, you can have one hook and many portlets in one WAR file. As you can see, user interface can be customized or developed within these plugins, mostly in the same way, such as portlets, themes, layout templates, hooks, and ext.
LiferayIDE is used to provide best-of-breed eclipse tooling for Liferay Portal development platform for version 6 and greater. The availabilities of Liferay IDE cover, but not limited, plugins SDK support, plug-in projects support, project import and conversion, wizards, code assist like portlet taglibs, customizable templates, XML catalogue (DAT/XSD) contributions.
The Extension environment provides capability to customize Liferay portal completely. As it is an environment which extends Liferay portal development environment, it has the name "Extension", or called "Ext". By the Ext, we could modify internal portlets, or called the out-of-the-box portlets. Moreover, we could override the JSP files of portal and out-of-the-box portlets. This kind of customization is kept separate from the Liferay portal source code. That is, the Liferay portal source code does not have to be modified, and a clear upgrade path is available in the Ext.
From version 6, Ext environment is available as a plugin called Ext plugin. As shown in the following figure, custom code will override Liferay portal source code in the Ext plugin only. In deployment process, custom code is merged with Liferay portal source code. That is, developers override the Liferay portal source code. Moreover, custom code and Liferay portal source code will be constructed as customized Liferay portal first, and then the customized Liferay portal will be deployed an application server.
During customization, we could use the Service Builder to generate models and services. In general, the Service-Builder is a code generator, using 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, JSON JavaScript Interface, and so on.
The JSP files of the portal and the out-of-the-box portlets can be overridden with custom versions in the Ext. Note that the Ext is used for customizing Liferay portal core only, as the WAR files written in the Ext are not hot deployable, moreover, the Ext is a monolithic environment.
Under ${ext.plugin.project}/docroot/WEB-INF, you'll see a lot of folders that start with ext-* as shown in the following screenshot.
Note that if you modify ext-web/docroot/WEB-INF/web.xml, these changes are merged into portal-web/WEB-INF/web.xml. The folder ext-web also contains /WEB-INF/*-ext.xml files that are used to override what is in portal-web.
As you can see, Ext plugin works very similarly to that of Ext environment, but it is much smaller and more light weight.
Hooks are a feature to catch hold of the properties and JSP files into an instance of the portal, as if catching them with a hook. Hook plugins are more powerful plugins that come to complement portlets, themes, layout templates, and web modules. A hook plugin can, but does not have to be combined with a portlet plugin. For instance, the portlet so-portlet is a portlet plugin for Social Office with hooks; a hook plugin can simply provide translation or override JSP page. In general, hooks would be very helpful tool to customize the portal without touching the code part of the portal, as shown in following figure. In addition, you would use hooks to provide patches for the portal systems or social office products.
In general, there are four kinds of hook parameters:
as specified in $PORTAL_ROOT_HOME/dtd/liferay-hook_6_0_0.dtd.
As shown in the preceding code, the ordering of elements is significant in the DTD (Document Type Definition)—you need to have your own portal-properties (only one marked by ?), language-properties (could be many marked by *), custom-jsp-dir (only one marked by ?), and service (could be many marked by *) declared in the same order.
Language properties hooks allow us to install new translations or override few words in existing translations. JSP hooks provide a way to easily modify JSP files without having to alter the core of the portal, whereas portal properties hooks allow runtime re-configuration of the portal. Portal service hooks provide a way to easily override portal services. The portal configuration properties can be altered by specifying an overriding file, where the properties will immediately take effect when deployed. For example, you can enable auditing capabilities using hooks. Note that not all properties can be overridden by hooks.
As you can see, the Plugins SDK is a simple environment for the development of Liferay plugins, including portlets, and webs (that is, web applications). It provides capability to create hot-deployable portlets and webs.
How does it work? As shown in following figure, the Plugins SDK provides environment for developers to build portlets and webs. Later, it uses the Ant target Deploy or Maven to form WAR file and copy it to the Auto Deploy directory. Then, Liferay portal together with the application server will detect any WAR files in the auto hot-deploy folder, and automatically extracts the WAR files into the application server deployment folder. Note that the portal is able to recognize the type of the plugin and enhance it appropriately before hot deploying it. For example, for portlets it will modify web.xml adding required listeners and filters.
A theme specifies styles of all major global portlets and content, so it controls the way the portal will look. In general, a theme uses CSS, images, JavaScript, and Velocity (or FreeMarker) templates to control the whole look and feel of the pages generated by the portal. Therefore, when creating customized themes, we need to consider these four groups as well. The theme is made up of a folder _diffs with four subfolders css, images, javascript, and templates; and a folder WEB-INF with the properties file liferay-plugin-package.properties and, optionally, XML file liferay-look-and-feel.xml.
Then, you will see four folders such as css, images, javascript, and templates under the folder
