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 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 }
40
41 protected void doDispose()
42 {
43
44 }
45
46 protected void doConnect() throws Exception
47 {
48
49 }
50
51 protected void doDisconnect() throws Exception
52 {
53
54 }
55
56 protected void doStart() throws UMOException
57 {
58
59 }
60
61 protected void doStop() throws UMOException
62 {
63
64 }
65
66 public String getProtocol()
67 {
68 return "jbi";
69 }
70
71 public ObjectName getExtensionMBeanName()
72 {
73 return extensionMBeanName;
74 }
75
76 public void setExtensionMBeanName(ObjectName extensionMBeanName)
77 {
78 this.extensionMBeanName = extensionMBeanName;
79 }
80
81 public ComponentContext getComponentContext()
82 {
83 return context;
84 }
85
86 public DeliveryChannel getDeliveryChannel()
87 {
88 return deliveryChannel;
89 }
90
91 public MessageExchangeFactory getExchangeFactory()
92 {
93 return exchangeFactory;
94 }
95
96
97
98
99
100
101 public void init(ComponentContext componentContext) throws JBIException
102 {
103 this.context = componentContext;
104 this.deliveryChannel = context.getDeliveryChannel();
105 this.exchangeFactory = deliveryChannel.createExchangeFactory();
106 }
107
108
109
110
111 public void start()
112 {
113 try
114 {
115 startConnector();
116 }
117 catch (UMOException e)
118 {
119 handleException(e);
120 }
121 }
122
123
124
125
126 public void stop()
127 {
128 try
129 {
130 stopConnector();
131 }
132 catch (UMOException e)
133 {
134 handleException(e);
135 }
136 }
137
138
139
140
141 public void shutDown() throws JBIException
142 {
143
144 }
145
146 }