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