1 package org.objectweb.celtix.tools.extensions.jms; 2 3 import org.w3c.dom.*; 4 5 import org.objectweb.celtix.helpers.XMLUtils; 6 import org.objectweb.celtix.tools.common.ToolConstants; 7 8 public class JMSAddressParser { 9 10 private XMLUtils xmlUtils = new XMLUtils(); 11 12 public void parseElement(JMSAddress jmsAddress, Element element) { 13 try { 14 Attr jndiURL = xmlUtils.getAttribute(element, ToolConstants.JMS_ADDR_JNDI_URL); 15 if (jndiURL != null) { 16 jmsAddress.setJndiProviderURL(jndiURL.getValue()); 17 } 18 19 Attr destStyle = xmlUtils.getAttribute(element, ToolConstants.JMS_ADDR_DEST_STYLE); 20 if (destStyle != null) { 21 jmsAddress.setDestinationStyle(destStyle.getValue()); 22 } 23 24 Attr initCtx = xmlUtils.getAttribute(element, ToolConstants.JMS_ADDR_INIT_CTX); 25 if (initCtx != null) { 26 jmsAddress.setInitialContextFactory(initCtx.getValue()); 27 } 28 29 Attr jndiDest = xmlUtils.getAttribute(element, ToolConstants.JMS_ADDR_JNDI_DEST); 30 if (jndiDest != null) { 31 jmsAddress.setJndiDestinationName(jndiDest.getValue()); 32 } 33 34 Attr jndiFac = xmlUtils.getAttribute(element, ToolConstants.JMS_ADDR_JNDI_FAC); 35 if (jndiFac != null) { 36 jmsAddress.setJndiConnectionFactoryName(jndiFac.getValue()); 37 } 38 39 Attr msgType = xmlUtils.getAttribute(element, ToolConstants.JMS_ADDR_MSG_TYPE); 40 if (msgType != null) { 41 jmsAddress.setMessageType(msgType.getValue()); 42 } 43 44 Attr msgID = xmlUtils.getAttribute(element, ToolConstants.JMS_ADDR_MSGID_TO_CORRID); 45 if (msgID != null) { 46 jmsAddress.setUseMessageIDAsCorrelationID(Boolean.parseBoolean(msgID.getValue())); 47 } 48 49 Attr subsName = xmlUtils.getAttribute(element, ToolConstants.JMS_ADDR_SUBSCRIBER_NAME); 50 if (subsName != null) { 51 jmsAddress.setDurableSubscriberName(subsName.getValue()); 52 } 53 54 } catch (Exception e) { 55 e.printStackTrace(); 56 } 57 } 58 } 59 | Popular Tags |