Friday, September 30, 2011

Extension


The Extension Environment allows for complete customization of Liferay.

  • Internal portlets can be modified. 
  • Liferay's .jsp pages can be changed. 
  • Customizations are kept separate from the Liferay source. 
  • The Liferay source code does not have to be modified.
  • Developers have a clear upgrade path. 
  • The combination of the MIT license and the extension environment means that organization-specific customizations do not need to be contributed back to the Liferay project.

Plugins


The Plugins SDK is a simple environment for the development of Liferay plugins.

  •  Portlet, theme and layout development used to take place in the ext environment. 
  • The ext environment no longer supports portlet and theme development, except for struts portlets and modifying/extending Liferay’s out-of-the-box portlets. 
  • The Plugins SDK is to be used instead to create hot-deployable portlets, themes and layouts.
Portlets can make use of any application framework that Liferay supports 
  • Struts 
  • JSF 
  • Spring 
  • JSP
  • MVC

Portlet Development Extension


Allows management of:
  • Configuration files 
  • Custom source code 
  • Custom JSPs 
  • Modified JSPs 
Provides different sublevels of extensibility


portal(-ext).properties

  • Main configuration options: deployment, themes, hibernate, cache, instance settings, users, groups, language, session, auth, integration, events, ... 

system(-ext).properties
Convenient way to provide and extend the Java System properties used by Liferay

  • The extension points or hooks allow creating custom classes for the most common extensibility needs 
  • Configurable through portal.properties 
  • Examples: Authentication chain, Upgrade and verification processes, Deployment processes, Database access and caching, User fields generation and validation, session events, permissions, model listeners, ext-spring.xml

Portlet Development Plugins


Types: Portlets, Themes, Layout Templates,Hooks

  • Developed as independent software components 
  • Distributed and deployed as WAR files 
  • Can be organized in plugin repositories 
  • Liferay provides the Plugins SDK to help with development of plugins.

Portlet Development Strategy



  • Overview recommended best practices for developing portlets and extending Liferay Portal's functionality. 
  • Understand the compromises involved in each of the methods. 
  • Evaluate how to combine the different methods for the needs of your organization.

Portlet characteristics


Portlets have additional characteristics that make them different from Servlets

  • Portlet Modes 
  • Window States 
  • Portlet Preferences 
Portlet Modes 
  • Each portlet has a current mode, which indicates the function the portlet is performing. 
  • All JSR 168 compliant portals should support the View, Edit and Help modes.
Window States 
  • Window states indicate the amount of portal page space that will be assigned to a portlet. 
  • All spec compliant portals should support the minimized, maximized and normal window states.
Portlet Preferences 
  • Portlets can be configured to provide a custom view or behavior for different users. 
  • For example, a weather portlet can show the temperature in Chicago for one user and the temperature in LA for another user. 
  • These configurations are represented as a persistent set of name-value pairs and are referred to as portlet preferences. 

    Portlet Lifecycle

    • Portlets are different from servlets in that they have a 2 phase commit. 
    • With servlets, the service() method processes all requests. 
    • With portlets, the processAction() method processes the requests and the render() method draws the contents of the portlet on the page.

    init() 
    • Initializes the Portlet 
    processAction() 
    • process input from a user action. 
    render() 
    • Renders the content output. 
    destroy() 
    • Cleans up the portlet 
    serveResource() 
    • Allows a portlet to serve a resource 
    • The serveResource() method can be used to implement AJAX use cases. 
    processEvent() 
    • Perform events triggered by other portlets. (IPC) 

    What is a portlet?



    1. A portlet is a web component that processes requests and generates dynamic content. 
    2. The content generated by a portlet is also called a fragment (e.g. HTML, XHTML, WML) and can be aggregated with other fragments to form a complete document. 

    What are JSR 168 and JSR 286 ?



    1. JSR 168 and JSR 286 are Portlet Specifications  
    2. They were created out of a need to have a specification for displaying multiple applications on the same page. 
    3. The specs define the lifecycle of a portlet as well as its characteristics/look and feel. 
    4. They standardize the way portlets are developed. 

    What is Liferay Portal?

    1. Liferay Portal is the world's leading open source enterprise portal solution using the latest in Java and Web 2.0 technologies.  
    2. Runs on all major application servers & servlet containers, 
    3. databases, and operating systems with over 700 deployment combinations  
    4. JSR 168 and JSR 286 compliant  
    5. Out-of-the-box usability with over 60 portlets pre-bundled  
    6. Built-in Content Management System (CMS)  
    7. Built-in Collaboration suite  
    8. Personalized pages for all users 
    9. Hot-Deployable Theme/Portlet Architecture with Online Software Catalog 
    10. Freeform / WebOS layout 
    11. Just-in-time Portlet rendering 
    12. Fine-grained permissions system