KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > umo > provider > ConnectorException


1 /*
2  * $Id: ConnectorException.java 3798 2006-11-04 04:07:14Z aperepel $
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 MuleSource MPL
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.provider;
12
13 import org.mule.config.i18n.Message;
14 import org.mule.config.i18n.Messages;
15 import org.mule.umo.UMOException;
16
17 /**
18  * <code>ConnectorException</code> Is thrown in the context of a UMOConnector,
19  * usually some sort of transport level error where the connection has failed. This
20  * exception maintains a reference to the connector.
21  *
22  * @see UMOConnector
23  */

24 public class ConnectorException extends UMOException
25 {
26     /**
27      * Serial version
28      */

29     private static final long serialVersionUID = 4729481487016346035L;
30
31     /**
32      * The connector relevant to this exception
33      */

34     private transient UMOConnector connector;
35
36     /**
37      * @param message the exception message
38      * @param connector where the exception occurred or is being thrown
39      */

40     public ConnectorException(Message message, UMOConnector connector)
41     {
42         super(generateMessage(message, connector));
43         this.connector = connector;
44     }
45
46     /**
47      * @param message the exception message
48      * @param connector where the exception occurred or is being thrown
49      * @param cause the exception that cause this exception to be thrown
50      */

51     public ConnectorException(Message message, UMOConnector connector, Throwable JavaDoc cause)
52     {
53         super(generateMessage(message, connector), cause);
54         this.connector = connector;
55     }
56
57     private static Message generateMessage(Message message, UMOConnector connector)
58     {
59         Message m = new Message(Messages.CONNECTOR_CAUSED_ERROR, connector);
60         if (message != null)
61         {
62             message.setNextMessage(m);
63         }
64         return m;
65     }
66
67     public UMOConnector getConnector()
68     {
69         return connector;
70     }
71 }
72
Popular Tags