1
2
3
4
5
6
7
8
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
23
24
25 public class ExceptionMessage extends BaseMessage
26 {
27
28
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 super(message);
43 this.exception = exception;
44 timeStamp = new Date();
45 this.componentName = componentName;
46 this.endpointUri = endpointUri;
47
48 UMOEventContext ctx = RequestContext.getEventContext();
49 if (ctx != null)
50 {
51 UMOMessage msg = ctx.getMessage();
52 for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();)
53 {
54 String propertyKey = (String) iterator.next();
55 setProperty(propertyKey, msg.getProperty(propertyKey));
56 }
57 }
58 }
59
60 public String getComponentName()
61 {
62 return componentName;
63 }
64
65 public UMOEndpointURI getEndpoint()
66 {
67 return endpointUri;
68 }
69
70 public Date getTimeStamp()
71 {
72 return timeStamp;
73 }
74
75 public Throwable getException()
76 {
77 return exception;
78 }
79
80 public String toString()
81 {
82 return "ExceptionMessage{" + "message=" + message + ", context=" + context + "exception=" + exception
83 + ", componentName='" + componentName + "'" + ", endpointUri=" + endpointUri + ", timeStamp="
84 + timeStamp + "}";
85 }
86 }