Synchronized content through dynamic context

Dynamic context provides a content synchronization mechanism based on portlets. Content synchronization is needed when the content rendered in a given portlet is a direct function of the latest content of another portlet in the current active portal page.

The necessity for the dynamic context infrastructure is determined by the requirement to have the portlets on the same portal page display the content that is binded by a common dynamic context.

The following example illustrates dynamic context for the B2B direct portal application:

The dynamic context is based on the idea of the dynamic context portlet group. Given all portlets within a given portlet application, the dynamic context portlet group defines the subset of portlets within a given portlet application that share the same dynamic context. A given portlet application may have zero or more dynamic context portlet groups.

Each dynamic context group has the following elements:

  1. Dynamic Context: Dynamic context defines the context that all portlets within the same dynamic context group share. Each dynamic context group should only have one dynamic context. In the event that more than one dynamic context is required, another new dynamic context group can be created.
  2. Dynamic Context Master Portlet: Each dynamic context group has only one portlet that functions as the dynamic context master portlet. The dynamic context master portlet watches for the change in the defined dynamic context and as a result, drives the defined behavior (action) of each dynamic context slave portlet.
  3. Dynamic Context Slave Portlets: Each dynamic context portlet group must of at least one dynamic context slave portlet. Each dynamic context slave portlet must define the slave portlet action, which is the pre-defined action of the slave in relation to the dynamic context. The slave portlet action performs the registered action upon notification of the change in dynamic context.

The dynamic context group definition requirement is captured in an XML schema called the Dynamic Context Portlet Group Definition Template, that provides the formal definition of the dynamic context portlet group:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 

<xsd:annotation>
<xsd:documentation xml:lang="en">
   Schema for Websphere Commerce Enabled Portal Dynamic Context Group Definition
   Copyright 2002 IBM Corporation
 </xsd:documentation>
   </xsd:annotation>

<xsd:element name="DynamicContextGroups" type="DynamicContextGroupsType"/>
 <xsd:complexType name="DynamicContextGroupsType">
    <xsd:sequence>
    <xsd:element name="DynamicContextGroup" type="DynamicContextGroupDefinition
         Template" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>

    <xsd:complexType name="DynamicContextGroupDefinitionTemplate">
     <xsd:sequence>
 <xsd:element name="DynamicContextGroupName" type="xsd:string"/>
 <xsd:element name="DynamicContextMasterPortlet" type="xsd:string"/>
 <xsd:element name="DynamicContext" type="xsd:string" maxOccurs="1"/>
 <xsd:element name="DynamicContextSlavePortlet" type="SlavePortletType" 
        minOccurs="1" maxOccurs="unbounded"/>
     </xsd:sequence>
</xsd:complexType>

   <xsd:complexType name="SlavePortletType">
     <xsd:sequence>
 <xsd:element name="DynamicContextSlavePortletName" type="xsd:string"/>
 <xsd:element name="SlavePortletAction" type="xsd:string"/>
 <xsd:element name="SlavePortletRefreshPriority" type="xsd:decimal" 
        minOccurs="0"/>
 <xsd:element name="SlaveParamMapToContext" type="xsd:string" 
        minOccurs="0"/>
      </xsd:sequence>
   </xsd:complexType>

</xsd:schema>

The schema file is provided with the Dynamic Context Portlet Group Assembly Tool Plug-in.

To familiarize yourself with creating a dynamic context relationship, complete the following tutorial:

Feedback