01: /*
02: * $Id: ErrorMessage.java 10789 2008-02-12 20:04:43Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.example.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: // Bean representing the Exception
21: private ExceptionBean exception;
22: // The exception itself, in its primitive state
23: private Throwable throwable;
24: // Properties for this object
25: private Map properties = new HashMap();
26:
27: /**
28: *
29: */
30: public ErrorMessage() {
31: super ();
32: }
33:
34: public ErrorMessage(ExceptionBean exception)
35: throws InstantiationException {
36: setException(exception);
37: }
38:
39: public ErrorMessage(Throwable exception) {
40: setThrowable(exception);
41: }
42:
43: public ErrorMessage(Throwable exception, Map props) {
44: setThrowable(exception);
45: setProperties(props);
46: }
47:
48: /**
49: * @return Returns the exception.
50: */
51: public ExceptionBean getException() {
52: return exception;
53: }
54:
55: /**
56: * @param exception The exception to set.
57: */
58: public void setException(ExceptionBean exception)
59: throws InstantiationException {
60: this .exception = exception;
61: throwable = exception.toException();
62: }
63:
64: /**
65: * @return Returns the properties.
66: */
67: public Map getProperties() {
68: return properties;
69: }
70:
71: /**
72: * @param properties The properties to set.
73: */
74: public void setProperties(Map properties) {
75: this .properties = properties;
76: }
77:
78: /**
79: * @return Returns the throwable.
80: */
81: public Throwable getThrowable() {
82: return throwable;
83: }
84:
85: /**
86: * @param throwable The throwable to set.
87: */
88: public void setThrowable(Throwable throwable) {
89: this .throwable = throwable;
90: exception = new ExceptionBean(throwable);
91: }
92:
93: }
|