You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by dl...@apache.org on 2005/12/05 17:01:09 UTC

svn commit: r354086 - in /portals/jetspeed-2/trunk: components/statistics/xdocs/ components/statistics/xdocs/images/ xdocs/guides/

Author: dlestrat
Date: Mon Dec  5 08:00:59 2005
New Revision: 354086

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

Adding statistics component.

Added:
    portals/jetspeed-2/trunk/components/statistics/xdocs/aggregation.xml
    portals/jetspeed-2/trunk/components/statistics/xdocs/images/
    portals/jetspeed-2/trunk/components/statistics/xdocs/images/aggregatestatistics-c.gif   (with props)
    portals/jetspeed-2/trunk/components/statistics/xdocs/images/batchedstatistics-c.gif   (with props)
    portals/jetspeed-2/trunk/components/statistics/xdocs/images/logrecord-c.gif   (with props)
    portals/jetspeed-2/trunk/components/statistics/xdocs/images/page-statistics.gif   (with props)
    portals/jetspeed-2/trunk/components/statistics/xdocs/images/portalstatistics-c.gif   (with props)
    portals/jetspeed-2/trunk/components/statistics/xdocs/images/portlet-statistics.gif   (with props)
    portals/jetspeed-2/trunk/components/statistics/xdocs/images/statistics-db.gif   (with props)
    portals/jetspeed-2/trunk/components/statistics/xdocs/index.xml
    portals/jetspeed-2/trunk/components/statistics/xdocs/stats.xml
Modified:
    portals/jetspeed-2/trunk/components/statistics/xdocs/navigation.xml
    portals/jetspeed-2/trunk/xdocs/guides/guide-components.xml

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/aggregation.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/aggregation.xml?rev=354086&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/xdocs/aggregation.xml (added)
+++ portals/jetspeed-2/trunk/components/statistics/xdocs/aggregation.xml Mon Dec  5 08:00:59 2005
@@ -0,0 +1,63 @@
+<?xml version="1.0" ?>
+<!--
+    Copyright 2004 The Apache Software Foundation
+    
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<document>
+    <properties>
+        <title>Jetspeed-2 Statistics</title>
+        <authors>
+            <person name="David Le Strat" email="dlestrat@apache.org" />
+        </authors>
+    </properties>
+    <body>
+        <section name="Data Aggregation Overview">
+            <p>
+            Jetspeed-2 provides a mechanism for aggregating portal statistics for reporting purpose.
+            </p>
+            <subsection name="Retrieving Aggregate Statistics">
+            <p>
+            The <code>PortalStatistics</code> component exposes a <code>queryStatistics</code> method that given
+            a <code>StatisticsQueryCriteria</code> will return <code>AggregateStatistics</code>.
+        	<pre>
+    AggregateStatistics queryStatistics(StatisticsQueryCriteria criteria)</pre>
+    		The <code>AggregateStatistics</code> can then be used for reporting purpose.
+            <br/>
+        	<img src="images/aggregatestatistics-c.gif" border="0" />
+			</p>
+			</subsection>
+			<subsection name="Using Aggregate Statistics">
+			<p>
+			As illustrated in <a href="stats.html">viewing statistics</a>, Jetspeed-2 provides a default reporting portlet
+			for view statistics.  To query statistics, a <code>StatisticsQueryCriteria</code> must be set.  According to this
+			criteria the <code>PortalStatistics</code> <code>queryStatistics()</code> method will return an <code>AggregateStatistics</code>.
+			</p>
+			<pre>
+        StatisticsQueryCriteria criteria = statistics.createStatisticsQueryCriteria();
+        ...
+        criteria.setUser(user);
+        criteria.setListsize("5");
+        criteria.setSorttype("count");
+        criteria.setSortorder("desc");
+        criteria.setTimePeriod(timeperiod);
+        criteria.setQueryType(queryType);
+        AggregateStatistics stats = statistics.getDefaultEmptyAggregateStatistics();
+        ...
+        statistics.forceFlush();
+        stats = statistics.queryStatistics(criteria);</pre>
+			</subsection>
+		</section>
+    </body>
+</document>
+

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/images/aggregatestatistics-c.gif
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/images/aggregatestatistics-c.gif?rev=354086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/components/statistics/xdocs/images/aggregatestatistics-c.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/images/batchedstatistics-c.gif
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/images/batchedstatistics-c.gif?rev=354086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/components/statistics/xdocs/images/batchedstatistics-c.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/images/logrecord-c.gif
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/images/logrecord-c.gif?rev=354086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/components/statistics/xdocs/images/logrecord-c.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/images/page-statistics.gif
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/images/page-statistics.gif?rev=354086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/components/statistics/xdocs/images/page-statistics.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/images/portalstatistics-c.gif
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/images/portalstatistics-c.gif?rev=354086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/components/statistics/xdocs/images/portalstatistics-c.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/images/portlet-statistics.gif
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/images/portlet-statistics.gif?rev=354086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/components/statistics/xdocs/images/portlet-statistics.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/images/statistics-db.gif
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/images/statistics-db.gif?rev=354086&view=auto
==============================================================================
Binary file - no diff available.

Propchange: portals/jetspeed-2/trunk/components/statistics/xdocs/images/statistics-db.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/index.xml?rev=354086&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/xdocs/index.xml (added)
+++ portals/jetspeed-2/trunk/components/statistics/xdocs/index.xml Mon Dec  5 08:00:59 2005
@@ -0,0 +1,117 @@
+<?xml version="1.0" ?>
+<!--
+    Copyright 2004 The Apache Software Foundation
+    
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<document>
+    <properties>
+        <title>Jetspeed-2 Statistics</title>
+        <authors>
+            <person name="David Le Strat" email="dlestrat@apache.org" />
+        </authors>
+    </properties>
+    <body>
+        <section name="Statistics Overview">
+        	<p>
+        	Jetspeed-2 provides components for collecting portal data for various application events.
+        	</p>
+        	<subsection name="Collecting Portal Data">
+        	<p>
+        	<code>PortalStatistics</code> provides APIs for collecting portal application events.  The following event types
+        	are supported out of the box:
+        	<ul>
+        	<li>Portlet rendering statistics.</li>
+        	<li>Page rendering statistics.</li>
+        	<li>User access statistics.</li>
+        	</ul>
+        	The <code>PortalStatistics</code> implementation logs usage data based on the 
+        	<a href="http://httpd.apache.org/docs/logs.html">Apache Common Log Format (CLF)</a>
+        	where each log entry is formatted in the form:
+        	<pre>
+    %h %l %u %t \"%r\" %>s %b</pre>
+    		where:
+			<ul>
+			<li><b>%h </b>- remote host</li>
+			<li><b>%l </b>- remote log name</li>
+			<li><b>%u </b>- remote user</li>
+			<li><b>%t </b>- time in common log time format</li>
+			<li><b>%r </b>- first line of HTTP request</li>
+			<li><b>%s </b>- HTTP status code</li>
+			<li><b>%b </b>- number of bytes sent (&quot;-&quot; if no bytes sent).</li>
+			</ul>
+        	<br/>
+        	<img src="images/portalstatistics-c.gif" border="0" />
+        	</p>
+        	<p>
+        	Statistics data is stored in 3 relational tables as illustrated below:
+        	<br/><br/>
+        	<img src="images/statistics-db.gif" border="0" />
+        	</p>
+        	<p>
+        	Each event type is mapped to a data holder that gets persisted in the statistics tables illustrated above.
+        	<img src="images/logrecord-c.gif" border="0" />
+        	<br/>
+        	Jetspeed-2 persists the collected data in batches through the <code>BatchedStatistics</code> component.
+        	<br/><br/>
+        	<img src="images/batchedstatistics-c.gif" border="0" />
+        	</p>
+        	</subsection>
+        	<subsection name="PortalStatistics Configuration">
+        	<p>
+        	The <code>PortalStatistics</code> component is configured in <code>WEB-INF/assembly/statistics.xml</code> and
+        	requires the following configuration parameters:
+        	<ul>
+        	<li><b>logToCLF</b>: Whether to log to a comma limited file.</li>
+        	<li><b>logToDatabase</b>: Whether to record the statistics in the database.</li>
+        	<li><b>maxRecordToFlush_Portlet</b>: The maximum number of events that can be recorded at once for portlet statistics.</li>
+        	<li><b>maxRecordToFlush_User</b>: The maximum number of events that can be recorded at once for user statistics.</li>
+        	<li><b>maxRecordToFlush_Page</b>: The maximum number of events that can be recorded at once for page statistics.</li>
+        	<li><b>maxTimeMsToFlush_Portlet</b>: The frequency for recording portlets events.</li>
+        	<li><b>maxTimeMsToFlush_User</b>: The frequency for recording users events.</li>
+        	<li><b>maxTimeMsToFlush_Page</b>: The frequency for recording pages events.</li>
+        	<li><b>jetspeedDSEntry</b>: The reference to the Jetspeed data source.</li>
+        	</ul>
+        	</p>
+        	<p>
+        	A sample configuration is provided below:
+        	<pre>
+    &lt;bean id="PortalStatistics" 
+      class="org.apache.jetspeed.statistics.impl.PortalStatisticsImpl"
+      init-method="springInit"
+      destroy-method="springDestroy"&gt;
+      &lt;!-- logToCLF --&gt;
+      &lt;constructor-arg index='0' type="boolean"&gt;&lt;value&gt;false&lt;/value&gt;&lt;/constructor-arg&gt;
+      &lt;!-- logToDatabase --&gt;
+      &lt;constructor-arg index='1' type="boolean"&gt;&lt;value&gt;true&lt;/value&gt;&lt;/constructor-arg&gt;	
+      &lt;!-- maxRecordToFlush_Portal --&gt;
+      &lt;constructor-arg index='2'&gt;&lt;value&gt;300&lt;/value&gt;&lt;/constructor-arg&gt;
+      &lt;!-- maxRecordToFlush_User --&gt;
+      &lt;constructor-arg index='3'&gt;&lt;value&gt;50&lt;/value&gt;&lt;/constructor-arg&gt;	
+      &lt;!-- maxRecordToFlush_Page --&gt;
+      &lt;constructor-arg index='4'&gt;&lt;value&gt;100&lt;/value&gt;&lt;/constructor-arg&gt;	
+      &lt;!-- maxTimeMsToFlush_Portal --&gt;
+      &lt;constructor-arg  index='5'&gt;&lt;value&gt;300000&lt;/value&gt;&lt;/constructor-arg&gt;		
+      &lt;!-- maxTimeMsToFlush_User --&gt;
+      &lt;constructor-arg  index='6'&gt;&lt;value&gt;5000&lt;/value&gt;&lt;/constructor-arg&gt;
+      &lt;!-- maxTimeMsToFlush_Page --&gt;
+      &lt;constructor-arg  index='7&gt;&lt;value&gt;60000&lt;/value&gt;&lt;/constructor-arg&gt;
+      &lt;!-- jetspeedDSEntry --&gt;
+      &lt;constructor-arg  index='8'&gt;&lt;ref bean="JetspeedDS"/&gt;&lt;/constructor-arg&gt;
+    &lt;/bean&gt;</pre>
+        	</p>
+        	</subsection>
+		</section>
+    </body>
+</document>
+

Modified: portals/jetspeed-2/trunk/components/statistics/xdocs/navigation.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/navigation.xml?rev=354086&r1=354085&r2=354086&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/xdocs/navigation.xml (original)
+++ portals/jetspeed-2/trunk/components/statistics/xdocs/navigation.xml Mon Dec  5 08:00:59 2005
@@ -17,9 +17,15 @@
 <project>
     <body>
         <links>
-            <item name="Jetspeed 2" href="../../index.html" />
+        	<item name="Components Guide" href="../../guides/guide-components.html" />
+        	<item name="Jetspeed 2" href="../../index.html" />
             <!-- Cannot access ${pom.id}... Hard coding pdf name. -->
             <item name="PDF Documentation" href="/jetspeed-statistics.pdf" img="../../images/pdf.gif" />
         </links>
+    	<menu name="Jetspeed-2 Statistics Documentation">
+    	    <item name="Statistics Overview" href="index.html" />
+    		<item name="Data Aggregation" href="aggregation.html" />
+    	    <item name="Viewing Statistics" href="stats.html" />
+    	</menu>
     </body>
 </project>

Added: portals/jetspeed-2/trunk/components/statistics/xdocs/stats.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/xdocs/stats.xml?rev=354086&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/xdocs/stats.xml (added)
+++ portals/jetspeed-2/trunk/components/statistics/xdocs/stats.xml Mon Dec  5 08:00:59 2005
@@ -0,0 +1,54 @@
+<?xml version="1.0" ?>
+<!--
+    Copyright 2004 The Apache Software Foundation
+    
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<document>
+    <properties>
+        <title>Jetspeed-2 Statistics</title>
+        <authors>
+            <person name="David Le Strat" email="dlestrat@apache.org" />
+        </authors>
+    </properties>
+    <body>
+        <section name="Viewing Statistics">
+        	<subsection name="Where are the Event Recorded?">
+        	<p>
+        	Portal statistics events collection is injected at multiple points in the portal engine. Some examples are
+        	provided below.
+        	</p>
+        	<p>
+        	For user events, the <code>SecurityValveImpl</code> logs a user login event in <code>getSubject(RequestContext request)</code>.
+        	<pre>
+    statistics.logUserLogin(request, 0);</pre>
+        	</p>
+        	<p>
+        	For portlet events, the <code>RenderingJobImpl</code> invoked in <code>RenderingJob</code> <code>buildRenderingJob</code> logs
+        	a portlet access event.
+        	<pre>
+    statistics.logPortletAccess(requestContext, fragment.getName(), PortalStatistics.HTTP_OK, end - start);</pre>       	
+        	</p>
+    		</subsection>
+    		<subsection name="Viewing Statistics">
+    		<p>
+    		Jetpseed-2 provides administrative portlets that report on portal statistics.
+    		<br/><br/>
+    		<img src="images/portlet-statistics.gif" border="0"/><br/>
+    		<img src="images/page-statistics.gif" border="0"/>
+    		</p>
+    		</subsection>
+		</section>
+    </body>
+</document>
+

Modified: portals/jetspeed-2/trunk/xdocs/guides/guide-components.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/xdocs/guides/guide-components.xml?rev=354086&r1=354085&r2=354086&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/xdocs/guides/guide-components.xml (original)
+++ portals/jetspeed-2/trunk/xdocs/guides/guide-components.xml Mon Dec  5 08:00:59 2005
@@ -177,7 +177,7 @@
           </tr>
           <tr>
             <td><a href="../multiproject/jetspeed-search/index.html"><code>SearchEngine</code></a></td>
-            <td>The <code>SearchEngine</code> provide the integration with the <a href="http://lucene.apache.org/">Apache Lucene</a> search
+            <td><code>SearchEngine</code> provides the integration with the <a href="http://lucene.apache.org/">Apache Lucene</a> search
             engine.</td>
           </tr>
           <tr>
@@ -185,7 +185,7 @@
             <td>The <code>HandlerFactory</code> exposes the documents handlers to the <code>SearchEngine</code>.</td>
           </tr>
 		</table><br/>
-		<!-- table>
+		<table>
           <tr>
           	<th colspan="2">Jetspeed-2 Statistics - Artifact Id: jetspeed-statistics</th>
           </tr>
@@ -194,10 +194,22 @@
             <th>Description</th>
           </tr>
           <tr>
-            <td><a href="../multiproject/jetspeed-prefs/index.html"><code>PreferencesProvider</code></a></td>
-            <td>The <code>PreferencesProvider</code> exposes Jetspeed-2 implementation of the <code>java.util.Preferences</code> API.</td>
+            <td><a href="../multiproject/jetspeed-statistics/index.html"><code>PortalStatistics</code></a></td>
+            <td><code>PortalStatistics</code> exposes the Jetspeed-2 data collection API for data collection and data
+            retrieval.</td>
           </tr>
-		</table><br/-->
+          <tr>
+            <td><a href="../multiproject/jetspeed-statistics/index.html"><code>BatchedStatistics</code></a></td>
+            <td><code>BatchedStatistics</code> is responsible for the batch collection of statistics data given
+            a time to flush period.</td>
+          </tr>
+          <tr>
+            <td><a href="../multiproject/jetspeed-statistics/aggregation.html"><code>AggregateStatistics</code></a><br/>
+            <a href="../multiproject/jetspeed-statistics/aggregation.html"><code>StatisticsQueryCriteria</code></a></td>
+            <td><code>AggregateStatistics</code> interacts with the <code>PortalStatistics</code> component to provide
+            aggregate portal data for a specific event and search criteria provided by <code>StatisticsQueryCriteria</code>.</td>
+          </tr>   
+		</table>
 		</subsection>
 		</section>
 	</body>



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