portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r330879 - /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java
Date Fri, 04 Nov 2005 20:11:50 GMT
Author: taylor
Date: Fri Nov  4 12:11:48 2005
New Revision: 330879

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

hooking in page stats to aggregation

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java?rev=330879&r1=330878&r2=330879&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/engine/JetspeedEngine.java
Fri Nov  4 12:11:48 2005
@@ -34,6 +34,7 @@
 import org.apache.jetspeed.pipeline.Pipeline;
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.request.RequestContextComponent;
+import org.apache.jetspeed.statistics.PortalStatistics;
 import org.apache.jetspeed.util.IsolatedLog4JLogger;
 import org.apache.log4j.Hierarchy;
 import org.apache.log4j.Level;
@@ -67,7 +68,8 @@
     private final ComponentManager componentManager;
     private final Configuration configuration;
     private final String applicationRoot;
-    private Map pipelineMapper ; 
+    private Map pipelineMapper ;
+    private PortalStatistics statistics;
     
     protected static final Log log = LogFactory.getLog(JetspeedEngine.class);
     private static final Log console = LogFactory.getLog(CONSOLE_LOGGER);        
@@ -107,7 +109,7 @@
      *                   when the engine fails to initilialize
      */
     public void start() throws JetspeedException
-    {
+    {        
         DateFormat format = DateFormat.getInstance();
         Date startTime = new Date();        
         try
@@ -136,6 +138,7 @@
             //Start the ComponentManager
             componentManager.start();               
             pipelineMapper = (Map)componentManager.getComponent("pipeline-map");
+            statistics = (PortalStatistics)componentManager.getComponent("PortalStatistics");
             
         }
         catch (Throwable e)
@@ -189,42 +192,45 @@
 
     public void service( RequestContext context ) throws JetspeedException
     {        
-            String targetPipeline = context
-                    .getRequestParameter(PortalReservedParameters.PIPELINE);
+        long start = System.currentTimeMillis();
+        String targetPipeline = context
+                .getRequestParameter(PortalReservedParameters.PIPELINE);
+        if (null == targetPipeline)
+        {
+            targetPipeline = (String)context.getAttribute(PortalReservedParameters.PIPELINE);
               
             if (null == targetPipeline)
             {
-                targetPipeline = (String)context.getAttribute(PortalReservedParameters.PIPELINE);
               
-                if (null == targetPipeline)
+                String pipelineKey = context.getRequest().getServletPath();             
      
+                if (null != pipelineKey)
                 {
-                    String pipelineKey = context.getRequest().getServletPath();         
          
-                    if (null != pipelineKey)
-                    {
-                        if (pipelineKey.equals("/portal"))
-                            targetPipeline = this.defaultPipelineName;
-                        else
-                            targetPipeline = (String)pipelineMapper.get(targetPipeline);

-                        // System.out.println("pipeline = " + targetPipeline);
-                    }
-                    else
-                    {
+                    if (pipelineKey.equals("/portal"))
                         targetPipeline = this.defaultPipelineName;
-                    }
+                    else
+                        targetPipeline = (String)pipelineMapper.get(targetPipeline); 
+                    // System.out.println("pipeline = " + targetPipeline);
                 }
-            }
-            Pipeline pipeline = null;
-            if (targetPipeline != null)
-            {
-                Pipeline specificPipeline = getPipeline(targetPipeline);
-                if (specificPipeline != null)
+                else
                 {
-                    pipeline = specificPipeline;
+                    targetPipeline = this.defaultPipelineName;
                 }
             }
-            else
-                pipeline = getPipeline();
-            
-            pipeline.invoke(context);
+        }
+        Pipeline pipeline = null;
+        if (targetPipeline != null)
+        {
+            Pipeline specificPipeline = getPipeline(targetPipeline);
+            if (specificPipeline != null)
+            {
+                pipeline = specificPipeline;
+            }
+        }
+        else
+            pipeline = getPipeline();
+        
+        pipeline.invoke(context);
    
+        long end = System.currentTimeMillis();
+        statistics.logPageAccess(context, 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