[portal-commits] JBoss Portal SVN: r11777 - in branches/JBoss_Portal_Branch_2_7: core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/coordination and 3 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Mon Sep 1 06:47:26 EDT 2008


Author: thomas.heute at jboss.com
Date: 2008-09-01 06:47:26 -0400 (Mon, 01 Sep 2008)
New Revision: 11777

Added:
   branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/coordination/
   branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/coordination/index.html
   branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/
   branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/MapPortlet.java
   branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/WeatherPortlet.java
Modified:
   branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/PageParameterPortlet.java
   branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml
   branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet-instances.xml
   branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet.xml
Log:
Added some explanations on coordination samples

Added: branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/coordination/index.html
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/coordination/index.html	                        (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/bin/portal-cms-sar/portal/cms/conf/default-content/default/coordination/index.html	2008-09-01 10:47:26 UTC (rev 11777)
@@ -0,0 +1,40 @@
+<div class="portlet-font">
+The coordination samples show how events can be wired and how public parameters can be bound.<br>
+To understand the samples of any of a subpage you will need to have a look at the corresponding
+portlet.xml and the default-object.xml for this sample application.<br>
+On this page you can see one usage of shared parameters aliasing. Say you bought a portlet that displays the weather forecast
+for a location, and found on the web another portlet that displays the map for a zipcode.<br>
+Here we supposed that the two portlets are installed on the server without any change to their code or descriptors.
+The first portlet could define a public render parameter like:
+<pre>
+   &lt;public-render-parameter&gt;
+      &lt;identifier>your_zipcode&lt;/identifier&gt;
+      &lt;name>zipcode&lt;/name&gt;
+   &lt;/public-render-parameter&gt;
+</pre>
+The second portlet could have defined it like that:
+<pre>
+   &lt;public-render-parameter&gt;
+      &lt;identifier&gt;my_zipcode&lt;/identifier&gt;
+      &lt;qname xmlns:coor="urn:jboss:portal:samples:coor"&gt;coor:zipcode&lt;/qname&gt;
+   &lt;/public-render-parameter&gt;
+</pre>
+
+We would like to alias those render parameters to a page parameter, so that without any change to the code we can pass a URL parameter by adding "?zip=20878" to define the
+zipcode to use for both portlets.<br>
+
+To do so we can either use the admin portlet or in our default-object.xml descriptor add the following:
+<pre>
+   &lt;coordination&gt;
+      &lt;bindings&gt;
+         &lt;alias-binding&gt;
+            &lt;id&gt;zip&lt;/id&gt;
+            &lt;qname&gt;zipcode&lt;/qname&gt;
+            &lt;qname&gt;{urn:jboss:portal:samples:coor}zipcode&lt;/qname&gt;
+         &lt;/alias-binding&gt;
+      &lt;/bindings&gt;
+   &lt;/coordination&gt;
+</pre>
+
+Now try to add "?zip=20878" to your URL  to see it in action. Alternatively, you can also fill-in the form on the other portlet to define the page parameter.
+</div>
\ No newline at end of file

Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/PageParameterPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/PageParameterPortlet.java	2008-09-01 10:11:05 UTC (rev 11776)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/PageParameterPortlet.java	2008-09-01 10:47:26 UTC (rev 11777)
@@ -73,6 +73,11 @@
       }
 
       //
+      writer.println("<div class=\"portlet-font\">Page parameters can be bound to coordination aliases. Out of the box, the request parameters" +
+      		" are themselves bound to page parameters. Setting a value below, will modify the URL by adding a request parameter.<br/>" +
+      		"This can be particulary intersting to use URL request parameters to set values usable by a portlet.</div>");
+      
+      //
       writer.println("<form action=\"" + resp.createActionURL() + "\" method=\"POST\"><table>");
       writer.println("<tr><td>Page parameter name:</td><td><input type=\"text\" name=\"name\" width=\"36\" value=\"\"/></td></tr>");
       writer.println("<tr><td>Page parameter value:</td><td><input type=\"text\" name=\"value\" width=\"36\" value=\"\"/></td></tr>");

Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/MapPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/MapPortlet.java	                        (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/MapPortlet.java	2008-09-01 10:47:26 UTC (rev 11777)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.core.samples.basic.coordination;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class MapPortlet extends GenericPortlet
+{
+   public void doView(RenderRequest request, RenderResponse response) throws IOException
+   {
+      PrintWriter writer = response.getWriter();
+      writer.write("Map for (your_zipcode):" + request.getParameter("your_zipcode"));
+      writer.close();
+   }
+}
+

Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/WeatherPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/WeatherPortlet.java	                        (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/coordination/WeatherPortlet.java	2008-09-01 10:47:26 UTC (rev 11777)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.core.samples.basic.coordination;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class WeatherPortlet extends GenericPortlet
+{
+
+   public void doView(RenderRequest request, RenderResponse response) throws IOException
+   {
+      PrintWriter writer = response.getWriter();
+      writer.write("Weather for (my_zipcode):" + request.getParameter("my_zipcode"));
+      writer.close();
+   }
+}
+

Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml	2008-09-01 10:11:05 UTC (rev 11776)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/default-object.xml	2008-09-01 10:47:26 UTC (rev 11777)
@@ -32,9 +32,65 @@
       <if-exists>overwrite</if-exists>
       <page>
          <page-name>Coordination Samples</page-name>
+         <implicit-mode>FALSE</implicit-mode>
 
+         <window>
+            <window-name>CMSWindow</window-name>
+            <content>
+               <content-type>cms</content-type>
+               <content-uri>/default/coordination/index.html</content-uri>
+            </content>
+            <region>center</region>
+            <height>0</height>
+            <properties>
+               <property>
+                  <name>theme.decorationRendererId</name>
+                  <value>divRenderer</value>
+               </property>
+               <property>
+                  <name>theme.portletRendererId</name>
+                  <value>divRenderer</value>
+               </property>
+               <property>
+                  <name>theme.windowRendererId</name>
+                  <value>divRenderer</value>
+               </property>
+            </properties>
+         </window>
+
+         <window>
+            <window-name>CoordinationWeatherWindow</window-name>
+            <instance-ref>CoordinationWeatherPortletInstance</instance-ref>
+            <region>center</region>
+            <height>1</height>
+         </window>
+
+         <window>
+            <window-name>CoordinationMapWindow</window-name>
+            <instance-ref>CoordinationMapPortletInstance</instance-ref>
+            <region>center</region>
+            <height>2</height>
+         </window>
+
+         <window>
+            <window-name>PageParameterPortletWindow</window-name>
+            <instance-ref>PageParameterPortletInstance</instance-ref>
+            <region>center</region>
+            <height>3</height>
+         </window>
+
+         <coordination>
+            <bindings>
+               <alias-binding>
+                  <id>zip</id>
+                  <qname>zipcode</qname>
+                  <qname>{urn:jboss:portal:samples:coor}zipcode</qname>
+               </alias-binding>
+            </bindings>
+         </coordination>
+
          <page>
-            <page-name>Events EXPLICIT</page-name>
+            <page-name>Events - Explicit</page-name>
 
             <window>
                <window-name>ShoppingCatalogPortletWindow1</window-name>
@@ -90,7 +146,7 @@
                      </sources>
                      <destinations>
                         <window-coordination>
-                           <window-name>ShoppingCartPortletWindow2</window-name>
+                           <window-name>ShoppingCartPortletWindow1</window-name>
                            <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                         </window-coordination>
                         <window-coordination>
@@ -109,7 +165,7 @@
                      </sources>
                      <destinations>
                         <window-coordination>
-                           <window-name>ShoppingCartPortletWindow1</window-name>
+                           <window-name>ShoppingCartPortletWindow2</window-name>
                            <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                         </window-coordination>
                         <window-coordination>
@@ -123,7 +179,7 @@
 
          </page>
          <page>
-            <page-name>Events FALLBACK</page-name>
+            <page-name>Events - Fallback</page-name>
 
             <window>
                <window-name>ShoppingCatalogPortletWindow1</window-name>
@@ -179,7 +235,7 @@
                      </sources>
                      <destinations>
                         <window-coordination>
-                           <window-name>ShoppingCartPortletWindow2</window-name>
+                           <window-name>ShoppingCartPortletWindow1</window-name>
                            <qname>{urn:jboss:portal:samples:event}CartEvent</qname>
                         </window-coordination>
                         <window-coordination>
@@ -193,7 +249,7 @@
 
          </page>
          <page>
-            <page-name>Events IMPLICIT</page-name>
+            <page-name>Events - Implicit</page-name>
 
             <window>
                <window-name>ShoppingCatalogPortletWindow1</window-name>
@@ -253,7 +309,7 @@
                | - absense of implicit coordination
               -->
 
-            <page-name>Window+!implicit coordination</page-name>
+            <page-name>Parameters - Explicit</page-name>
             <window>
                <window-name>PublicParametersPortletWindow1</window-name>
                <instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
@@ -340,7 +396,7 @@
                | - absense of implicit coordination
               -->
 
-            <page-name>Alias+!implicit coordination</page-name>
+            <page-name>Parameters - Alias</page-name>
             <window>
                <window-name>PublicParametersPortletWindow1</window-name>
                <instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
@@ -405,7 +461,7 @@
                | - absense of implicit coordination
               -->
 
-            <page-name>Window+alias+!implicit coordination</page-name>
+            <page-name>Parameters - Explicit+Alias</page-name>
             <window>
                <window-name>PublicParametersPortletWindow1</window-name>
                <instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>
@@ -471,7 +527,7 @@
                | - no other kind of coordination occurs
               -->
 
-            <page-name>Implicit coordination</page-name>
+            <page-name>Parameters - Implicit</page-name>
             <window>
                <window-name>PublicParametersPortletWindow1</window-name>
                <instance-ref>CoordinationPublicParametersPortletInstance1</instance-ref>

Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet-instances.xml	2008-09-01 10:11:05 UTC (rev 11776)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet-instances.xml	2008-09-01 10:47:26 UTC (rev 11777)
@@ -59,4 +59,18 @@
          <portlet-ref>PageParameterPortlet</portlet-ref>
       </instance>
    </deployment>
+   <deployment>
+      <instance>
+         <display-name xml:lang="en">Coordination Weather Portlet</display-name>
+         <instance-id>CoordinationWeatherPortletInstance</instance-id>
+         <portlet-ref>CoordinationWeatherPortlet</portlet-ref>
+      </instance>
+   </deployment>
+   <deployment>
+      <instance>
+         <display-name xml:lang="en">Coordination Map Portlet</display-name>
+         <instance-id>CoordinationMapPortletInstance</instance-id>
+         <portlet-ref>CoordinationMapPortlet</portlet-ref>
+      </instance>
+   </deployment>
 </deployments>
\ No newline at end of file

Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet.xml	2008-09-01 10:11:05 UTC (rev 11776)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-coordination-samples-war/WEB-INF/portlet.xml	2008-09-01 10:47:26 UTC (rev 11777)
@@ -113,6 +113,38 @@
       </portlet-info>
    </portlet>
 
+   <portlet>
+      <description>Coordination Weather Portlet</description>
+      <portlet-name>CoordinationWeatherPortlet</portlet-name>
+      <display-name>Coordination Weather Portlet</display-name>
+      <portlet-class>org.jboss.portal.core.samples.basic.coordination.WeatherPortlet</portlet-class>
+      <supports>
+         <mime-type>text/html</mime-type>
+         <portlet-mode>VIEW</portlet-mode>
+      </supports>
+      <portlet-info>
+         <title>Coordination Weather Portlet</title>
+         <keywords>coordination</keywords>
+      </portlet-info>
+      <supported-public-render-parameter>my_zipcode</supported-public-render-parameter>
+   </portlet>
+
+   <portlet>
+      <description>Coordination Map Portlet</description>
+      <portlet-name>CoordinationMapPortlet</portlet-name>
+      <display-name>Coordination Map Portlet</display-name>
+      <portlet-class>org.jboss.portal.core.samples.basic.coordination.MapPortlet</portlet-class>
+      <supports>
+         <mime-type>text/html</mime-type>
+         <portlet-mode>VIEW</portlet-mode>
+      </supports>
+      <portlet-info>
+         <title>Coordination Map Portlet</title>
+         <keywords>coordination</keywords>
+      </portlet-info>
+      <supported-public-render-parameter>your_zipcode</supported-public-render-parameter>
+   </portlet>
+
    <filter>
          <filter-name>JBoss Portlet Filter</filter-name>
          <filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
@@ -133,43 +165,53 @@
    <!-- Public render parameter definitions -->
 
    <public-render-parameter>
+      <identifier>foo1</identifier>
       <name>foo</name>
-      <identifier>foo1</identifier>
    </public-render-parameter>
 
    <public-render-parameter>
+      <identifier>bar1</identifier>
       <name>bar1</name>
-      <identifier>bar1</identifier>
    </public-render-parameter>
    
    <public-render-parameter>
+      <identifier>juu1</identifier>
       <qname xmlns:juu="urn:jboss:portal:samples:juu">juu:juu</qname>
-      <identifier>juu1</identifier>
    </public-render-parameter>
 
    <public-render-parameter>
+      <identifier>daa1</identifier>
       <qname xmlns:daa1="urn:jboss:portal:samples:daa1">daa1:daa1</qname>
-      <identifier>daa1</identifier>
    </public-render-parameter>
 
    <public-render-parameter>
+      <identifier>foo2</identifier>
       <name>foo</name>
-      <identifier>foo2</identifier>
    </public-render-parameter>
 
    <public-render-parameter>
+      <identifier>bar2</identifier>
       <name>bar2</name>
-      <identifier>bar2</identifier>
    </public-render-parameter>
 
    <public-render-parameter>
+      <identifier>juu2</identifier>
       <qname xmlns:juu="urn:jboss:portal:samples:juu">juu:juu</qname>
-      <identifier>juu2</identifier>
    </public-render-parameter>
 
    <public-render-parameter>
+      <identifier>daa2</identifier>
       <qname xmlns:daa2="urn:jboss:portal:samples:daa2">daa2:daa2</qname>
-      <identifier>daa2</identifier>
    </public-render-parameter>
 
+   <public-render-parameter>
+      <identifier>your_zipcode</identifier>
+      <name>zipcode</name>
+   </public-render-parameter>
+
+   <public-render-parameter>
+      <identifier>my_zipcode</identifier>
+      <qname xmlns:coor="urn:jboss:portal:samples:coor">coor:zipcode</qname>
+   </public-render-parameter>
+
 </portlet-app>




More information about the portal-commits mailing list