01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU General Public License as published by
09: * the Free Software Foundation; either version 2 of the License, or
10: * (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
20: * USA
21: *
22: * $Id: JMSConversion.java 7866 2007-06-14 08:36:59Z jzhang $
23: *
24: */
25: package com.bostechcorp.cbesb.ui.util.version;
26:
27: import org.jdom.Element;
28:
29: /**
30: *
31: */
32: public class JMSConversion {
33:
34: public static void convert(Element element, Element jms) {
35: Element jmsWSDLDocument = element.getChild("jmsWSDLDocument");
36:
37: Element newConsumerCCSL;
38: if (jmsWSDLDocument.getChild("jmsConsumerCCSL") == null) {
39: newConsumerCCSL = ConversionUtil.convertCCSL(
40: ConversionUtil.CONSUMER, element, "consumerCCSL");
41: } else {
42: newConsumerCCSL = ConversionUtil.createCCSL(
43: ConversionUtil.CONSUMER, jmsWSDLDocument
44: .getChild("jmsConsumerCCSL"));
45: }
46: Element newProviderCCSL;
47: if (jmsWSDLDocument.getChild("jmsProviderCCSL") == null) {
48: newProviderCCSL = ConversionUtil.convertCCSL(
49: ConversionUtil.PROVIDER, element, "consumerCCSL");
50: } else {
51: newProviderCCSL = ConversionUtil.createCCSL(
52: ConversionUtil.PROVIDER, jmsWSDLDocument
53: .getChild("jmsProviderCCSL"));
54: }
55:
56: if (jmsWSDLDocument.getAttributeValue("role") != null) {
57: if ("both"
58: .equals(jmsWSDLDocument.getAttributeValue("role"))) {
59: jms.setAttribute("role", "both");
60: } else {
61: jms.setAttribute("role", "provider");
62: }
63: }
64:
65: Element newJmsConsumer = new Element("jmsConsumer");
66: Element newJmsProvider = new Element("jmsProvider");
67:
68: ConversionUtil.convertAttribute(jmsWSDLDocument
69: .getChild("jmsConsumer"), newJmsConsumer);
70: ConversionUtil.convertAttribute(jmsWSDLDocument
71: .getChild("jmsProvider"), newJmsProvider);
72:
73: jms.addContent(newConsumerCCSL);
74: jms.addContent(newProviderCCSL);
75: jms.addContent(newJmsConsumer);
76: jms.addContent(newJmsProvider);
77: }
78: }
|