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.config.i18n.CoreMessages; |
18 | |
|
19 | |
import org.apache.commons.pool.KeyedPoolableObjectFactory; |
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public class KeyedPoolMessageDispatcherFactoryAdapter |
30 | |
implements MessageDispatcherFactory, KeyedPoolableObjectFactory |
31 | |
{ |
32 | |
private final MessageDispatcherFactory factory; |
33 | |
|
34 | |
public KeyedPoolMessageDispatcherFactoryAdapter(MessageDispatcherFactory factory) |
35 | |
{ |
36 | 946 | super(); |
37 | |
|
38 | 946 | if (factory == null) |
39 | |
{ |
40 | 2 | throw new IllegalArgumentException(CoreMessages.objectIsNull("factory").toString()); |
41 | |
} |
42 | |
|
43 | 944 | this.factory = factory; |
44 | 944 | } |
45 | |
|
46 | |
public void activateObject(Object key, Object obj) throws Exception |
47 | |
{ |
48 | 8 | factory.activate((OutboundEndpoint) key, (MessageDispatcher) obj); |
49 | 8 | } |
50 | |
|
51 | |
public void destroyObject(Object key, Object obj) throws Exception |
52 | |
{ |
53 | 0 | factory.destroy((OutboundEndpoint) key, (MessageDispatcher) obj); |
54 | 0 | } |
55 | |
|
56 | |
public Object makeObject(Object key) throws Exception |
57 | |
{ |
58 | 2 | return factory.create((OutboundEndpoint) key); |
59 | |
} |
60 | |
|
61 | |
public void passivateObject(Object key, Object obj) throws Exception |
62 | |
{ |
63 | 8 | factory.passivate((OutboundEndpoint) key, (MessageDispatcher) obj); |
64 | 8 | } |
65 | |
|
66 | |
public boolean validateObject(Object key, Object obj) |
67 | |
{ |
68 | 8 | return factory.validate((OutboundEndpoint) key, (MessageDispatcher) obj); |
69 | |
} |
70 | |
|
71 | |
public boolean isCreateDispatcherPerRequest() |
72 | |
{ |
73 | 0 | return factory.isCreateDispatcherPerRequest(); |
74 | |
} |
75 | |
|
76 | |
public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException |
77 | |
{ |
78 | 0 | return factory.create(endpoint); |
79 | |
} |
80 | |
|
81 | |
public void activate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) throws MuleException |
82 | |
{ |
83 | 0 | factory.activate(endpoint, dispatcher); |
84 | 0 | } |
85 | |
|
86 | |
public void destroy(OutboundEndpoint endpoint, MessageDispatcher dispatcher) |
87 | |
{ |
88 | 0 | factory.destroy(endpoint, dispatcher); |
89 | 0 | } |
90 | |
|
91 | |
public void passivate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) |
92 | |
{ |
93 | 0 | factory.passivate(endpoint, dispatcher); |
94 | 0 | } |
95 | |
|
96 | |
public boolean validate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) |
97 | |
{ |
98 | 0 | return factory.validate(endpoint, dispatcher); |
99 | |
} |
100 | |
|
101 | |
} |