KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > umo > routing > ComponentRoutingException


1 /*
2  * $Id: ComponentRoutingException.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.routing;
12
13 import org.mule.config.i18n.Message;
14 import org.mule.config.i18n.Messages;
15 import org.mule.umo.UMOComponent;
16 import org.mule.umo.UMOMessage;
17 import org.mule.umo.endpoint.UMOImmutableEndpoint;
18
19 /**
20  * <code>ComponentRoutingException</code> is thrown due to a routing exception
21  * between the endpoint the event was received on and the component receiving the
22  * event
23  *
24  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
25  * @version $Revision: 3798 $
26  */

27 public class ComponentRoutingException extends RoutingException
28 {
29     /**
30      * Serial version
31      */

32     private static final long serialVersionUID = -113944443831267318L;
33
34     private transient UMOComponent component;
35
36     public ComponentRoutingException(Message message,
37                                      UMOMessage umoMessage,
38                                      UMOImmutableEndpoint endpoint,
39                                      UMOComponent component)
40     {
41         super(generateMessage(message, endpoint, component), umoMessage, endpoint);
42         this.component = component;
43     }
44
45     public ComponentRoutingException(Message message,
46                                      UMOMessage umoMessage,
47                                      UMOImmutableEndpoint endpoint,
48                                      UMOComponent component,
49                                      Throwable JavaDoc cause)
50     {
51         super(generateMessage(message, endpoint, component), umoMessage, endpoint, cause);
52         this.component = component;
53     }
54
55     public ComponentRoutingException(UMOMessage umoMessage,
56                                      UMOImmutableEndpoint endpoint,
57                                      UMOComponent component)
58     {
59         super(generateMessage(null, endpoint, component), umoMessage, endpoint);
60         this.component = component;
61     }
62
63     public ComponentRoutingException(UMOMessage umoMessage,
64                                      UMOImmutableEndpoint endpoint,
65                                      UMOComponent component,
66                                      Throwable JavaDoc cause)
67     {
68         super(generateMessage(null, endpoint, component), umoMessage, endpoint, cause);
69         this.component = component;
70
71     }
72
73     private static Message generateMessage(Message message,
74                                            UMOImmutableEndpoint endpoint,
75                                            UMOComponent component)
76     {
77
78         Message m = new Message(Messages.COMPONENT_X_ROUTING_FAILED_ON_ENDPOINT_X, component.getDescriptor()
79             .getName(), endpoint.getEndpointURI());
80         if (message != null)
81         {
82             message.setNextMessage(m);
83             return message;
84         }
85         else
86         {
87             return m;
88         }
89     }
90
91     public UMOComponent getComponent()
92     {
93         return component;
94     }
95 }
96
Popular Tags