|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This report was generated with an evaluation server license. Purchase Clover or configure your license. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NullLogger | Line # 46 | 9 | 0% | 7 | 16 | 0% |
0.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | /* | |
| 2 | * Copyright (c) 2003-2006, Simon Brown | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions are met: | |
| 7 | * | |
| 8 | * - Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * | |
| 11 | * - Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in | |
| 13 | * the documentation and/or other materials provided with the | |
| 14 | * distribution. | |
| 15 | * | |
| 16 | * - Neither the name of Pebble nor the names of its contributors may | |
| 17 | * be used to endorse or promote products derived from this software | |
| 18 | * without specific prior written permission. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
| 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
| 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 30 | * POSSIBILITY OF SUCH DAMAGE. | |
| 31 | */ | |
| 32 | package net.sourceforge.pebble.logging; | |
| 33 | ||
| 34 | import net.sourceforge.pebble.domain.Blog; | |
| 35 | ||
| 36 | import javax.servlet.http.HttpServletRequest; | |
| 37 | import java.util.ArrayList; | |
| 38 | import java.util.Calendar; | |
| 39 | ||
| 40 | /** | |
| 41 | * A no-op logger that can be used when Pebble logging isn't required, such | |
| 42 | * as when something like Apache provides the necessary logging already. | |
| 43 | * | |
| 44 | * @author Simon Brown | |
| 45 | */ | |
| 46 | public class NullLogger extends AbstractLogger { | |
| 47 | ||
| 48 | /** | |
| 49 | * Creates a new instance associated with the specified blog. | |
| 50 | * | |
| 51 | * @param blog a Blog instance | |
| 52 | */ | |
| 53 | 0 |
public NullLogger(Blog blog) { |
| 54 | 0 | super(blog); |
| 55 | } | |
| 56 | ||
| 57 | /** | |
| 58 | * Logs a HTTP request. | |
| 59 | * | |
| 60 | * @param request a HttpServletRequest | |
| 61 | */ | |
| 62 | 0 |
public void log(HttpServletRequest request, int status) { |
| 63 | } | |
| 64 | ||
| 65 | /** | |
| 66 | * Called to start this logger. | |
| 67 | */ | |
| 68 | 0 |
public void start() { |
| 69 | } | |
| 70 | ||
| 71 | /** | |
| 72 | * Called to stop this logger. | |
| 73 | */ | |
| 74 | 0 |
public void stop() { |
| 75 | } | |
| 76 | ||
| 77 | /** | |
| 78 | * Gets a copy of the log file for a given year, month and day. | |
| 79 | * | |
| 80 | * @param year the year to get entries for | |
| 81 | * @param month the month to get entries for | |
| 82 | * @param day the day to get entries for | |
| 83 | * @return a String containing the contents of the requested log file | |
| 84 | */ | |
| 85 | 0 |
public String getLogFile(int year, int month, int day) { |
| 86 | 0 | return ""; |
| 87 | } | |
| 88 | ||
| 89 | /** | |
| 90 | * Gets the log for a given year, month and day. | |
| 91 | * | |
| 92 | * @param year the year to get entries for | |
| 93 | * @param month the month to get entries for | |
| 94 | * @param day the day to get entries for | |
| 95 | * @return a Log object | |
| 96 | */ | |
| 97 | 0 |
public Log getLog(int year, int month, int day) { |
| 98 | 0 | return new Log(blog, new ArrayList()); |
| 99 | } | |
| 100 | ||
| 101 | /** | |
| 102 | * Gets the log summary information for the given year, month and day. | |
| 103 | * | |
| 104 | * @param year the year to get entries for | |
| 105 | * @param month the month to get entries for | |
| 106 | * @param day the day to get entries for | |
| 107 | * @return a LogSummary object | |
| 108 | */ | |
| 109 | 0 |
public LogSummary getLogSummary(int year, int month, int day) { |
| 110 | 0 | Calendar cal = blog.getCalendar(); |
| 111 | 0 | cal.set(Calendar.YEAR, year); |
| 112 | 0 | cal.set(Calendar.MONTH, month-1); |
| 113 | 0 | cal.set(Calendar.DAY_OF_MONTH, day); |
| 114 | 0 | int totalRequests = 0; |
| 115 | ||
| 116 | 0 | return new LogSummaryItem(blog, cal.getTime(), totalRequests); |
| 117 | } | |
| 118 | ||
| 119 | } | |
|
||||||||||||