KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > sqlprofiler > gui > EventDetails


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software
5  * License version 1.1, a copy of which has been included with this
6  * distribution in the APACHE.txt file. */

7 package org.jahia.sqlprofiler.gui;
8
9 import org.apache.log4j.Priority;
10 import org.apache.log4j.spi.LoggingEvent;
11
12 /**
13  * Represents the details of a logging event. It is intended to overcome the
14  * problem that a LoggingEvent cannot be constructed with purely fake data.
15  *
16  * @author <a HREF="mailto:oliver@puppycrawl.com">Oliver Burn</a>
17  * @version 1.0
18  */

19 class EventDetails {
20
21     /** the time of the event **/
22     private final long mTimeStamp;
23     /** the priority of the event **/
24     private final Priority mPriority;
25     /** the category of the event **/
26     private final String JavaDoc mCategoryName;
27     /** the NDC for the event **/
28     private final String JavaDoc mNDC;
29     /** the thread for the event **/
30     private final String JavaDoc mThreadName;
31     /** the msg for the event **/
32     private final String JavaDoc mMessage;
33     /** the throwable details the event **/
34     private final String JavaDoc[] mThrowableStrRep;
35     /** the location details for the event **/
36     private final String JavaDoc mLocationDetails;
37
38     /**
39      * Creates a new <code>EventDetails</code> instance.
40      * @param aTimeStamp a <code>long</code> value
41      * @param aPriority a <code>Priority</code> value
42      * @param aCategoryName a <code>String</code> value
43      * @param aNDC a <code>String</code> value
44      * @param aThreadName a <code>String</code> value
45      * @param aMessage a <code>String</code> value
46      * @param aThrowableStrRep a <code>String[]</code> value
47      * @param aLocationDetails a <code>String</code> value
48      */

49     EventDetails(long aTimeStamp,
50                  Priority aPriority,
51                  String JavaDoc aCategoryName,
52                  String JavaDoc aNDC,
53                  String JavaDoc aThreadName,
54                  String JavaDoc aMessage,
55                  String JavaDoc[] aThrowableStrRep,
56                  String JavaDoc aLocationDetails)
57     {
58         mTimeStamp = aTimeStamp;
59         mPriority = aPriority;
60         mCategoryName = aCategoryName;
61         mNDC = aNDC;
62         mThreadName = aThreadName;
63         mMessage = aMessage;
64         mThrowableStrRep = aThrowableStrRep;
65         mLocationDetails = aLocationDetails;
66     }
67
68     /**
69      * Creates a new <code>EventDetails</code> instance.
70      *
71      * @param aEvent a <code>LoggingEvent</code> value
72      */

73     EventDetails(LoggingEvent aEvent) {
74
75         this(aEvent.timeStamp,
76              aEvent.getLevel(),
77              aEvent.getLoggerName(),
78              aEvent.getNDC(),
79              aEvent.getThreadName(),
80              aEvent.getRenderedMessage(),
81              aEvent.getThrowableStrRep(),
82              (aEvent.getLocationInformation() == null)
83              ? null : aEvent.getLocationInformation().fullInfo);
84     }
85
86     /** @see #mTimeStamp **/
87     long getTimeStamp() {
88         return mTimeStamp;
89     }
90
91     /** @see #mPriority **/
92     Priority getPriority() {
93         return mPriority;
94     }
95
96     /** @see #mCategoryName **/
97     String JavaDoc getCategoryName() {
98         return mCategoryName;
99     }
100
101     /** @see #mNDC **/
102     String JavaDoc getNDC() {
103         return mNDC;
104     }
105
106     /** @see #mThreadName **/
107     String JavaDoc getThreadName() {
108         return mThreadName;
109     }
110
111     /** @see #mMessage **/
112     String JavaDoc getMessage() {
113         return mMessage;
114     }
115
116     /** @see #mLocationDetails **/
117     String JavaDoc getLocationDetails(){
118         return mLocationDetails;
119     }
120
121     /** @see #mThrowableStrRep **/
122     String JavaDoc[] getThrowableStrRep() {
123         return mThrowableStrRep;
124     }
125 }
126
Popular Tags