GateIn Portal Navigational Properties

Version 4

    Description

    For custom rendering, portlet windows sometimes requires access to  part of portal state: current navigation, current node, current page  type, e.t.c. We call such portion of portal state Portal Navigational Properties:  those properties are naturally bound to the user navigation, i.e the  current URL in the browser determine fully those properties, hence the  name.

    This specification introduces Portal Navigational Properties feature in GateIn. In brief, the feature provides:

    1. Canonical way to expose info on portal state     
      1. Configuration of exposed portal navigational properties
      2. Property scope
      3. Qualified identifiers
    2. Access to portal state from portlet window, based on 'Public Render  Parameter' concept of JSR 286, indeed the render parameter of a portlet  is a way to express navigational state of a portlet, and a public  render parameter is a good way to bind a portion of the portlet  navigational state to the portal navigational properties.

     

    Specification

    Public Render Parameter

    Supported Public Render Parameter

    See section 11.1.2 in JSR-286 specification

    PortletRequest

    In each portlet request, the public render parameters are stored in a map accessible through method getPublicParameterMap. Inject the pairs of property identifier/value into the map would make them available to the portlet targeted by request

    GateIn Portlet Container

    As compliant to JSR 286, GateIn Portlet Container supports Public Render Parameter

    Expose Portal Contextual Properties

    A configurable service ContextualPropertyManager is designed to:

    1. Manage the list of exposed properties: identifiers, namespaces,...
    2. Retrieve the value of property

    The service takes as argument an UIPortlet as input and extract from which what the portlet window could see.

     

    public interface ContextualPropertyManager
    {
      public Map<QName, String[]> getProperties(UIPortlet portletWindow); 
    }
    

     

    Plugin Mechanism

    To have portal state exposing supported by GateIn 's extension, implementation of ContextualPropertyManager is based on component plugin mechanism. Each plugin of ContextualPropertyManager service has type AbstractContextualPropertyProviderPlugin

     

    public abstract class AbstractContextualPropertyProviderPlugin extends BaseComponentPlugin
    {
      public abstract void getProperties(UIPortlet portletWindow, Map<QName, String[]> properties);
    }
    

     

    The getProperties method in the implementation of ContextualPropertyManager delegates to registered plugin.

     

    Configuration

    The following XML file depicts the configuration of ContextualPropertyManager service

     

    <component-plugin>
      <name>PublicPropertiesPlugin</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.portal.application.state.PublicPropertiesPlugin</type>
      <init-params>
        <value-param>
          <name>namespaceURI</name>
          <description>Namespace URI</description>
          <value>http://www.gatein.org/xml/ns/prp_1_0</value>
        </value-param>
      </init-params>
    </component-plugin>
    

     

    The plugin configuration provides the namespace URI of the XML QNames that will be bound by this plugin. Note that such plugin can also be configured externally via the external-component-plugins configuration.

    Exposed public render parameters

    At the moment the following public render parameters are bound and available, all the names are bound under the http://www.gatein.org/xml/ns/prp_1_0 namespace:

     

    NameDescriptionExample
    navigation_urithe currenthome
    page_namethe page name (not available when portlet is in a layout)Home Page
    site_typethe site type (portal/group/user values are possible)portal
    site_namethe site nameclassic
    window_show_info_bartrue when the portlet has the info bar displayedtrue
    window_widththe window width (might not be available)800px
    window_heightthe window height (might not be available)100px

     

    Example

    An example is available in GateIn samples codebase.