JBoss.orgCommunity Documentation

Chapter 8. JBoss Portal Explicit Coordination

8.1. Explicit vs implicit coordination
8.2. Bindings and wirings
8.2.1. Event wiring
8.2.2. Parameter binding
8.2.3. Alias binding
8.3. Coordination configuration
8.3.1. <implicit-mode>
8.4. Coordination Samples

Portlet 2.0 coordination features are mediated by the portal between several portlet windows, therefore the portal at runtime needs to be able to define relationships between windows. Relationship can be established from an implicit model (i.e a set of predicates applied on some state that will answer TRUE/FALSE to the question are the portlet windows foo and bar in a relationship) or from an explicit model (that states that foo and bar have a relationship). The implicit model is very good for defining default configuration as it does not require much configuration but is not able to cover the exceptional case, that's why we need to combine it with an explicit model that will take precedence over the implicit model, it is the well known principle of convention over configuration.

Currently all explicit coordination happens only in the scope of the same page.

Configuration takes place in -object.xml file. The <coordination> tag can be used in both <page> and <portal> tags. When used in <portal> tag only <implicit-mode> tag can be defined for wirings and bindings:


<portal>

   ...

   <coordination>
       <bindings>
           <implicit-mode>TRUE</implicit-mode>
       </bindings>
       <wirings>
           <implicit-mode>FALSE</implicit-mode>
       </wirings>
   </coordination>

</portal>

When used within the <page> tag coordination event wirings and bindings can be defined:</page>


<coordination>
     
    <wirings>
        <implicit-mode>TRUE</implicit-mode>
        <event-wiring>
            <name>eventWiring1</name>
            <sources>
                <window-coordination>
                    <window-name>ShoppingCatalogPortletWindow1</window-name>
                    <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                </window-coordination>
            </sources>
            <destinations>
                <window-coordination>
                    <window-name>ShoppingCartPortletWindow2</window-name>
                    <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                </window-coordination>
                <window-coordination>
                    <window-name>ShoppingCartPortletWindow3</window-name>
                    <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                </window-coordination>
            </destinations>
        </event-wiring>
        <event-wiring>
            <name>eventWiring2</name>
            <sources>
                <window-coordination>
                    <window-name>ShoppingCatalogPortletWindow2</window-name>
                    <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                </window-coordination>
            </sources>
            <destinations>
                <window-coordination>
                    <window-name>ShoppingCartPortletWindow1</window-name>
                    <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                </window-coordination>
                <window-coordination>
                    <window-name>ShoppingCartPortletWindow4</window-name>
                    <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                </window-coordination>
            </destinations>
        </event-wiring>
    </wirings>
    

    <bindings>        
        <implicit-mode>FALSE</implicit-mode>
                  
        <parameter-binding>
            <id>parameterBinding1</id>
            <window-coordination>
                <window-name>SomePortletWindow1</window-name>
                <qname>foo</qname>
            </window-coordination>
            <window-coordination>
                <window-name>SomePortletWindow2</window-name>
                <qname>foo</qname>
            </window-coordination>
            <window-coordination>
                <window-name>SomePortletWindow3</window-name>
                <qname>foo</qname>
            </window-coordination>
        </parameter-binding>

        <parameter-binding>
            <id>parameterBinding2</id>
            <window-coordination>
                <window-name>SomePortletWindow1</window-name>
                <qname>bar1</qname>
            </window-coordination>
            <window-coordination>
                <window-name>SomePortletWindow2</window-name>
                <qname>{urn:jboss:portal:samples:daa1}daa1</qname>
            </window-coordination>
        </parameter-binding>

        <alias-binding>
            <id>aliasBinding1</id>
            <qname>foo</qname>
        </alias-binding>

        <alias-binding>
            <id>aliasBinding2</id>
            <qname>bar1</qname>
            <qname>{urn:jboss:portal:samples:daa2}daa2</qname>
        </alias-binding>
                  
    </bindings>
</coordination>

JBoss Portal comes with several examples in 'Coordination Samples' page. Its good to follow them looking at the configuration file that can be found in portal-coordination-samples.war/WEB-INF/default-object.xml