1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.transport; |
12 | |
|
13 | |
import org.mule.api.MuleException; |
14 | |
import org.mule.api.endpoint.OutboundEndpoint; |
15 | |
import org.mule.api.transport.MessageDispatcher; |
16 | |
import org.mule.api.transport.MessageDispatcherFactory; |
17 | |
import org.mule.util.ClassUtils; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
public abstract class AbstractMessageDispatcherFactory implements MessageDispatcherFactory |
27 | |
{ |
28 | |
|
29 | |
public AbstractMessageDispatcherFactory() |
30 | |
{ |
31 | 944 | super(); |
32 | 944 | } |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
public boolean isCreateDispatcherPerRequest() |
43 | |
{ |
44 | 8 | return false; |
45 | |
} |
46 | |
|
47 | |
public abstract MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException; |
48 | |
|
49 | |
public void activate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) throws MuleException |
50 | |
{ |
51 | 8 | dispatcher.activate(); |
52 | 8 | } |
53 | |
|
54 | |
public void destroy(OutboundEndpoint endpoint, MessageDispatcher dispatcher) |
55 | |
{ |
56 | 0 | dispatcher.dispose(); |
57 | 0 | } |
58 | |
|
59 | |
public void passivate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) |
60 | |
{ |
61 | 8 | dispatcher.passivate(); |
62 | 8 | } |
63 | |
|
64 | |
public boolean validate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) |
65 | |
{ |
66 | |
|
67 | |
|
68 | |
|
69 | 8 | return (this.isCreateDispatcherPerRequest() ? false : dispatcher.validate()); |
70 | |
} |
71 | |
|
72 | |
|
73 | |
public String toString() |
74 | |
{ |
75 | 0 | final StringBuffer sb = new StringBuffer(60); |
76 | 0 | sb.append(ClassUtils.getSimpleName(this.getClass())); |
77 | 0 | sb.append("{this=").append(Integer.toHexString(System.identityHashCode(this))); |
78 | 0 | sb.append(", createDispatcherPerRequest=").append(this.isCreateDispatcherPerRequest()); |
79 | 0 | sb.append('}'); |
80 | 0 | return sb.toString(); |
81 | |
} |
82 | |
|
83 | |
} |