%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.statistics.impl.BatchedPageStatistics |
|
|
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 | package org.apache.jetspeed.statistics.impl; |
|
18 | ||
19 | import java.sql.Connection; |
|
20 | import java.sql.PreparedStatement; |
|
21 | import java.sql.SQLException; |
|
22 | ||
23 | import javax.sql.DataSource; |
|
24 | ||
25 | /** |
|
26 | * <p> |
|
27 | * BatchedPageStatistics |
|
28 | * </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 | */ |
|
34 | public class BatchedPageStatistics extends BatchedStatistics |
|
35 | { |
|
36 | ||
37 | public BatchedPageStatistics(DataSource ds, int batchSize, |
|
38 | long msElapsedTimeThreshold, String name) |
|
39 | { |
|
40 | 0 | super(ds, batchSize, msElapsedTimeThreshold, name); |
41 | 0 | } |
42 | ||
43 | /* |
|
44 | * (non-Javadoc) |
|
45 | * |
|
46 | * @see org.apache.jetspeed.statistics.impl.BatchedStatistics#canDoRecordType(org.apache.jetspeed.statistics.impl.LogRecord) |
|
47 | */ |
|
48 | public boolean canDoRecordType(LogRecord rec) |
|
49 | { |
|
50 | 0 | return (rec instanceof PageLogRecord); |
51 | } |
|
52 | ||
53 | /** |
|
54 | * @param stm |
|
55 | * @param recordIterator |
|
56 | * @throws SQLException |
|
57 | */ |
|
58 | protected void loadOneRecordToStatement(PreparedStatement stm, LogRecord rec) |
|
59 | throws SQLException |
|
60 | { |
|
61 | 0 | PageLogRecord record = (PageLogRecord) rec; |
62 | ||
63 | 0 | stm.setString(1, record.getIpAddress()); |
64 | 0 | stm.setString(2, record.getUserName()); |
65 | 0 | stm.setTimestamp(3, record.getTimeStamp()); |
66 | 0 | stm.setString(4, record.getPagePath()); |
67 | 0 | stm.setInt(5, record.getStatus()); |
68 | 0 | stm.setLong(6, record.getMsElapsedTime()); |
69 | ||
70 | 0 | } |
71 | ||
72 | /** |
|
73 | * @param con |
|
74 | * @return |
|
75 | * @throws SQLException |
|
76 | */ |
|
77 | protected PreparedStatement getPreparedStatement(Connection con) |
|
78 | throws SQLException |
|
79 | { |
|
80 | PreparedStatement stm; |
|
81 | 0 | stm = con |
82 | .prepareStatement("INSERT INTO PAGE_STATISTICS VALUES(?,?,?,?,?,?)"); |
|
83 | 0 | return stm; |
84 | } |
|
85 | ||
86 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |