Coverage Report - org.mule.impl.message.ExceptionMessage
 
Classes in this File Line Coverage Branch Coverage Complexity
ExceptionMessage
0%
0/18
0%
0/4
1.333
 
 1  
 /*
 2  
  * $Id: ExceptionMessage.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.impl.message;
 12  
 
 13  
 import org.mule.impl.RequestContext;
 14  
 import org.mule.umo.UMOEventContext;
 15  
 import org.mule.umo.UMOMessage;
 16  
 import org.mule.umo.endpoint.UMOEndpointURI;
 17  
 
 18  
 import java.util.Date;
 19  
 import java.util.Iterator;
 20  
 
 21  
 /**
 22  
  * <code>ExceptionMessage</code> is used by the DefaultComponentExceptionStrategy
 23  
  * for wrapping an exception with a message to send via an endpointUri.
 24  
  */
 25  
 public class ExceptionMessage extends BaseMessage
 26  
 {
 27  
     /**
 28  
      * Serial version
 29  
      */
 30  
     private static final long serialVersionUID = -538516243574950621L;
 31  
 
 32  
     private Throwable exception;
 33  
     private String componentName;
 34  
     private UMOEndpointURI endpointUri;
 35  
     private Date timeStamp;
 36  
 
 37  
     public ExceptionMessage(Object message,
 38  
                             Throwable exception,
 39  
                             String componentName,
 40  
                             UMOEndpointURI endpointUri)
 41  
     {
 42  0
         super(message);
 43  0
         this.exception = exception;
 44  0
         timeStamp = new Date();
 45  0
         this.componentName = componentName;
 46  0
         this.endpointUri = endpointUri;
 47  
 
 48  0
         UMOEventContext ctx = RequestContext.getEventContext();
 49  0
         if (ctx != null)
 50  
         {
 51  0
             UMOMessage msg = ctx.getMessage();
 52  0
             for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();)
 53  
             {
 54  0
                 String propertyKey = (String) iterator.next();
 55  0
                 setProperty(propertyKey, msg.getProperty(propertyKey));
 56  0
             }
 57  
         }
 58  0
     }
 59  
 
 60  
     public String getComponentName()
 61  
     {
 62  0
         return componentName;
 63  
     }
 64  
 
 65  
     public UMOEndpointURI getEndpoint()
 66  
     {
 67  0
         return endpointUri;
 68  
     }
 69  
 
 70  
     public Date getTimeStamp()
 71  
     {
 72  0
         return timeStamp;
 73  
     }
 74  
 
 75  
     public Throwable getException()
 76  
     {
 77  0
         return exception;
 78  
     }
 79  
 
 80  
     public String toString()
 81  
     {
 82  0
         return "ExceptionMessage{" + "message=" + message + ", context=" + context + "exception=" + exception
 83  
                + ", componentName='" + componentName + "'" + ", endpointUri=" + endpointUri + ", timeStamp="
 84  
                + timeStamp + "}";
 85  
     }
 86  
 }