View Javadoc

1    /*
2    Copyright (c) 2005, CodeSmarts
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
7    met:
8    	* 	Redistributions of source code must retain the above copyright
9    notice, this list of conditions and the following disclaimer.
10   	* 	Redistributions in binary form must reproduce the above
11   copyright notice, this list of conditions and the following disclaimer
12   in the documentation and/or other materials provided with the
13   distribution.
14   	* 	Neither the name of the CodeSmarts nor the names of its
15   contributors may be used to endorse or promote products derived from
16   this software without specific prior written permission.
17  
18   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21   PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29   */
30  
31  package net.codesmarts.log4j;
32  
33  import java.util.List;
34  
35  /***
36   * This class represents a list of logging events and a semiunique key
37   * as an atomic bug repot
38   * @author Fred McCann
39   */
40  public class BugReport {
41      /***
42       * Hash of this report
43       */
44      private String key;
45  
46      /***
47       * List of logging events
48       */
49      private List events;
50      
51      /***
52       * Create a new bug report. This constructor removes items from a watcher thread's buffer
53       * @param events a list of Log4j LoggingEvents
54       * @param index The last index to add to the report
55       */
56      public BugReport(List events, int method) {
57          this.events = events;
58          this.key = HashUtility.hash(this.events, method);
59      }
60          
61      /***
62       * Return the list of logging events contained in this report
63       * @return Returns the events.
64       */
65      public List getEvents() {
66          return events;
67      }
68      
69      /***
70       * Return the semiunique hash value of this report
71       * @return Returns the key.
72       */
73      public String getKey() {
74          return key;
75      }
76  }