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 ta...@apache.org on 2005/12/03 04:25:05 UTC

svn commit: r351880 - in /portals/jetspeed-2/trunk: applications/j2-admin/src/java/org/apache/jetspeed/portlets/statistics/ components/statistics/src/java/org/apache/jetspeed/statistics/impl/ jetspeed-api/src/java/org/apache/jetspeed/statistics/

Author: taylor
Date: Fri Dec  2 19:25:00 2005
New Revision: 351880

URL: http://svn.apache.org/viewcvs?rev=351880&view=rev
Log:
Broken rules of the jetspeed-api and component programming: 
Never reference a class in another component outside of a component directly -- only go through interfaces. 
Recommend reading Fowler and other general IOC writings 

Modified:
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
    portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java?rev=351880&r1=351879&r2=351880&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java Fri Dec  2 19:25:00 2005
@@ -84,7 +84,7 @@
             if (sqc == null)
             {
                 // if we get here, we're on the first startup.
-                sqc = new StatisticsQueryCriteriaImpl();
+                sqc = statistics.createStatisticsQueryCriteria();
                 sqc.setQueryType(PortalStatistics.QUERY_TYPE_PORTLET);
                 sqc.setTimePeriod("1");
                 sqc.setListsize("5");
@@ -115,7 +115,8 @@
             ActionResponse actionResponse) throws PortletException, IOException
     {
         PortletSession session = request.getPortletSession();
-        StatisticsQueryCriteria criteria = new StatisticsQueryCriteriaImpl();
+        StatisticsQueryCriteria criteria = statistics.createStatisticsQueryCriteria();
+        
         String user = request.getParameter("user");
         criteria.setUser(user);
         String timeperiod = request.getParameter("timeperiod");
@@ -131,7 +132,7 @@
         String queryType = request.getParameter("queryType");
 
         criteria.setQueryType(queryType);
-        AggregateStatistics stats = new AggregateStatisticsImpl();
+        AggregateStatistics stats = statistics.getDefaultEmptyAggregateStatistics();
         try
         {
             statistics.forceFlush();

Modified: portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java?rev=351880&r1=351879&r2=351880&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java (original)
+++ portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java Fri Dec  2 19:25:00 2005
@@ -590,6 +590,22 @@
     }
 
     
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.statistics.PortalStatistics#getDefaultEmptyStatisticsQueryCriteria()
+     */
+    public StatisticsQueryCriteria createStatisticsQueryCriteria()
+    {
+        return new StatisticsQueryCriteriaImpl();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.statistics.PortalStatistics#getDefaultEmptyAggregateStatistics()
+     */
+    public AggregateStatistics getDefaultEmptyAggregateStatistics()
+    {
+        return new AggregateStatisticsImpl();
+    }
+
     /**
      * @see org.apache.jetspeed.statistics.PortalStatistics#queryStatistics(org.apache.jetspeed.statistics.StatisticsQueryCriteria)
      */

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java?rev=351880&r1=351879&r2=351880&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/PortalStatistics.java Fri Dec  2 19:25:00 2005
@@ -153,4 +153,18 @@
     public int getNumberOfLoggedInUsers();
 
     public List getListOfLoggedInUsers();
+    
+    /**
+     * Factory to create new statistics query criteria
+     * 
+     * @return a newly create statistics empty criteria
+     */
+    public StatisticsQueryCriteria createStatisticsQueryCriteria();
+    
+    /**
+     * Factory to create new, empty, aggregate statistics object.
+     * 
+     * @return unpopulated AggregateStatistics object 
+     */
+    public AggregateStatistics getDefaultEmptyAggregateStatistics();
 }



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