Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 94938 invoked from network); 9 Jun 2006 07:17:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Jun 2006 07:17:59 -0000 Received: (qmail 53454 invoked by uid 500); 9 Jun 2006 07:17:58 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 53360 invoked by uid 500); 9 Jun 2006 07:17:58 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 53349 invoked by uid 500); 9 Jun 2006 07:17:57 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 53346 invoked by uid 99); 9 Jun 2006 07:17:57 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2006 00:17:57 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2006 00:17:56 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 8F26F1A983A; Fri, 9 Jun 2006 00:17:36 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r412959 - in /webservices/axis2/trunk/java/modules: adb-codegen/src/org/apache/axis2/schema/ codegen/src/org/apache/axis2/wsdl/codegen/ codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/codegen/writer/ cod... Date: Fri, 09 Jun 2006 07:17:34 -0000 To: axis2-cvs@ws.apache.org From: ajith@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060609071736.8F26F1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ajith Date: Fri Jun 9 00:17:34 2006 New Revision: 412959 URL: http://svn.apache.org/viewvc?rev=412959&view=rev Log: 1. Added the WSDL20Writer.java to write the WSDL version 2 documents 2. Changed the CodeGenConfiguration to include the WSDL version 3. Changed the AxisServiceBasedMultiLanguageEmitter to switch the WSDL write depending on the version Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java - copied, changed from r412718, webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDLWriter.java webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java Removed: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDLWriter.java Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=412959&r1=412958&r2=412959&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original) +++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Fri Jun 9 00:17:34 2006 @@ -181,6 +181,7 @@ */ public void compile(List schemalist) throws SchemaCompilationException { XmlSchema schema; + try { for (int i = 0; i < schemalist.size(); i++) { schema = (XmlSchema) schemalist.get(i); Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=412959&r1=412958&r2=412959&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original) +++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Fri Jun 9 00:17:34 2006 @@ -37,6 +37,17 @@ /** Mapping file including the qname to type map */ private File typeMappingFile; + /** keeps the WSDL version - default is 1.1*/ + private String WSDLVersion = WSDL2JavaConstants.WSDL_VERSION_1; + + public String getWSDLVersion() { + return WSDLVersion; + } + + public void setWSDLVersion(String WSDLVersion) { + this.WSDLVersion = WSDLVersion; + } + public File getTypeMappingFile() { return typeMappingFile; } Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=412959&r1=412958&r2=412959&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original) +++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Fri Jun 9 00:17:34 2006 @@ -28,6 +28,7 @@ import org.apache.axis2.wsdl.util.CommandLineOptionConstants; import org.apache.axis2.wsdl.util.CommandLineOptionParser; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; +import org.apache.axis2.wsdl.WSDLConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.woden.wsdl20.xml.DescriptionElement; @@ -82,11 +83,10 @@ wsdlUri = option.getOptionValue(); configuration = new CodeGenConfiguration(allOptions); - - CommandLineOption wsdlVersionOption = - (CommandLineOption)allOptions.get(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_OPTION); - if(wsdlVersionOption != null &&("2.0".equals(wsdlVersionOption.getOptionValue()) || - "2".equals(wsdlVersionOption.getOptionValue()))){ + + if(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2. + equals(configuration.getWSDLVersion())){ + //its WSDL 2.0 org.apache.woden.WSDLReader wsdlReader = org.apache.woden.WSDLFactory.newInstance().newWSDLReader(); //TODO Check whether this does the networ downloading @@ -96,6 +96,7 @@ serviceQname = new QName(description.getTargetNamespace().toString(), configuration.getServiceName()); } configuration.setAxisService(new WSDL20ToAxisServiceBuilder(description, serviceQname, configuration.getPortName()).populateService()); + }else{ //It'll be WSDL 1.1 Definition wsdl4jDef = readInTheWSDLFile(wsdlUri); @@ -120,7 +121,6 @@ e.printStackTrace(); throw new CodeGenerationException(CodegenMessages.getMessage("engine.wsdlParsingException"), e); } - /////////////////////////////////////////////////////////////////////// configuration.setBaseURI(getBaseURI(wsdlUri)); loadExtensions(); Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=412959&r1=412958&r2=412959&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original) +++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Fri Jun 9 00:17:34 2006 @@ -161,6 +161,21 @@ } } + CommandLineOption wsdlVersionOption = + loadOption(WSDL2JavaConstants.WSDL_VERSION_OPTION, + WSDL2JavaConstants.WSDL_VERSION_OPTION_LONG, + optionMap); + if (wsdlVersionOption!=null){ + String optionValue = wsdlVersionOption.getOptionValue(); + + if (WSDL2JavaConstants.WSDL_VERSION_2.equals(optionValue) || + WSDL2JavaConstants.WSDL_VERSION_2_OPTIONAL.equals(optionValue) ){ + //users can say either 2.0 or 2 - we just set it to the constant + config.setWSDLVersion(WSDL2JavaConstants.WSDL_VERSION_2); + } //ignore the other cases - they'll be taken as 1.1 + + } + //loop through the map and find parameters having the extra prefix. //put them in the property map Iterator keyIterator = optionMap.keySet().iterator(); Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=412959&r1=412958&r2=412959&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original) +++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Fri Jun 9 00:17:34 2006 @@ -23,10 +23,12 @@ import org.apache.axis2.wsdl.codegen.writer.SkeletonInterfaceWriter; import org.apache.axis2.wsdl.codegen.writer.SkeletonWriter; import org.apache.axis2.wsdl.codegen.writer.TestClassWriter; -import org.apache.axis2.wsdl.codegen.writer.WSDLWriter; +import org.apache.axis2.wsdl.codegen.writer.WSDL11Writer; +import org.apache.axis2.wsdl.codegen.writer.WSDL20Writer; import org.apache.axis2.wsdl.databinding.TypeMapper; import org.apache.axis2.wsdl.util.XSLTConstants; import org.apache.axis2.wsdl.util.XSLTIncludeResolver; +import org.apache.axis2.wsdl.util.CommandLineOptionConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.commons.schema.XmlSchema; @@ -141,7 +143,7 @@ } //~--- fields ------------------------------------------------------------- - protected static final Log log = LogFactory.getLog(AxisServiceBasedMultiLanguageEmitter.class); + protected static final Log log = LogFactory.getLog(AxisServiceBasedMultiLanguageEmitter.class); protected URIResolver resolver; protected Map infoHolder; @@ -329,9 +331,9 @@ addAttribute(doc, "servicename", serviceName, rootElement); if (codeGenConfiguration.isServerSide()){ addAttribute(doc, - "isserverside", - "yes", - rootElement); + "isserverside", + "yes", + rootElement); } doc.appendChild(rootElement); @@ -732,6 +734,7 @@ * the usual pattern of using the class writer */ protected void writeWSDLFiles() { + //first modify the schema names (and locations) so that //they have unique (flattened) names and the schema locations //are adjusted to suit it @@ -754,10 +757,19 @@ ); } + //switch between the correct writer + if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2. + equals(codeGenConfiguration.getWSDLVersion())){ + WSDL20Writer wsdl20Writer = new WSDL20Writer( + codeGenConfiguration.getOutputLocation()); + wsdl20Writer.writeWSDL(axisService); + }else{ - WSDLWriter wsdlWriter = new WSDLWriter( - codeGenConfiguration.getOutputLocation()); - wsdlWriter.writeWSDL(axisService); + WSDL11Writer wsdl11Writer = new WSDL11Writer( + codeGenConfiguration.getOutputLocation()); + wsdl11Writer.writeWSDL(axisService); + + } } @@ -847,7 +859,7 @@ addAttribute(doc, "skeletonInterfaceName", localPart + SKELETON_INTERFACE_SUFFIX, rootElement); }else{ - addAttribute(doc, "skeletonInterfaceName", localPart + SKELETON_CLASS_SUFFIX, + addAttribute(doc, "skeletonInterfaceName", localPart + SKELETON_CLASS_SUFFIX, rootElement); } addAttribute(doc, "basereceiver", (String) MEPtoClassMap.get(mep), rootElement); @@ -1405,7 +1417,7 @@ * @param input */ protected void addHeaderOperations(List soapHeaderParameterQNameList, AxisOperation axisOperation, - boolean input) { + boolean input) { ArrayList headerparamList = new ArrayList(); String MEP = axisOperation.getMessageExchangePattern(); if (input) { Copied: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java (from r412718, webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDLWriter.java) URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java?p2=webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java&p1=webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDLWriter.java&r1=412718&r2=412959&rev=412959&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDLWriter.java (original) +++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java Fri Jun 9 00:17:34 2006 @@ -21,10 +21,11 @@ * limitations under the License. */ -public class WSDLWriter { - private File baseFolder = null; +public class WSDL11Writer { + private File baseFolder = null; - public WSDLWriter(File baseFolder) { + + public WSDL11Writer(File baseFolder) { this.baseFolder = baseFolder; } Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java?rev=412959&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java (added) +++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL20Writer.java Fri Jun 9 00:17:34 2006 @@ -0,0 +1,51 @@ +package org.apache.axis2.wsdl.codegen.writer; + +import org.apache.axis2.description.AxisService; +import org.apache.axis2.util.FileWriter; + +import java.io.File; +import java.io.FileOutputStream; +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class WSDL20Writer { + private File baseFolder = null; + + + public WSDL20Writer(File baseFolder) { + this.baseFolder = baseFolder; + } + + public void writeWSDL(AxisService axisService){ + try { + if (axisService!= null){ + //create a output file + File outputFile = FileWriter.createClassFile(baseFolder, + "resources", + axisService.getName(), + ".wsdl"); + FileOutputStream fos = new FileOutputStream(outputFile); + axisService.printWSDL2(fos); + fos.flush(); + fos.close(); + } + } catch (Exception e) { + throw new RuntimeException("WSDL writing failed!", e); + } + } + + +} Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java?rev=412959&r1=412958&r2=412959&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java (original) +++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/CommandLineOptionConstants.java Fri Jun 9 00:17:34 2006 @@ -62,6 +62,12 @@ String NAME_SPACE_TO_PACKAGE_OPTION_LONG = "namespace2package"; String SERVER_SIDE_INTERFACE_OPTION_LONG = "serverside-interface"; String EXTERNAL_MAPPING_OPTION_LONG = "external-mapping"; + String WSDL_VERSION_OPTION_LONG = "wsdl-version"; + + String WSDL_VERSION_2 = "2.0"; + String WSDL_VERSION_2_OPTIONAL = "2"; + String WSDL_VERSION_1 = "1.1"; + } --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org