01: package org.objectweb.celtix.tools.extensions.jms;
02:
03: import org.w3c.dom.*;
04:
05: import org.objectweb.celtix.helpers.XMLUtils;
06: import org.objectweb.celtix.tools.common.ToolConstants;
07:
08: public class JMSAddressParser {
09:
10: private XMLUtils xmlUtils = new XMLUtils();
11:
12: public void parseElement(JMSAddress jmsAddress, Element element) {
13: try {
14: Attr jndiURL = xmlUtils.getAttribute(element,
15: ToolConstants.JMS_ADDR_JNDI_URL);
16: if (jndiURL != null) {
17: jmsAddress.setJndiProviderURL(jndiURL.getValue());
18: }
19:
20: Attr destStyle = xmlUtils.getAttribute(element,
21: ToolConstants.JMS_ADDR_DEST_STYLE);
22: if (destStyle != null) {
23: jmsAddress.setDestinationStyle(destStyle.getValue());
24: }
25:
26: Attr initCtx = xmlUtils.getAttribute(element,
27: ToolConstants.JMS_ADDR_INIT_CTX);
28: if (initCtx != null) {
29: jmsAddress.setInitialContextFactory(initCtx.getValue());
30: }
31:
32: Attr jndiDest = xmlUtils.getAttribute(element,
33: ToolConstants.JMS_ADDR_JNDI_DEST);
34: if (jndiDest != null) {
35: jmsAddress.setJndiDestinationName(jndiDest.getValue());
36: }
37:
38: Attr jndiFac = xmlUtils.getAttribute(element,
39: ToolConstants.JMS_ADDR_JNDI_FAC);
40: if (jndiFac != null) {
41: jmsAddress.setJndiConnectionFactoryName(jndiFac
42: .getValue());
43: }
44:
45: Attr msgType = xmlUtils.getAttribute(element,
46: ToolConstants.JMS_ADDR_MSG_TYPE);
47: if (msgType != null) {
48: jmsAddress.setMessageType(msgType.getValue());
49: }
50:
51: Attr msgID = xmlUtils.getAttribute(element,
52: ToolConstants.JMS_ADDR_MSGID_TO_CORRID);
53: if (msgID != null) {
54: jmsAddress.setUseMessageIDAsCorrelationID(Boolean
55: .parseBoolean(msgID.getValue()));
56: }
57:
58: Attr subsName = xmlUtils.getAttribute(element,
59: ToolConstants.JMS_ADDR_SUBSCRIBER_NAME);
60: if (subsName != null) {
61: jmsAddress
62: .setDurableSubscriberName(subsName.getValue());
63: }
64:
65: } catch (Exception e) {
66: e.printStackTrace();
67: }
68: }
69: }
|