View Javadoc

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