1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.providers.jbi; |
12 | |
|
13 | |
import org.mule.providers.AbstractConnector; |
14 | |
import org.mule.umo.UMOException; |
15 | |
import org.mule.umo.lifecycle.InitialisationException; |
16 | |
|
17 | |
import javax.jbi.JBIException; |
18 | |
import javax.jbi.component.ComponentContext; |
19 | |
import javax.jbi.component.ComponentLifeCycle; |
20 | |
import javax.jbi.messaging.DeliveryChannel; |
21 | |
import javax.jbi.messaging.MessageExchangeFactory; |
22 | |
import javax.management.ObjectName; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | 0 | public class JbiConnector extends AbstractConnector implements ComponentLifeCycle |
29 | |
{ |
30 | |
private ObjectName extensionMBeanName; |
31 | |
private ComponentContext context; |
32 | |
private DeliveryChannel deliveryChannel; |
33 | |
private MessageExchangeFactory exchangeFactory; |
34 | |
|
35 | |
|
36 | |
protected void doInitialise() throws InitialisationException |
37 | |
{ |
38 | |
|
39 | 0 | } |
40 | |
|
41 | |
protected void doDispose() |
42 | |
{ |
43 | |
|
44 | 0 | } |
45 | |
|
46 | |
protected void doConnect() throws Exception |
47 | |
{ |
48 | |
|
49 | 0 | } |
50 | |
|
51 | |
protected void doDisconnect() throws Exception |
52 | |
{ |
53 | |
|
54 | 0 | } |
55 | |
|
56 | |
protected void doStart() throws UMOException |
57 | |
{ |
58 | |
|
59 | 0 | } |
60 | |
|
61 | |
protected void doStop() throws UMOException |
62 | |
{ |
63 | |
|
64 | 0 | } |
65 | |
|
66 | |
public String getProtocol() |
67 | |
{ |
68 | 0 | return "jbi"; |
69 | |
} |
70 | |
|
71 | |
public ObjectName getExtensionMBeanName() |
72 | |
{ |
73 | 0 | return extensionMBeanName; |
74 | |
} |
75 | |
|
76 | |
public void setExtensionMBeanName(ObjectName extensionMBeanName) |
77 | |
{ |
78 | 0 | this.extensionMBeanName = extensionMBeanName; |
79 | 0 | } |
80 | |
|
81 | |
public ComponentContext getComponentContext() |
82 | |
{ |
83 | 0 | return context; |
84 | |
} |
85 | |
|
86 | |
public DeliveryChannel getDeliveryChannel() |
87 | |
{ |
88 | 0 | return deliveryChannel; |
89 | |
} |
90 | |
|
91 | |
public MessageExchangeFactory getExchangeFactory() |
92 | |
{ |
93 | 0 | return exchangeFactory; |
94 | |
} |
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
public void init(ComponentContext componentContext) throws JBIException |
102 | |
{ |
103 | 0 | this.context = componentContext; |
104 | 0 | this.deliveryChannel = context.getDeliveryChannel(); |
105 | 0 | this.exchangeFactory = deliveryChannel.createExchangeFactory(); |
106 | 0 | } |
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
public void start() |
112 | |
{ |
113 | |
try |
114 | |
{ |
115 | 0 | startConnector(); |
116 | |
} |
117 | 0 | catch (UMOException e) |
118 | |
{ |
119 | 0 | handleException(e); |
120 | 0 | } |
121 | 0 | } |
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
public void stop() |
127 | |
{ |
128 | |
try |
129 | |
{ |
130 | 0 | stopConnector(); |
131 | |
} |
132 | 0 | catch (UMOException e) |
133 | |
{ |
134 | 0 | handleException(e); |
135 | 0 | } |
136 | 0 | } |
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
public void shutDown() throws JBIException |
142 | |
{ |
143 | |
|
144 | 0 | } |
145 | |
|
146 | |
} |