View Javadoc

1   /*
2    * $Id: LifecycleException.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.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  
23      /** Serial version */
24      private static final long serialVersionUID = 2909614055858287394L;
25  
26      private transient Object component;
27  
28      /**
29       * @param message   the exception message
30       * @param component the object that failed during a lifecycle method call
31       */
32      public LifecycleException(Message message, Object component)
33      {
34          super(message);
35          this.component = component;
36      }
37  
38      /**
39       * @param message   the exception message
40       * @param cause     the exception that cause this exception to be thrown
41       * @param component the object that failed during a lifecycle method call
42       */
43      public LifecycleException(Message message, Throwable cause, Object component)
44      {
45          super(message, cause);
46          this.component = component;
47      }
48  
49      /**
50       * @param cause     the exception that cause this exception to be thrown
51       * @param component the object that failed during a lifecycle method call
52       */
53      public LifecycleException(Throwable cause, Object component)
54      {
55          super(CoreMessages.createStaticMessage(cause.getMessage()), cause);
56          this.component = component;
57          addInfo("Object", ObjectUtils.toString(component, "null"));
58      }
59  
60      public Object getComponent()
61      {
62          return component;
63      }
64  }