1 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 28 public class ExceptionMessage extends BaseMessage 29 { 30 33 private static final long serialVersionUID = -538516243574950621L; 34 35 private Throwable exception; 36 private String componentName; 37 private UMOEndpointURI endpointUri; 38 private Date timeStamp; 39 40 public ExceptionMessage(Object message, 41 Throwable exception, 42 String componentName, 43 UMOEndpointURI endpointUri) 44 { 45 super(message); 46 this.exception = exception; 47 timeStamp = new Date (); 48 this.componentName = componentName; 49 this.endpointUri = endpointUri; 50 51 UMOEventContext ctx = RequestContext.getEventContext(); 52 if (ctx != null) 53 { 54 UMOMessage msg = ctx.getMessage(); 55 for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) 56 { 57 String propertyKey = (String )iterator.next(); 58 setProperty(propertyKey, msg.getProperty(propertyKey)); 59 } 60 } 61 } 62 63 public String getComponentName() 64 { 65 return componentName; 66 } 67 68 public UMOEndpointURI getEndpoint() 69 { 70 return endpointUri; 71 } 72 73 public Date getTimeStamp() 74 { 75 return timeStamp; 76 } 77 78 public Throwable getException() 79 { 80 return exception; 81 } 82 83 public String toString() 84 { 85 return "ExceptionMessage{" + "message=" + message + ", context=" + context + "exception=" + exception 86 + ", componentName='" + componentName + "'" + ", endpointUri=" + endpointUri + ", timeStamp=" 87 + timeStamp + "}"; 88 } 89 } 90 | Popular Tags |