1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.example.errorhandler; |
8 | |
|
9 | |
import java.util.HashMap; |
10 | |
import java.util.Map; |
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
public class ErrorMessage |
16 | |
{ |
17 | |
|
18 | |
private ExceptionBean exception; |
19 | |
|
20 | |
private Throwable throwable; |
21 | |
|
22 | 0 | private Map properties = new HashMap(); |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public ErrorMessage() |
28 | |
{ |
29 | 0 | super(); |
30 | 0 | } |
31 | |
|
32 | |
public ErrorMessage(ExceptionBean exception) throws InstantiationException |
33 | 0 | { |
34 | 0 | setException(exception); |
35 | 0 | } |
36 | |
|
37 | |
public ErrorMessage(Throwable exception) |
38 | 0 | { |
39 | 0 | setThrowable(exception); |
40 | 0 | } |
41 | |
|
42 | |
public ErrorMessage(Throwable exception, Map props) |
43 | 0 | { |
44 | 0 | setThrowable(exception); |
45 | 0 | setProperties(props); |
46 | 0 | } |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
public ExceptionBean getException() |
52 | |
{ |
53 | 0 | return exception; |
54 | |
} |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
public void setException(ExceptionBean exception) throws InstantiationException |
60 | |
{ |
61 | 0 | this.exception = exception; |
62 | 0 | throwable = exception.toException(); |
63 | 0 | } |
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
public Map getProperties() |
69 | |
{ |
70 | 0 | return properties; |
71 | |
} |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
public void setProperties(Map properties) |
77 | |
{ |
78 | 0 | this.properties = properties; |
79 | 0 | } |
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
public Throwable getThrowable() |
85 | |
{ |
86 | 0 | return throwable; |
87 | |
} |
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
public void setThrowable(Throwable throwable) |
93 | |
{ |
94 | 0 | this.throwable = throwable; |
95 | 0 | exception = new ExceptionBean(throwable); |
96 | 0 | } |
97 | |
|
98 | |
} |