1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 * 9 * http://www.apache.org/licenses/LICENSE-2.010 * 11 * Unless required by applicable law or agreed to in writing, software12 * 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 and15 * limitations under the License.16 */17packageorg.apache.jetspeed.statistics.impl;
1819import java.sql.Connection;
20import java.sql.PreparedStatement;
21import java.sql.SQLException;
2223import javax.sql.DataSource;
2425/***26 * <p>27 * BatchedPageStatistics28 * </p>29 * 30 * @author <a href="mailto:chris@bluesunrise.com">Chris Schaefer </a>31 * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>32 * @version $Id: TestPortletEntityDAO.java,v 1.3 2005/05/24 14:43:19 ate Exp $33 */34publicclassBatchedPageStatisticsextendsBatchedStatistics35 {
3637publicBatchedPageStatistics(DataSource ds, int batchSize,
38long msElapsedTimeThreshold, String name)
39 {
40super(ds, batchSize, msElapsedTimeThreshold, name);
41 }
4243/*44 * (non-Javadoc)45 * 46 * @see org.apache.jetspeed.statistics.impl.BatchedStatistics#canDoRecordType(org.apache.jetspeed.statistics.impl.LogRecord)47 */48publicboolean canDoRecordType(LogRecord rec)
49 {
50return (rec instanceof PageLogRecord);
51 }
5253/***54 * @param stm55 * @param recordIterator56 * @throws SQLException57 */58protectedvoid loadOneRecordToStatement(PreparedStatement stm, LogRecord rec)
59 throws SQLException
60 {
61PageLogRecord record = (PageLogRecord) rec;
6263 stm.setString(1, record.getIpAddress());
64 stm.setString(2, record.getUserName());
65 stm.setTimestamp(3, record.getTimeStamp());
66 stm.setString(4, record.getPagePath());
67 stm.setInt(5, record.getStatus());
68 stm.setLong(6, record.getMsElapsedTime());
6970 }
7172/***73 * @param con74 * @return75 * @throws SQLException76 */77protected PreparedStatement getPreparedStatement(Connection con)
78 throws SQLException
79 {
80 PreparedStatement stm;
81 stm = con
82 .prepareStatement("INSERT INTO PAGE_STATISTICS VALUES(?,?,?,?,?,?)");
83return stm;
84 }
8586 }