01: package examples.nistgoodies.configlogger;
02:
03: import gov.nist.javax.sip.LogRecord;
04:
05: public class LogRecordImpl implements LogRecord {
06:
07: private String message;
08: private String source;
09: private String destination;
10: private long timeStamp;
11: private String tid;
12: private String firstLine;
13: private String callId;
14: private long timestampVal;
15:
16: /**
17: * Constructor for our custom log record
18: *
19: * @param message --
20: * the message to log
21: * @param source --
22: * the source
23: * @param destination --
24: * the destination
25: * @param timeStamp --
26: * the reception time
27: * @param isSender --
28: * the flag indicates whether we are sending or recieving the
29: * record
30: * @param firstLine --
31: * the messge first line
32: * @param tid --
33: * the transaction id
34: * @param callId --
35: * the callId
36: * @param timestampVal --
37: * the timestamp Header value.
38: */
39: public LogRecordImpl(String message, String source,
40: String destination, long timeStamp, boolean isSender,
41: String firstLine, String tid, String callId,
42: long timestampVal) {
43: this .message = message;
44: this .source = source;
45: this .destination = destination;
46: this .timeStamp = timeStamp;
47: this .firstLine = firstLine;
48: this .tid = tid;
49: this .callId = callId;
50: this .timestampVal = timestampVal;
51: }
52:
53: public boolean equals(Object other) {
54: if (!(other instanceof LogRecordImpl)) {
55: return false;
56: } else {
57: LogRecordImpl otherLog = (LogRecordImpl) other;
58: return otherLog.message.equals(message)
59: && otherLog.timeStamp == timeStamp;
60: }
61: }
62:
63: public String toString() {
64: StringBuffer sbuf = new StringBuffer();
65: sbuf.append("------------ Message BEGIN ----------- \n");
66: sbuf.append("timeStamp = " + this .timeStamp + "\n");
67: sbuf.append(this.message);
68: return sbuf.toString();
69: }
70:
71: }
|