Version 12

    JBoss Portal Explicit Coordination

     

    Explicit vs implicit coordination

     

    Portlet 2 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

     

    Bindings and wirings

     

    Event wiring

     

    Wires JSR286 events. With implicit wirings the event producer and the consumer declares the same event namespace and local name to get event delivered in the scope of the same page. With explicit wiring any pairs of Window:Event can be connected.

     

    Parameter binding

     

    Binds JSR286 shared parameters. With implicit binding parameters with the same public name are shared. With explicit binding any public parameters can share values. Windows for which such binding applies are explicitly defined.

     

    Alias binding

     

    Explicit alias binding define a name of page scoped parameter that will apply value to specified portlet windows public parameters.

     

    http://localhost:8080/portal/portal/default/Coordination+Samples?aliasBinding1=someValue
    

     

    Coordination configuration

     

    Configuration takes place in -object.xml file. The 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 tag coordination event wirings and bindings can be defined:

     

    <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>
    
    

     

    <implicit-mode>

     

    This tag can be applied for both is defined in portal object tree default value is TRUE.

     

    Coordination API

     

    The API described below is internal and can change without notice

     

    Coordination management can be performed using two interfaces:

     

    • org.jboss.portal.core.controller.coordination.CoordinationManager

    • org.jboss.portal.core.controller.coordination.CoordinationConfigurator

     

    Service implementing both of them is exposed as an mbean under name "portal:service=CoordinationService".

     

    Check out javadoc to learn more.

     

    Worth notice...

     

    There are two different methods designed to check implicit mode defined for wirings and bindings at page or portal level:

    • CoordinationConfigurator.isEventWiringImplicitModeEnabled(PageContainer pageContainer) and CoordinationConfigurator.isParameterBindingImplicitModeEnabled(PageContainer pageContainer) will check the real value for the given portal object. This means that if no implicit mode was defined for a given page those methods will return null.

    • CoordinationManager.resolveEventWiringImplicitModeEnabled(PageContainer page) and CoordinationManager.resolveParameterBindingImplicitModeEnabled(PageContainer pageContainer) will check the inherited value for the given portal object. Those methods will always return a value, either inherited one, defined for a given page or default hardcoded in the implementation (which is "TRUE").

     

     

    Coordination Samples

     

    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

     

    Administration GUI

     

    Expected soon...