001: /*
002: * Copyright (C) The Apache Software Foundation. All rights reserved.
003: *
004: * This software is published under the terms of the Apache Software
005: * License version 1.1, a copy of which has been included with this
006: * distribution in the APACHE.txt file. */
007: package org.jahia.sqlprofiler.gui;
008:
009: import org.apache.log4j.Priority;
010: import org.apache.log4j.spi.LoggingEvent;
011:
012: /**
013: * Represents the details of a logging event. It is intended to overcome the
014: * problem that a LoggingEvent cannot be constructed with purely fake data.
015: *
016: * @author <a href="mailto:oliver@puppycrawl.com">Oliver Burn</a>
017: * @version 1.0
018: */
019: class EventDetails {
020:
021: /** the time of the event **/
022: private final long mTimeStamp;
023: /** the priority of the event **/
024: private final Priority mPriority;
025: /** the category of the event **/
026: private final String mCategoryName;
027: /** the NDC for the event **/
028: private final String mNDC;
029: /** the thread for the event **/
030: private final String mThreadName;
031: /** the msg for the event **/
032: private final String mMessage;
033: /** the throwable details the event **/
034: private final String[] mThrowableStrRep;
035: /** the location details for the event **/
036: private final String mLocationDetails;
037:
038: /**
039: * Creates a new <code>EventDetails</code> instance.
040: * @param aTimeStamp a <code>long</code> value
041: * @param aPriority a <code>Priority</code> value
042: * @param aCategoryName a <code>String</code> value
043: * @param aNDC a <code>String</code> value
044: * @param aThreadName a <code>String</code> value
045: * @param aMessage a <code>String</code> value
046: * @param aThrowableStrRep a <code>String[]</code> value
047: * @param aLocationDetails a <code>String</code> value
048: */
049: EventDetails(long aTimeStamp, Priority aPriority,
050: String aCategoryName, String aNDC, String aThreadName,
051: String aMessage, String[] aThrowableStrRep,
052: String aLocationDetails) {
053: mTimeStamp = aTimeStamp;
054: mPriority = aPriority;
055: mCategoryName = aCategoryName;
056: mNDC = aNDC;
057: mThreadName = aThreadName;
058: mMessage = aMessage;
059: mThrowableStrRep = aThrowableStrRep;
060: mLocationDetails = aLocationDetails;
061: }
062:
063: /**
064: * Creates a new <code>EventDetails</code> instance.
065: *
066: * @param aEvent a <code>LoggingEvent</code> value
067: */
068: EventDetails(LoggingEvent aEvent) {
069:
070: this (aEvent.timeStamp, aEvent.getLevel(), aEvent
071: .getLoggerName(), aEvent.getNDC(), aEvent
072: .getThreadName(), aEvent.getRenderedMessage(), aEvent
073: .getThrowableStrRep(),
074: (aEvent.getLocationInformation() == null) ? null
075: : aEvent.getLocationInformation().fullInfo);
076: }
077:
078: /** @see #mTimeStamp **/
079: long getTimeStamp() {
080: return mTimeStamp;
081: }
082:
083: /** @see #mPriority **/
084: Priority getPriority() {
085: return mPriority;
086: }
087:
088: /** @see #mCategoryName **/
089: String getCategoryName() {
090: return mCategoryName;
091: }
092:
093: /** @see #mNDC **/
094: String getNDC() {
095: return mNDC;
096: }
097:
098: /** @see #mThreadName **/
099: String getThreadName() {
100: return mThreadName;
101: }
102:
103: /** @see #mMessage **/
104: String getMessage() {
105: return mMessage;
106: }
107:
108: /** @see #mLocationDetails **/
109: String getLocationDetails() {
110: return mLocationDetails;
111: }
112:
113: /** @see #mThrowableStrRep **/
114: String[] getThrowableStrRep() {
115: return mThrowableStrRep;
116: }
117: }
|