1 17 package org.apache.servicemix.jbi.config; 18 19 import org.apache.commons.logging.Log; 20 import org.apache.commons.logging.LogFactory; 21 import org.apache.servicemix.jbi.config.spring.ElementProcessor; 22 import org.apache.servicemix.jbi.config.spring.QNameElementProcessor; 23 import org.apache.servicemix.jbi.util.DOMUtil; 24 import org.springframework.beans.factory.support.BeanDefinitionReader; 25 import org.w3c.dom.Element ; 26 27 32 public class SubscriptionElementProcessor extends QNameElementProcessor implements ElementProcessor { 33 private static final Log log = LogFactory.getLog(SubscriptionElementProcessor.class); 34 35 public void processElement(Element element, BeanDefinitionReader beanDefinitionReader) { 36 Element root = (Element ) element.getParentNode(); 38 Element registration = addBeanElement(root, "org.apache.servicemix.jbi.container.SubscriptionSpec"); 39 40 String service = element.getAttribute("service"); 42 if (service != null) { 43 element.removeAttribute("service"); 44 addQNameProperty(registration, "service", service, element); 45 } 46 String interfaceName = element.getAttribute("interface"); 47 if (interfaceName != null) { 48 element.removeAttribute("interface"); 49 addQNameProperty(registration, "interfaceName", interfaceName, element); 50 } 51 String operation = element.getAttribute("operation"); 52 if (operation != null) { 53 element.removeAttribute("operation"); 54 addQNameProperty(registration, "operation", operation, element); 55 } 56 57 String endpoint = element.getAttribute("endpoint"); 58 if (endpoint != null) { 59 element.removeAttribute("endpoint"); 60 if (endpoint.length() > 0) { 61 addPropertyElement(registration, "endpoint", endpoint); 62 } 63 } 64 65 DOMUtil.copyAttributes(element, registration); 66 DOMUtil.moveContent(element, registration); 67 root.removeChild(element); 68 69 logXmlGenerated(log, "subscription generated", registration); 70 } 71 } 72 | Popular Tags |