Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ErrorMessage |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: ErrorMessage.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.samples.errorhandler; | |
12 | ||
13 | import java.util.HashMap; | |
14 | import java.util.Map; | |
15 | ||
16 | /** | |
17 | * The <code>ErrorMessage</code> represents an exception. | |
18 | */ | |
19 | public class ErrorMessage | |
20 | { | |
21 | // Bean representing the Exception | |
22 | private ExceptionBean exception; | |
23 | // The exception itself, in its primitive state | |
24 | private Throwable throwable; | |
25 | // Properties for this object | |
26 | 0 | private Map properties = new HashMap(); |
27 | ||
28 | /** | |
29 | * | |
30 | */ | |
31 | public ErrorMessage() | |
32 | { | |
33 | 0 | super(); |
34 | 0 | } |
35 | ||
36 | public ErrorMessage(ExceptionBean exception) throws InstantiationException | |
37 | 0 | { |
38 | 0 | setException(exception); |
39 | 0 | } |
40 | ||
41 | public ErrorMessage(Throwable exception) | |
42 | 0 | { |
43 | 0 | setThrowable(exception); |
44 | 0 | } |
45 | ||
46 | public ErrorMessage(Throwable exception, Map props) | |
47 | 0 | { |
48 | 0 | setThrowable(exception); |
49 | 0 | setProperties(props); |
50 | 0 | } |
51 | ||
52 | /** | |
53 | * @return Returns the exception. | |
54 | */ | |
55 | public ExceptionBean getException() | |
56 | { | |
57 | 0 | return exception; |
58 | } | |
59 | ||
60 | /** | |
61 | * @param exception The exception to set. | |
62 | */ | |
63 | public void setException(ExceptionBean exception) throws InstantiationException | |
64 | { | |
65 | 0 | this.exception = exception; |
66 | 0 | throwable = exception.toException(); |
67 | 0 | } |
68 | ||
69 | /** | |
70 | * @return Returns the properties. | |
71 | */ | |
72 | public Map getProperties() | |
73 | { | |
74 | 0 | return properties; |
75 | } | |
76 | ||
77 | /** | |
78 | * @param properties The properties to set. | |
79 | */ | |
80 | public void setProperties(Map properties) | |
81 | { | |
82 | 0 | this.properties = properties; |
83 | 0 | } |
84 | ||
85 | /** | |
86 | * @return Returns the throwable. | |
87 | */ | |
88 | public Throwable getThrowable() | |
89 | { | |
90 | 0 | return throwable; |
91 | } | |
92 | ||
93 | /** | |
94 | * @param throwable The throwable to set. | |
95 | */ | |
96 | public void setThrowable(Throwable throwable) | |
97 | { | |
98 | 0 | this.throwable = throwable; |
99 | 0 | exception = new ExceptionBean(throwable); |
100 | 0 | } |
101 | ||
102 | } |