/*
* ChainBuilder ESB
* Visual Enterprise Integration
*
* Copyright (C) 2006 Bostech Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: HTTPConversion.java 6998 2007-04-24 01:13:00Z jzhang $
*
*/
package com.bostechcorp.cbesb.ui.util.version;
import org.jdom.Element;
/**
*
*/
public class HTTPConversion {
public static void convert(Element element, Element http) {
Element httpWSDLDocument = element.getChild("httpWSDLDocument");
Element newHttpConsumerCCSL;
if (httpWSDLDocument.getChild("httpConsumerCCSL") == null) {
// 1.1 m1 version
newHttpConsumerCCSL = ConversionUtil.convertCCSL(ConversionUtil.CONSUMER, element, "consumerCCSL");
} else {
newHttpConsumerCCSL = ConversionUtil.createCCSL(ConversionUtil.CONSUMER, httpWSDLDocument.getChild("httpConsumerCCSL"));
}
Element newHttpProviderCCSL;
if (httpWSDLDocument.getChild("httpProviderCCSL") == null) {
// 1.1 m1 version
newHttpProviderCCSL = ConversionUtil.convertCCSL(ConversionUtil.PROVIDER, element, "providerCCSL");
} else {
newHttpProviderCCSL = ConversionUtil.createCCSL(ConversionUtil.PROVIDER, httpWSDLDocument.getChild("httpProviderCCSL"));
}
Element httpClient = httpWSDLDocument.getChild("httpClient");
Element httpServer = httpWSDLDocument.getChild("httpServer");
Element newHttpProvider = new Element("httpProvider");
Element newHttpConsumer = new Element("httpConsumer");
if (httpWSDLDocument.getAttributeValue("mode") != null) {
if ("both".equals(httpWSDLDocument.getAttributeValue("mode"))) {
http.setAttribute("role", "both");
}
} else {
http.setAttribute("role", "provider");
}
if ("true".equals(httpClient.getChild("httpCientSoap").getAttributeValue("enabled"))) {
newHttpProvider.setAttribute("soapEnabled", "true");
newHttpProvider.setAttribute("importedWSDL", httpClient.getChild("httpCientSoap").getAttributeValue("importedWSDL"));
}
if ("true".equals(httpServer.getChild("httpServerSoap").getAttributeValue("enabled"))) {
newHttpConsumer.setAttribute("soapEnabled", "true");
}
ConversionUtil.convertAttribute(httpClient, newHttpProvider);
ConversionUtil.convertAttribute(httpServer, newHttpConsumer);
Element newConsumerSSL = new Element("SSL");
Element newProviderSSL = new Element("SSL");
newHttpConsumer.addContent(newConsumerSSL);
newHttpProvider.addContent(newProviderSSL);
http.addContent(newHttpConsumerCCSL);
http.addContent(newHttpProviderCCSL);
http.addContent(newHttpConsumer);
http.addContent(newHttpProvider);
}
}
|