Coverage report

  %line %branch
org.apache.jetspeed.statistics.impl.BatchedPortletStatistics
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 
 18  
 package org.apache.jetspeed.statistics.impl;
 19  
 
 20  
 import java.sql.Connection;
 21  
 import java.sql.PreparedStatement;
 22  
 import java.sql.SQLException;
 23  
 
 24  
 import javax.sql.DataSource;
 25  
 
 26  
 /**
 27  
  * Batches up LogRecord statistics, and flushes them periodically to the
 28  
  * appropriate table in the database.
 29  
  * <P>
 30  
  * IMPORTANT: It is the caller's responsibility to insure that the LogRecord
 31  
  * instances added to a BatchedStatistics instance are all of the same type
 32  
  * (Portlet Access, Page Access, or User Logout).
 33  
  * 
 34  
  * @author <a href="mailto:chris@bluesunrise.com">Chris Schaefer </a>
 35  
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
 36  
  * @version $Id: TestPortletEntityDAO.java,v 1.3 2005/05/24 14:43:19 ate Exp $
 37  
  */
 38  
 public class BatchedPortletStatistics extends BatchedStatistics
 39  
 {
 40  
 
 41  
     public BatchedPortletStatistics(DataSource ds, int batchSize,
 42  
             long msElapsedTimeThreshold, String name)
 43  
     {
 44  0
         super(ds, batchSize, msElapsedTimeThreshold, name);
 45  0
     }
 46  
 
 47  
     /*
 48  
      * (non-Javadoc)
 49  
      * 
 50  
      * @see org.apache.jetspeed.statistics.impl.BatchedStatistics#canDoRecordType(org.apache.jetspeed.statistics.impl.LogRecord)
 51  
      */
 52  
     public boolean canDoRecordType(LogRecord rec)
 53  
     {
 54  0
         return (rec instanceof PortletLogRecord);
 55  
     }
 56  
 
 57  
     /**
 58  
      * @param stm
 59  
      * @param recordIterator
 60  
      * @throws SQLException
 61  
      */
 62  
     protected void loadOneRecordToStatement(PreparedStatement stm, LogRecord rec)
 63  
             throws SQLException
 64  
     {
 65  0
         PortletLogRecord record = (PortletLogRecord) rec;
 66  
 
 67  0
         stm.setString(1, record.getIpAddress());
 68  0
         stm.setString(2, record.getUserName());
 69  0
         stm.setTimestamp(3, record.getTimeStamp());
 70  0
         stm.setString(4, record.getPagePath());
 71  0
         stm.setString(5, record.getPortletName());
 72  0
         stm.setInt(6, record.getStatus());
 73  0
         stm.setLong(7, record.getMsElapsedTime());
 74  
 
 75  0
     }
 76  
 
 77  
     /**
 78  
      * @param con
 79  
      * @return
 80  
      * @throws SQLException
 81  
      */
 82  
     protected PreparedStatement getPreparedStatement(Connection con)
 83  
             throws SQLException
 84  
     {
 85  
         PreparedStatement stm;
 86  0
         stm = con
 87  
                 .prepareStatement("INSERT INTO PORTLET_STATISTICS VALUES(?,?,?,?,?,?,?)");
 88  0
         return stm;
 89  
     }
 90  
 
 91  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.