01: /*
02: * $Id: LifecycleException.java 10808 2008-02-14 20:36:57Z acooke $
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.api.lifecycle;
12:
13: import org.mule.api.MuleException;
14: import org.mule.config.i18n.CoreMessages;
15: import org.mule.config.i18n.Message;
16: import org.mule.util.ObjectUtils;
17:
18: /** <code>LifecycleException</code> TODO */
19:
20: public class LifecycleException extends MuleException {
21:
22: /** Serial version */
23: private static final long serialVersionUID = 2909614055858287394L;
24:
25: private transient Object component;
26:
27: /**
28: * @param message the exception message
29: * @param service the object that failed during a lifecycle method call
30: */
31: public LifecycleException(Message message, Object component) {
32: super (message);
33: this .component = component;
34: }
35:
36: /**
37: * @param message the exception message
38: * @param cause the exception that cause this exception to be thrown
39: * @param service the object that failed during a lifecycle method call
40: */
41: public LifecycleException(Message message, Throwable cause,
42: Object component) {
43: super (message, cause);
44: this .component = component;
45: }
46:
47: /**
48: * @param cause the exception that cause this exception to be thrown
49: * @param service the object that failed during a lifecycle method call
50: */
51: public LifecycleException(Throwable cause, Object component) {
52: super (CoreMessages.initialisationFailure(cause.getMessage()),
53: cause);
54: this .component = component;
55: addInfo("Object", ObjectUtils.toString(component, "null"));
56: }
57:
58: public Object getComponent() {
59: return component;
60: }
61: }
|