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: HTTPConversion.java 6998 2007-04-24 01:13:00Z jzhang $
23: *
24: */
25: package com.bostechcorp.cbesb.ui.util.version;
26:
27: import org.jdom.Element;
28:
29: /**
30: *
31: */
32: public class HTTPConversion {
33:
34: public static void convert(Element element, Element http) {
35: Element httpWSDLDocument = element.getChild("httpWSDLDocument");
36:
37: Element newHttpConsumerCCSL;
38: if (httpWSDLDocument.getChild("httpConsumerCCSL") == null) {
39: // 1.1 m1 version
40: newHttpConsumerCCSL = ConversionUtil.convertCCSL(
41: ConversionUtil.CONSUMER, element, "consumerCCSL");
42: } else {
43: newHttpConsumerCCSL = ConversionUtil.createCCSL(
44: ConversionUtil.CONSUMER, httpWSDLDocument
45: .getChild("httpConsumerCCSL"));
46: }
47: Element newHttpProviderCCSL;
48: if (httpWSDLDocument.getChild("httpProviderCCSL") == null) {
49: // 1.1 m1 version
50: newHttpProviderCCSL = ConversionUtil.convertCCSL(
51: ConversionUtil.PROVIDER, element, "providerCCSL");
52: } else {
53: newHttpProviderCCSL = ConversionUtil.createCCSL(
54: ConversionUtil.PROVIDER, httpWSDLDocument
55: .getChild("httpProviderCCSL"));
56: }
57:
58: Element httpClient = httpWSDLDocument.getChild("httpClient");
59: Element httpServer = httpWSDLDocument.getChild("httpServer");
60: Element newHttpProvider = new Element("httpProvider");
61: Element newHttpConsumer = new Element("httpConsumer");
62:
63: if (httpWSDLDocument.getAttributeValue("mode") != null) {
64: if ("both".equals(httpWSDLDocument
65: .getAttributeValue("mode"))) {
66: http.setAttribute("role", "both");
67: }
68: } else {
69: http.setAttribute("role", "provider");
70: }
71:
72: if ("true".equals(httpClient.getChild("httpCientSoap")
73: .getAttributeValue("enabled"))) {
74: newHttpProvider.setAttribute("soapEnabled", "true");
75: newHttpProvider.setAttribute("importedWSDL", httpClient
76: .getChild("httpCientSoap").getAttributeValue(
77: "importedWSDL"));
78: }
79: if ("true".equals(httpServer.getChild("httpServerSoap")
80: .getAttributeValue("enabled"))) {
81: newHttpConsumer.setAttribute("soapEnabled", "true");
82: }
83: ConversionUtil.convertAttribute(httpClient, newHttpProvider);
84: ConversionUtil.convertAttribute(httpServer, newHttpConsumer);
85: Element newConsumerSSL = new Element("SSL");
86: Element newProviderSSL = new Element("SSL");
87: newHttpConsumer.addContent(newConsumerSSL);
88: newHttpProvider.addContent(newProviderSSL);
89: http.addContent(newHttpConsumerCCSL);
90: http.addContent(newHttpProviderCCSL);
91: http.addContent(newHttpConsumer);
92: http.addContent(newHttpProvider);
93: }
94: }
|