KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > tck > testmodels > mule > TestMessageDispatcher


1 /*
2  * $Id: TestMessageDispatcher.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.tck.testmodels.mule;
12
13 import org.mule.providers.AbstractMessageDispatcher;
14 import org.mule.umo.UMOEvent;
15 import org.mule.umo.UMOMessage;
16 import org.mule.umo.UMOException;
17 import org.mule.umo.routing.RoutingException;
18 import org.mule.umo.endpoint.UMOImmutableEndpoint;
19
20 /**
21  * todo document
22  *
23  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
24  * @version $Revision: 3798 $
25  */

26 public class TestMessageDispatcher extends AbstractMessageDispatcher
27 {
28
29     public TestMessageDispatcher(final UMOImmutableEndpoint endpoint)
30     {
31         super(endpoint);
32     }
33
34     protected void doDispose()
35     {
36         // template method
37
}
38
39     protected void doDispatch(UMOEvent event) throws Exception JavaDoc
40     {
41         if (event.getEndpoint().getEndpointURI().toString().equals("test://AlwaysFail"))
42         {
43             throw new RoutingException(event.getMessage(), event.getEndpoint());
44         }
45     }
46
47     protected UMOMessage doSend(UMOEvent event) throws Exception JavaDoc
48     {
49         if (event.getEndpoint().getEndpointURI().toString().equals("test://AlwaysFail"))
50         {
51             throw new RoutingException(event.getMessage(), event.getEndpoint());
52         }
53         return event.getMessage();
54     }
55
56     public UMOMessage doReceive(UMOImmutableEndpoint endpoint, long timeout) throws Exception JavaDoc
57     {
58         return null;
59     }
60
61     public Object JavaDoc getDelegateSession() throws UMOException
62     {
63         return null;
64     }
65
66     protected void doConnect(UMOImmutableEndpoint endpoint) throws Exception JavaDoc
67     {
68         // no op
69
}
70
71     protected void doDisconnect() throws Exception JavaDoc
72     {
73         // no op
74
}
75
76 }
77
Popular Tags