1 10 11 package org.mule.providers.jbi; 12 13 import org.mule.providers.AbstractServiceEnabledConnector; 14 import org.mule.umo.UMOException; 15 16 import javax.jbi.JBIException; 17 import javax.jbi.component.ComponentContext; 18 import javax.jbi.component.ComponentLifeCycle; 19 import javax.jbi.messaging.DeliveryChannel; 20 import javax.jbi.messaging.MessageExchangeFactory; 21 import javax.management.ObjectName ; 22 23 30 public class JbiConnector extends AbstractServiceEnabledConnector implements ComponentLifeCycle 31 { 32 33 private ObjectName extensionMBeanName; 34 private ComponentContext context; 35 private DeliveryChannel deliveryChannel; 36 private MessageExchangeFactory exchangeFactory; 37 38 public String getProtocol() 39 { 40 return "jbi"; 41 } 42 43 public ObjectName getExtensionMBeanName() 44 { 45 return extensionMBeanName; 46 } 47 48 public void setExtensionMBeanName(ObjectName extensionMBeanName) 49 { 50 this.extensionMBeanName = extensionMBeanName; 51 } 52 53 public ComponentContext getComponentContext() 54 { 55 return context; 56 } 57 58 public DeliveryChannel getDeliveryChannel() 59 { 60 return deliveryChannel; 61 } 62 63 public MessageExchangeFactory getExchangeFactory() 64 { 65 return exchangeFactory; 66 } 67 68 71 public void init(ComponentContext componentContext) throws JBIException 72 { 73 this.context = componentContext; 74 this.deliveryChannel = context.getDeliveryChannel(); 75 this.exchangeFactory = deliveryChannel.createExchangeFactory(); 76 } 77 78 public void start() 79 { 80 try 81 { 82 startConnector(); 83 } 84 catch (UMOException e) 85 { 86 handleException(e); 87 } 88 } 89 90 public void stop() 91 { 92 try 93 { 94 stopConnector(); 95 } 96 catch (UMOException e) 97 { 98 handleException(e); 99 } 100 } 101 102 public void shutDown() throws JBIException 103 { 104 } 106 } 107 | Popular Tags |