Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * Conditions Of Use
  *
  * This software was developed by employees of the National Institute of
  * Standards and Technology (NIST), an agency of the Federal Government.
  * Pursuant to title 15 Untied States Code Section 105, works of NIST
  * employees are not subject to copyright protection in the United States
  * and are considered to be in the public domain.  As a result, a formal
  * license is not needed to use the software.
 *
 * This software is provided by NIST as a service and is expressly
 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
 * AND DATA ACCURACY.  NIST does not warrant or make any representations
 * regarding the use of the software or the results thereof, including but
 * not limited to the correctness, accuracy, reliability or usefulness of
 * the software.
 *
 * Permission to use this software is contingent upon your acceptance
 * of the terms of this agreement
 *
 * .
 *
 */
Product of NIST/ITL Advanced Networking Technologies Division (ANTD). * /
 
 
 package gov.nist.javax.sip.stack;
 
This class stores a message along with some other informations Used to log messages.

Author(s):
M. Ranganathan
Marc Bednarek
Version:
1.2 $Revision: 1.9 $ $Date: 2009-07-17 18:58:13 $
 
 class MessageLog implements LogRecord {
 
     private String message;
 
     private String source;
 
     private String destination;
 
     private long timeStamp;
 
     private boolean isSender;
 
     private String firstLine;
 
     private String tid;
 
     private String callId;
 
     private long timeStampHeaderValue;
 
     /* (non-Javadoc)
      * @see gov.nist.javax.sip.stack.LogRecord#equals(java.lang.Object)
      */
     public boolean equals(Object other) {
         if (!(other instanceof MessageLog)) {
             return false;
         } else {
             MessageLog otherLog = (MessageLogother;
             return otherLog.message.equals()
                 && otherLog.timeStamp == ;
         }
     }

    
Constructor
 
 
     public MessageLog(
         String message,
         String source,
         String destination,
         String timeStamp,
         boolean isSender,
         String firstLine,
         String tid,
         String callId,
         long timeStampHeaderValue) {
         if (message == null || message.equals(""))
             throw new IllegalArgumentException("null msg");
         this. = message;
         this. = source;
         this. = destination;
         try {
             long ts = Long.parseLong(timeStamp);
             if (ts < 0)
                throw new IllegalArgumentException("Bad time stamp ");
            this. = ts;
        } catch (NumberFormatException ex) {
            throw new IllegalArgumentException(
                "Bad number format " + timeStamp);
        }
        this. = isSender;
        this. = firstLine;
        this. = tid;
        this. = callId;
        this. = timeStampHeaderValue;
    }
    public MessageLog(
        String message,
        String source,
        String destination,
        long timeStamp,
        boolean isSender,
        String firstLine,
        String tid,
        String callId,
        long timestampVal) {
        if (message == null || message.equals(""))
            throw new IllegalArgumentException("null msg");
        this. = message;
        this. = source;
        this. = destination;
        if (timeStamp < 0)
            throw new IllegalArgumentException("negative ts");
        this. = timeStamp;
        this. = isSender;
        this. = firstLine;
        this. = tid;
        this. = callId;
        this. = timestampVal;
    }
    /* (non-Javadoc)
     * @see gov.nist.javax.sip.stack.LogRecord#toString()
     */
    public String toString() {
        String log;
            log =
                "<message\nfrom=\""
                    + 
                    + "\" \nto=\""
                    + 
                    + "\" \ntime=\""
                    + 
                    + "\"" +
                    (this. != 0 ? "\ntimeStamp = \"" +  + "\"""")
                    +"\nisSender=\""
                    + 
                    + "\" \ntransactionId=\""
                    + 
                    + "\" \ncallId=\""
                    + 
                    + "\" \nfirstLine=\""
                    + .trim() + "\"" +
                    " \n>\n";
            log += "<![CDATA[";
            log += ;
            log += "]]>\n";
            log += "</message>\n";
        return log;
    }
New to GrepCode? Check out our FAQ X