portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r330877 - in /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl: PortletRendererImpl.java RenderingJobImpl.java
Date Fri, 04 Nov 2005 20:11:21 GMT
Author: taylor
Date: Fri Nov  4 12:11:19 2005
New Revision: 330877

URL: http://svn.apache.org/viewcvs?rev=330877&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-362

hooking in portlet stats to aggregation

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java?rev=330877&r1=330876&r2=330877&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
Fri Nov  4 12:11:19 2005
@@ -35,6 +35,7 @@
 import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.statistics.PortalStatistics;
 import org.apache.jetspeed.util.JetspeedObjectID;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.om.common.ObjectID;
@@ -59,14 +60,17 @@
     private WorkerMonitor workMonitor;
     private PortletContainer container;
     private PortletWindowAccessor windowAccessor;
+    private PortalStatistics statistics;
 
     public PortletRendererImpl(PortletContainer container, 
                                PortletWindowAccessor windowAccessor,
-                               WorkerMonitor workMonitor)
+                               WorkerMonitor workMonitor,
+                               PortalStatistics statistics)
     {
         this.container = container;
         this.windowAccessor = windowAccessor;
         this.workMonitor = workMonitor;
+        this.statistics = statistics;
     }
 
     public void start()
@@ -245,7 +249,7 @@
         request.setAttribute(PortalReservedParameters.PATH_ATTRIBUTE, requestContext.getAttribute(PortalReservedParameters.PATH_ATTRIBUTE));
         PortletContent portletContent = dispatcher.getPortletContent(fragment);
         fragment.setPortletContent(portletContent);
-        return new RenderingJobImpl(container, portletContent, fragment, request, response,
requestContext, portletWindow);
+        return new RenderingJobImpl(container, portletContent, fragment, request, response,
requestContext, portletWindow, statistics);
 
     }
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java?rev=330877&r1=330876&r2=330877&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
Fri Nov  4 12:11:19 2005
@@ -27,6 +27,7 @@
 import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.statistics.PortalStatistics;
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.om.window.PortletWindow;
 
@@ -53,11 +54,19 @@
     private RequestContext requestContext = null;
 
     private PortletContent portletContent;
+    private PortalStatistics statistics;
     
-    public RenderingJobImpl(PortletContainer container, PortletContent portletContent, ContentFragment
fragment, HttpServletRequest request, HttpServletResponse response, RequestContext requestContext,
PortletWindow window)
+    public RenderingJobImpl(PortletContainer container, 
+                            PortletContent portletContent, 
+                            ContentFragment fragment, 
+                            HttpServletRequest request, 
+                            HttpServletResponse response, 
+                            RequestContext requestContext, 
+                            PortletWindow window,
+                            PortalStatistics statistics)
     {
         this.container = container;
-        
+        this.statistics = statistics;
         this.fragment = fragment;
         this.request = request;
         this.response = response;
@@ -100,9 +109,9 @@
      */
     public void execute()
     {
-        
+        long start = System.currentTimeMillis();       
         try
-        {           
+        {
             log.debug("Rendering OID "+this.window.getId()+" "+ this.request +" "+this.response);
           
             this.request.setAttribute(PortalReservedParameters.FRAGMENT_ATTRIBUTE, fragment);
             this.request.setAttribute(PortalReservedParameters.PAGE_ATTRIBUTE, requestContext.getPage());
@@ -120,6 +129,11 @@
         finally
         {
             portletContent.complete();
+            if (fragment.getType().equals(ContentFragment.PORTLET))
+            {
+                long end = System.currentTimeMillis();            
+                statistics.logPortletAccess(requestContext, fragment.getName(), PortalStatistics.HTTP_OK,
end - start);
+            }
         }
 
     }



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