portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r893797 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/ jetspeed-api/src/main/java/org/apache/jetspeed/
Date Thu, 24 Dec 2009 18:16:15 GMT
Author: woonsan
Date: Thu Dec 24 18:16:13 2009
New Revision: 893797

URL: http://svn.apache.org/viewvc?rev=893797&view=rev
Log:
JS2-1091: Admin functionality to mark a portlet as out-of-service.
If administrator set a metadata, named "service.out", with value of "true" for a portlet definition,
then the portlet will be displayed as "out-of-service".
The out-of-service message can be customized in the spring assembly configuration, "aggregation.xml",
for the bean of "PortletRendererImpl" by adding the 'outOfServiceMessage' property like the
following example:

        <property name="outOfServiceMessage">
            <value><![CDATA[
            <em>Sorry, this portlet is available now.</em>
            ]]></value>
        </property>

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java?rev=893797&r1=893796&r2=893797&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
Thu Dec 24 18:16:13 2009
@@ -87,9 +87,14 @@
     protected JetspeedCache portletContentCache;
     
     /**
-     * OutOfService Cache
+     * The default OutOfService message
      */
-    public static final String OUT_OF_SERVICE_MESSAGE = "Portlet is not responding and has
been taken out of service.";
+    public static final String DEFAULT_OUT_OF_SERVICE_MESSAGE = "Portlet is not responding
and has been taken out of service.";
+    
+    /**
+     * The OutOfService message
+     */
+    protected String outOfServiceMessage = DEFAULT_OUT_OF_SERVICE_MESSAGE;
     
     public PortletRendererImpl(PortletContainer container, 
                                WorkerMonitor workMonitor,
@@ -130,7 +135,12 @@
     {
         // this.monitor.shutdown ?
     }
-
+    
+    public void setOutOfServiceMessage(String outOfServiceMessage)
+    {
+        this.outOfServiceMessage = outOfServiceMessage;
+    }
+    
     /**
      * Render the specified Page fragment. Result is returned in the
      * PortletResponse.
@@ -220,7 +230,7 @@
             if (portletTracking.isOutOfService(portletWindow))
             {
                 log.info("Taking portlet out of service: " + portletDefinition.getUniqueName()
+ " for window " + portletWindow.getId());
-                fragment.overrideRenderedContent(OUT_OF_SERVICE_MESSAGE);
+                fragment.overrideRenderedContent(outOfServiceMessage);
                 return null;
             }
             int expirationCache = getExpirationCache(portletDefinition);

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java?rev=893797&r1=893796&r2=893797&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java
Thu Dec 24 18:16:13 2009
@@ -17,20 +17,25 @@
 package org.apache.jetspeed.aggregator.impl;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.BooleanUtils;
+import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.aggregator.PortletTrackingManager;
 import org.apache.jetspeed.aggregator.RenderTrackable;
 import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.om.portlet.LocalizedField;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
 
 /**
  * Tracks out of service status for portlets
  *  
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: $
+ * @version $Id$
  */
 public class PortletTrackingManagerImpl implements PortletTrackingManager
 {
@@ -82,6 +87,18 @@
         {
             return true;
         }
+        
+        PortletDefinition def = window.getPortletDefinition();
+        Collection<LocalizedField> fields = def.getMetadata().getFields(PortalReservedParameters.PORTLET_EXTENDED_DESCRIPTOR_OUT_OF_SERVICE);
+        
+        if (fields != null && !fields.isEmpty())
+        {
+            if (BooleanUtils.toBoolean(fields.iterator().next().getValue()))
+            {
+                return true;
+            }
+        }
+        
         return false;
     }
     

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java?rev=893797&r1=893796&r2=893797&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
Thu Dec 24 18:16:13 2009
@@ -107,6 +107,13 @@
     public static final String PORTLET_EXTENDED_DESCRIPTOR_RENDER_TIMEOUT = "timeout";
     
     /**
+     * A portlet can have a specific setting for the state of out-of-service that the portal
will
+     * give up on rendering the portlet.
+     * The value is 'true' or 'false'.
+     */
+    public static final String PORTLET_EXTENDED_DESCRIPTOR_OUT_OF_SERVICE = "service.out";
+    
+    /**
      * A portlet can have a specific setting for the preview image.
      * The portlet preview image url 
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message