portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r893799 - in /portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE: app-servers/ components/portal/src/java/org/apache/jetspeed/aggregator/impl/ jetspeed-api/src/java/org/apache/jetspeed/ maven-archetypes/ taglibs/
Date Thu, 24 Dec 2009 18:19:03 GMT
Author: woonsan
Date: Thu Dec 24 18:19:02 2009
New Revision: 893799

URL: http://svn.apache.org/viewvc?rev=893799&view=rev
Log:
JS2-1091: backport of the feature:

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/branches/JETSPEED-2.1.3-POSTRELEASE/app-servers/   (props changed)
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/maven-archetypes/   (props
changed)
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/taglibs/   (props changed)

Propchange: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/app-servers/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 24 18:19:02 2009
@@ -0,0 +1 @@
+target

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java?rev=893799&r1=893798&r2=893799&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
Thu Dec 24 18:19:02 2009
@@ -103,7 +103,16 @@
      * OutOfService Cache
      */
     protected boolean overrideTitles = false;
-    public static final String OUT_OF_SERVICE_MESSAGE = "Portlet is not responding and has
been taken out of service.";
+    
+    /**
+     * The default OutOfService message
+     */
+    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, 
                                PortletWindowAccessor windowAccessor,
@@ -176,7 +185,12 @@
     {
         // this.monitor.shutdown ?
     }
-
+    
+    public void setOutOfServiceMessage(String outOfServiceMessage)
+    {
+        this.outOfServiceMessage = outOfServiceMessage;
+    }
+    
     /**
      * Render the specified Page fragment. Result is returned in the
      * PortletResponse.
@@ -203,7 +217,7 @@
             if (portletTracking.isOutOfService(portletWindow))
             {
                 log.info("Taking portlet out of service: " + portletDefinition.getUniqueName()
+ " for window " + fragment.getId());
-                fragment.overrideRenderedContent(OUT_OF_SERVICE_MESSAGE);
+                fragment.overrideRenderedContent(outOfServiceMessage);
                 return;
             }
             long timeoutMetadata = this.getTimeoutOnJob(portletDefinition);
@@ -321,7 +335,7 @@
             }
             if (portletTracking.isOutOfService(portletWindow))
             {
-                fragment.overrideRenderedContent(OUT_OF_SERVICE_MESSAGE);
+                fragment.overrideRenderedContent(outOfServiceMessage);
                 return null;
             }
             int expirationCache = getExpirationCache(portletDefinition);

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java?rev=893799&r1=893798&r2=893799&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletTrackingManagerImpl.java
Thu Dec 24 18:19:02 2009
@@ -17,15 +17,19 @@
 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.Iterator;
 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.window.PortletWindowAccessor;
+import org.apache.jetspeed.om.common.LocalizedField;
 import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
 import org.apache.pluto.om.window.PortletWindow;
 
@@ -88,6 +92,19 @@
         {
             return true;
         }
+        
+        PortletDefinitionComposite def = 
+            (PortletDefinitionComposite) window.getPortletEntity().getPortletDefinition();
          
+        Collection fields = def.getMetadata().getFields(PortalReservedParameters.PORTLET_EXTENDED_DESCRIPTOR_OUT_OF_SERVICE);
+        
+        if (fields != null && !fields.isEmpty())
+        {
+            if (BooleanUtils.toBoolean(((LocalizedField) fields.iterator().next()).getValue()))
+            {
+                return true;
+            }
+        }
+        
         return false;
     }
     

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java?rev=893799&r1=893798&r2=893799&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
(original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/jetspeed-api/src/java/org/apache/jetspeed/PortalReservedParameters.java
Thu Dec 24 18:19:02 2009
@@ -98,6 +98,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";
+    
+    /**
      *  Until version 2.1, Jetspeed merged portal request parameters with portlet specific
      *  parameters, effectively allowing "shared" parameters.
      *  <p>

Propchange: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/maven-archetypes/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 24 18:19:02 2009
@@ -0,0 +1 @@
+target

Propchange: portals/jetspeed-2/portal/branches/JETSPEED-2.1.3-POSTRELEASE/taglibs/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 24 18:19:02 2009
@@ -0,0 +1 @@
+target



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