KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: ReceiveException.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.apache.commons.lang.ObjectUtils;
14 import org.mule.config.i18n.Message;
15 import org.mule.config.i18n.Messages;
16 import org.mule.umo.UMOException;
17 import org.mule.umo.endpoint.UMOImmutableEndpoint;
18
19 /**
20  * <code>ReceiveException</code> is specifically thrown by the Provider receive
21  * method if something fails in the underlying transport
22  *
23  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
24  * @version $Revision: 3798 $
25  */

26 public class ReceiveException extends UMOException
27 {
28     /**
29      * Serial version
30      */

31     private static final long serialVersionUID = 1960304517882133951L;
32
33     private UMOImmutableEndpoint endpoint;
34
35     /**
36      * @param message the exception message
37      */

38     public ReceiveException(Message message, UMOImmutableEndpoint endpoint, long timeout)
39     {
40         super(message);
41         this.endpoint = endpoint;
42         addInfo("Endpoint", ObjectUtils.toString(this.endpoint, "null"));
43         addInfo("Timeout", String.valueOf(timeout));
44     }
45
46     /**
47      * @param message the exception message
48      * @param cause the exception that cause this exception to be thrown
49      */

50     public ReceiveException(Message message, UMOImmutableEndpoint endpoint, long timeout, Throwable JavaDoc cause)
51     {
52         super(message, cause);
53         this.endpoint = endpoint;
54         addInfo("Endpoint", ObjectUtils.toString(this.endpoint, "null"));
55         addInfo("Timeout", String.valueOf(timeout));
56     }
57
58     public ReceiveException(UMOImmutableEndpoint endpoint, long timeout, Throwable JavaDoc cause)
59     {
60         this(new Message(Messages.FAILED_TO_RECEIVE_OVER_X_TIMEOUT_X, endpoint, String.valueOf(timeout)),
61             endpoint, timeout, cause);
62     }
63
64 }
65
Popular Tags