Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 17687 invoked from network); 20 Mar 2007 09:14:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2007 09:14:06 -0000 Received: (qmail 94923 invoked by uid 500); 20 Mar 2007 09:14:14 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 94840 invoked by uid 500); 20 Mar 2007 09:14:14 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 94831 invoked by uid 99); 20 Mar 2007 09:14:13 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Mar 2007 02:14:13 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Mar 2007 02:14:04 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 26FA51A9838; Tue, 20 Mar 2007 02:13:44 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r520342 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ testutils/ tools/common/src/main/java/org/apache/cxf/tools/common/ tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/ tools/wsdlto/databinding/jaxb/sr... Date: Tue, 20 Mar 2007 09:13:43 -0000 To: cxf-commits@incubator.apache.org From: ema@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070320091344.26FA51A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ema Date: Tue Mar 20 02:13:42 2007 New Revision: 520342 URL: http://svn.apache.org/viewvc?view=rev&rev=520342 Log: [CXF-468]Enable tools to generate code for multiple service Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java incubator/cxf/trunk/testutils/pom.xml incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=520342&r1=520341&r2=520342 ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Tue Mar 20 02:13:42 2007 @@ -25,6 +25,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.logging.Logger; import javax.wsdl.Binding; @@ -154,7 +155,7 @@ public ServiceInfo buildService(Definition def, Service serv) { return buildService(def, serv, null); } - + private ServiceInfo buildService(Definition def, Service serv, DescriptionInfo d) { DescriptionInfo description = d; if (null == description) { @@ -286,8 +287,12 @@ } private void addSchema(Schema schema) { - if (schemaList.get(schema.getDocumentBaseURI()) == null) { - schemaList.put(schema.getDocumentBaseURI(), schema.getElement()); + String docBaseURI = schema.getDocumentBaseURI(); + Element schemaEle = schema.getElement(); + if (schemaList.get(docBaseURI) == null) { + schemaList.put(docBaseURI, schemaEle); + } else if (schemaList.get(docBaseURI) != null && schemaList.containsValue(schemaEle)) { + //do nothing } else { String tns = schema.getDocumentBaseURI() + "#" + schema.getElement().getAttribute("targetNamespace"); Modified: incubator/cxf/trunk/testutils/pom.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/pom.xml?view=diff&rev=520342&r1=520341&r2=520342 ============================================================================== --- incubator/cxf/trunk/testutils/pom.xml (original) +++ incubator/cxf/trunk/testutils/pom.xml Tue Mar 20 02:13:42 2007 @@ -170,592 +170,188 @@ ${project.version} - generate-sources - generate-sources - - ${basedir}/target/generated/src/main/java - - - ${basedir}/src/main/resources/wsdl/hello_world.wsdl - - -b - - ${basedir}/src/main/resources/wsdl/async_binding.xml - - -sn - SOAPService - - - - - ${basedir}/src/main/resources/wsdl/hello_world.wsdl - - -b - ${basedir}/src/main/resources/wsdl/async_binding.xml - - -sn - SOAPProviderService - - - - - - ${basedir}/src/main/resources/wsdl/hello_world.wsdl - - -b - ${basedir}/src/main/resources/wsdl/async_binding.xml - - -sn - SOAPDispatchService - - - - - ${basedir}/src/main/resources/wsdl/hello_world.wsdl - - -b - ${basedir}/src/main/resources/wsdl/async_binding.xml - - -sn - SOAPService_DocLitBare - - - - - ${basedir}/src/main/resources/wsdl/hello_world.wsdl - - -b - ${basedir}/src/main/resources/wsdl/async_binding.xml - - -sn - SOAPServiceAddressingDocLitBare - - - - - - - ${basedir}/src/main/resources/wsdl/hello_world.wsdl - - -b - ${basedir}/src/main/resources/wsdl/async_binding.xml - - -sn - SOAPService_Test1 - - - - - ${basedir}/src/main/resources/wsdl/hello_world.wsdl - - -b - ${basedir}/src/main/resources/wsdl/async_binding.xml - - -sn - SOAPServiceAddressing - - - - - ${basedir}/src/main/resources/wsdl/hello_world.wsdl - - -b - ${basedir}/src/main/resources/wsdl/async_binding.xml - - -sn - SOAPServiceConcurrencyTest - - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_soap12.wsdl - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - SecureSOAPService - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - SecureDontRequireClientAuthSOAPService - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - TargetSecureSOAPService - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - InterSecureSOAPService - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - TargetSecureDontRequireClientAuthSOAPService - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - InterSecureDontRequireClientAuthSOAPService - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - SecureSOAPServiceServerConfiguredByGoodProvider - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - SecureSOAPServiceServerConfiguredByBadProvider - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - SecureSOAPServiceP12 - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - SecureSOAPServiceDifferentCipherSuites - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - SecureSOAPServiceClientPropertiesSet - - - - - ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl - - -sn - SecureSOAPServiceClientPropertiesNotSet - - - - - ${basedir}/src/main/resources/wsdl/greeter_control.wsdl - - -b - - ${basedir}/src/main/resources/wsdl/greeter_control.xjb - - -sn - BasicGreeterService - - - - - - - ${basedir}/src/main/resources/wsdl/greeter_control.wsdl - - -b - - ${basedir}/src/main/resources/wsdl/greeter_control.xjb - - -sn - ControlService - - - - - - - ${basedir}/src/main/resources/wsdl/greeter_control.wsdl - - -b - - ${basedir}/src/main/resources/wsdl/greeter_control.xjb - - -sn - GreeterService - - - - - - - ${basedir}/src/main/resources/wsdl/mtom_xop.wsdl - - - - - ${basedir}/src/main/resources/wsdl/swa-mime.wsdl - - - - ${basedir}/src/main/resources/wsdl/hello_world_xml_mixed.wsdl - - - - ${basedir}/src/main/resources/wsdl/hello_world_xml_bare.wsdl - - - - - ${basedir}/src/main/resources/wsdl/hello_world_xml_wrapped.wsdl - - - - - ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl - - -sn - SOAPServiceRPCLit - - - - ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl - - -sn - SOAPServiceProviderRPCLit - - - - ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl - - -sn - SOAPServiceRPCLit1 - - - - - ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl - - -sn - SOAPServiceRPCLit2 - - - - ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl - - -sn - SOAPServiceRPCLit3 - - - - ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl - - -sn - SOAPServiceRPCLit4 - - - - - ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl - - -sn - SOAPServiceRPCLit5 - - - - ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl - - -sn - SOAPServiceRPCLit6 - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_mixedstyle.wsdl - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - SOAPService - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - SOAPService2 - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - SOAPService3 - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - SOAPService4 - - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - SOAPService5 - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - XMLService1 - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - XMLService2 - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - XMLService3 - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl - - -sn - XMLService4 - - - - - ${basedir}/src/main/resources/wsdl/doc_lit_bare.wsdl - - - - ${basedir}/src/main/resources/wsdl/jms_test.wsdl - - -sn - HelloWorldOneWayQueueService - - - - - - ${basedir}/src/main/resources/wsdl/jms_test.wsdl - - -sn - HelloWorldPubSubService - - - - - - ${basedir}/src/main/resources/wsdl/jms_test.wsdl - - -sn - HelloWorldService - - - - - - ${basedir}/src/main/resources/wsdl/handler_test.wsdl - - - - - - ${basedir}/src/main/resources/wsdl/soapheader.wsdl - - - - - - ${basedir}/src/main/resources/wsdl/soapheader2.wsdl - - - - ${basedir}/src/main/resources/wsdl/soapheader_rpc.wsdl - - - - - ${basedir}/src/main/resources/wsdl/locator.wsdl - - - - - ${basedir}/src/main/resources/wsdl/schema_validation.wsdl - - - - - - ${basedir}/src/main/resources/wsdl/anonymous_complex_type.wsdl - - - - - - ${basedir}/src/main/resources/wsdl/basic_callback_test.wsdl - - - -sn - SOAPService - - - - - ${basedir}/src/main/resources/wsdl/basic_callback_test.wsdl - - - -sn - CallbackService - - - - - - ${basedir}/src/main/resources/wsdl/hello_world_underscore.wsdl - - - - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_xml.wsdl - - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_xml_inc.wsdl - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_1.xsd - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_2.xsd - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_3.xsd - - - - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_doclit_soap.wsdl - - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_doclit.wsdl - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_1.xsd - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_2.xsd - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_3.xsd - - - - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_rpclit_soap.wsdl - - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_rpclit.wsdl - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_1.xsd - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_2.xsd - - - ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_3.xsd - - - - - - ${basedir}/src/main/resources/wsdl/addNumbers.wsdl - - - - - ${basedir}/src/main/resources/wsdl/calculator.wsdl - - - - ${basedir}/src/main/resources/wsdl/jaxb_element_test.wsdl - - - - ${basedir}/src/main/resources/wsdl/ordered_param_holder.wsdl - - - - ${basedir}/src/main/resources/wsdl/hello_world_services.wsdl - - - - - - wsdl2java - - + generate-sources + generate-sources + + ${basedir}/target/generated/src/main/java + + + + ${basedir}/src/main/resources/wsdl/hello_world.wsdl + + -b + + ${basedir}/src/main/resources/wsdl/async_binding.xml + + + + + ${basedir}/src/main/resources/wsdl/hello_world_soap12.wsdl + + + ${basedir}/src/main/resources/wsdl/hello_world_secure.wsdl + + + ${basedir}/src/main/resources/wsdl/greeter_control.wsdl + + -b + + ${basedir}/src/main/resources/wsdl/greeter_control.xjb + + + + + ${basedir}/src/main/resources/wsdl/mtom_xop.wsdl + + + ${basedir}/src/main/resources/wsdl/swa-mime.wsdl + + + ${basedir}/src/main/resources/wsdl/hello_world_xml_mixed.wsdl + + + ${basedir}/src/main/resources/wsdl/hello_world_xml_bare.wsdl + + + + ${basedir}/src/main/resources/wsdl/hello_world_xml_wrapped.wsdl + + + + ${basedir}/src/main/resources/wsdl/hello_world_rpc_lit.wsdl + + + ${basedir}/src/main/resources/wsdl/hello_world_mixedstyle.wsdl + + + ${basedir}/src/main/resources/wsdl/hello_world_doc_lit.wsdl + + + ${basedir}/src/main/resources/wsdl/doc_lit_bare.wsdl + + + ${basedir}/src/main/resources/wsdl/jms_test.wsdl + + + ${basedir}/src/main/resources/wsdl/handler_test.wsdl + + + ${basedir}/src/main/resources/wsdl/soapheader.wsdl + + + ${basedir}/src/main/resources/wsdl/soapheader2.wsdl + + + ${basedir}/src/main/resources/wsdl/soapheader_rpc.wsdl + + + ${basedir}/src/main/resources/wsdl/locator.wsdl + + + + + ${basedir}/src/main/resources/wsdl/schema_validation.wsdl + + + + ${basedir}/src/main/resources/wsdl/anonymous_complex_type.wsdl + + + + ${basedir}/src/main/resources/wsdl/basic_callback_test.wsdl + + + + + ${basedir}/src/main/resources/wsdl/hello_world_underscore.wsdl + + + + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_xml.wsdl + + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_xml_inc.wsdl + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_1.xsd + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_2.xsd + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_3.xsd + + + + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_doclit_soap.wsdl + + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_doclit.wsdl + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_1.xsd + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_2.xsd + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_3.xsd + + + + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_rpclit_soap.wsdl + + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_rpclit.wsdl + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_1.xsd + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_2.xsd + + + ${basedir}/target/generated/src/main/resources/wsdl/type_test/type_test_3.xsd + + + + + ${basedir}/src/main/resources/wsdl/addNumbers.wsdl + + + ${basedir}/src/main/resources/wsdl/calculator.wsdl + + + ${basedir}/src/main/resources/wsdl/jaxb_element_test.wsdl + + + ${basedir}/src/main/resources/wsdl/ordered_param_holder.wsdl + + + ${basedir}/src/main/resources/wsdl/hello_world_services.wsdl + + + + + wsdl2java + + Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java?view=diff&rev=520342&r1=520341&r2=520342 ============================================================================== --- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java (original) +++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolConstants.java Tue Mar 20 02:13:42 2007 @@ -174,7 +174,7 @@ - public static final String SCHEMA_LIST = "schemaList"; + public static final String SCHEMA_MAP = "schemaMap"; public static final String PORTTYPE_MAP = "portTypeMap"; public static final String SCHEMA_TARGET_NAMESPACES = "schemaTargetNameSpaces"; public static final String WSDL_DEFINITION = "wsdlDefinition"; Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java?view=diff&rev=520342&r1=520341&r2=520342 ============================================================================== --- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java (original) +++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java Tue Mar 20 02:13:42 2007 @@ -19,10 +19,13 @@ package org.apache.cxf.tools.common; -import java.io.*; -import java.util.*; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; -import javax.wsdl.extensions.schema.Schema; import javax.xml.namespace.QName; import org.xml.sax.InputSource; @@ -203,11 +206,6 @@ public boolean isExcludeNamespaceEnabled() { return excludeNamespacePackageMap.size() > 0; - } - - @SuppressWarnings("unchecked") - public List getSchemaList() { - return (List)this.get(ToolConstants.SCHEMA_LIST); } public List getExcludePkgList() { Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?view=diff&rev=520342&r1=520341&r2=520342 ============================================================================== --- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original) +++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Tue Mar 20 02:13:42 2007 @@ -23,19 +23,24 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.logging.Logger; import javax.wsdl.Definition; import javax.xml.namespace.QName; +import org.w3c.dom.Element; + import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.service.model.InterfaceInfo; import org.apache.cxf.service.model.ServiceInfo; import org.apache.cxf.tools.common.AbstractCXFToolContainer; import org.apache.cxf.tools.common.ClassUtils; @@ -90,64 +95,86 @@ if (!hasInfoOption()) { buildToolContext(); validate(context); - + FrontEndProfile frontend = context.get(FrontEndProfile.class); - + if (frontend == null) { Message msg = new Message("FOUND_NO_FRONTEND", LOG); throw new ToolException(msg); } - + DataBindingProfile dataBindingProfile = context.get(DataBindingProfile.class); if (dataBindingProfile == null) { Message msg = new Message("FOUND_NO_DATABINDING", LOG); throw new ToolException(msg); } - + WSDLConstants.WSDLVersion version = getWSDLVersion(); - ServiceInfo service = null; String wsdlURL = (String)context.get(ToolConstants.CFG_WSDLURL); - + List serviceList = new ArrayList(); + // Build the ServiceModel from the WSDLModel if (version == WSDLConstants.WSDLVersion.WSDL11) { - AbstractWSDLBuilder builder = - (AbstractWSDLBuilder) frontend.getWSDLBuilder(); + AbstractWSDLBuilder builder = (AbstractWSDLBuilder)frontend + .getWSDLBuilder(); builder.setContext(context); - - //TODO: Modify builder api, let customized definition make sense. + + // TODO: Modify builder api, let customized definition make + // sense. builder.build(URIParserUtil.getAbsoluteURI(wsdlURL)); builder.customize(); Definition definition = builder.getWSDLModel(); - + context.put(Definition.class, definition); if (context.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) { builder.validate(definition); } - + WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus()); - service = serviceBuilder.buildService(definition, getServiceQName(definition)); + + String serviceName = (String)context.get(ToolConstants.CFG_SERVICENAME); + + if (serviceName != null) { + ServiceInfo service = serviceBuilder + .buildService(definition, getServiceQName(definition)); + serviceList.add(service); + } else { + serviceList = serviceBuilder.buildService(definition); + } + context.put(ClassCollector.class, new ClassCollector()); } else { // TODO: wsdl2.0 support } - context.put(ServiceInfo.class, service); - if (context.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) { - validate(service); - } - // Generate types - - generateTypes(); - - // Build the JavaModel from the ServiceModel - context.put(ServiceInfo.class, service); - Processor processor = frontend.getProcessor(); - processor.setEnvironment(context); - processor.process(); - - // Generate artifacts - for (FrontEndGenerator generator : frontend.getGenerators()) { - generator.generate(context); + Map interfaces = new HashMap(); + for (ServiceInfo service : serviceList) { + if (!interfaces.containsKey(service.getInterface().getName().toString())) { + interfaces.put(service.getInterface().getName().toString(), service.getInterface()); + } + } + Map schemas = (Map)serviceList.get(0) + .getProperty(WSDLServiceBuilder.WSDL_SCHEMA_ELEMENT_LIST); + context.put(ToolConstants.SCHEMA_MAP, schemas); + context.put(ToolConstants.PORTTYPE_MAP, interfaces); + generateTypes(); + + for (ServiceInfo service : serviceList) { + + context.put(ServiceInfo.class, service); + if (context.optionSet(ToolConstants.CFG_VALIDATE_WSDL)) { + validate(service); + } + + // Build the JavaModel from the ServiceModel + Processor processor = frontend.getProcessor(); + processor.setEnvironment(context); + processor.process(); + + // Generate artifacts + for (FrontEndGenerator generator : frontend.getGenerators()) { + generator.generate(context); + } } // Build projects: compile classes and copy resources etc. @@ -162,7 +189,8 @@ throw new ToolException(e); } } - } + } + } public void execute(boolean exitOnFinish) throws ToolException { Modified: incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?view=diff&rev=520342&r1=520341&r2=520342 ============================================================================== --- incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java (original) +++ incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java Tue Mar 20 02:13:42 2007 @@ -49,7 +49,7 @@ import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; -import org.apache.cxf.service.model.ServiceInfo; +import org.apache.cxf.service.model.InterfaceInfo; import org.apache.cxf.tools.common.ToolConstants; import org.apache.cxf.tools.common.ToolContext; import org.apache.cxf.tools.common.ToolException; @@ -57,35 +57,38 @@ import org.apache.cxf.tools.util.JAXBUtils; import org.apache.cxf.tools.util.URIParserUtil; import org.apache.cxf.tools.wsdlto.core.DataBindingProfile; -import org.apache.cxf.wsdl11.WSDLServiceBuilder; public class JAXBDataBinding implements DataBindingProfile { private static final Logger LOG = LogUtils.getL7dLogger(JAXBDataBinding.class); - + private S2JJAXBModel rawJaxbModelGenCode; private ToolContext env; - private ServiceInfo serviceInfo; private Definition def; @SuppressWarnings("unchecked") private void initialize(ToolContext penv) throws ToolException { env = penv; - serviceInfo = env.get(ServiceInfo.class); def = (Definition)env.get(Definition.class); SchemaCompilerImpl schemaCompiler = (SchemaCompilerImpl)XJC.createSchemaCompiler(); ClassCollector classCollector = env.get(ClassCollector.class); ClassNameAllocatorImpl allocator = new ClassNameAllocatorImpl(classCollector); - allocator.setInterface(serviceInfo.getInterface(), env.mapPackageName(def.getTargetNamespace())); + + Map interfaces = (Map)env + .get(ToolConstants.PORTTYPE_MAP); + for (String str : interfaces.keySet()) { + InterfaceInfo inf = interfaces.get(str); + allocator.setInterface(inf, env.mapPackageName(def.getTargetNamespace())); + } schemaCompiler.setClassNameAllocator(allocator); JAXBBindErrorListener listener = new JAXBBindErrorListener(env); schemaCompiler.setErrorListener(listener); // Collection schemas = serviceInfo.getSchemas(); List jaxbBindings = env.getJaxbBindingFile(); - Map schemaLists = (Map)serviceInfo - .getProperty(WSDLServiceBuilder.WSDL_SCHEMA_ELEMENT_LIST); + Map schemaLists = (Map)env.get(ToolConstants.SCHEMA_MAP); + Set keys = schemaLists.keySet(); for (String key : keys) { Element ele = schemaLists.get(key); @@ -120,7 +123,6 @@ ele.appendChild(pkgNode); } } - schemaCompiler.parseSchema(key, ele); } @@ -164,8 +166,8 @@ // JAXB bug. JAXB ClassNameCollector may not be invoked when generated // class is an enum. We need to use this method to add the missed file // to classCollector. - private void addedEnumClassToCollector(Map schemaList, - ClassNameAllocatorImpl allocator) { + private void addedEnumClassToCollector(Map schemaList, + ClassNameAllocatorImpl allocator) { for (Element schemaElement : schemaList.values()) { String targetNamespace = schemaElement.getAttribute("targetNamespace"); if (StringUtils.isEmpty(targetNamespace)) { Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?view=diff&rev=520342&r1=520341&r2=520342 ============================================================================== --- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original) +++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Tue Mar 20 02:13:42 2007 @@ -21,7 +21,6 @@ import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; -import java.io.IOException; import java.lang.reflect.Modifier; import java.net.URISyntaxException; @@ -86,12 +85,7 @@ } - /* - * public void testHangingBug() throws Exception { - * env.put(ToolConstants.CFG_WSDLURL, - * getLocation("/wsdl2java_wsdl/bughanging/wsdl/wsrf.wsdl")); - * processor.setContext(env); processor.execute(); } - */ + public void testBug305700() throws Exception { env.put(ToolConstants.CFG_COMPILE, "compile"); env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath()); @@ -156,7 +150,7 @@ File cxf = new File(org, "cxf"); File[] files = cxf.listFiles(); - assertEquals(22, files.length); + assertEquals(23, files.length); Class clz = classLoader.loadClass("org.cxf.Greeter"); assertTrue("Generate " + clz.getName() + "error", clz.isInterface()); @@ -180,72 +174,7 @@ assertTrue("wsdl location should be url style in build.xml", content.indexOf("param1=\"file:") > -1); } - - public void testBug305728HelloWorld() { - try { - String[] args = new String[] {"-compile", "-classdir", - output.getCanonicalPath() + "/classes", - "-d", - output.getCanonicalPath(), - "-nexclude", - "http://www.w3.org/2005/08/addressing" - + "=org.apache.cxf.ws.addressing", - getLocation("/wsdl2java_wsdl/bug305728/hello_world.wsdl")}; - WSDLToJava.main(args); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - try { - File file = new File(output.getCanonicalPath(), - "org/apache/cxf/ws/addressing/EndpointReferenceType.java"); - - assertFalse("Exclude java file should not be generated : " + file.getCanonicalPath(), file - .exists()); - - file = new File(output.getCanonicalPath() + File.separator + "classes", - "org/apache/cxf/ws/addressing/EndpointReferenceType.class"); - assertFalse("Exclude class should not be generated : " + file.getCanonicalPath(), file.exists()); - - file = new File(output.getCanonicalPath(), - "org/w3/_2005/_08/addressing/EndpointReferenceType.java"); - assertFalse("Exclude file should not be generated : " + file.getCanonicalPath(), file.exists()); - - file = new File(output.getCanonicalPath() + File.separator + "classes", - "org/w3/_2005/_08/addressing/EndpointReferenceType.class"); - assertFalse("Exclude class should not be generated : " + file.getCanonicalPath(), file.exists()); - - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void testBug305728HelloWorld2() { - try { - String[] args = new String[] {"-compile", "-classdir", output.getCanonicalPath() + "/classes", - "-d", output.getCanonicalPath(), "-nexclude", - "http://apache.org/hello_world/types", - getLocation("/wsdl2java_wsdl/bug305728/hello_world2.wsdl")}; - WSDLToJava.main(args); - } catch (Exception e) { - e.printStackTrace(); - } - - try { - File file = new File(output.getCanonicalPath(), "org/apache/hello_world/types"); - assertFalse("Exclude file should not be generated : " + file.getCanonicalPath(), file.exists()); - - file = new File(output.getCanonicalPath() + File.separator + "classes", - "org/apache/hello_world/types"); - - assertFalse("Exclude file should not be generated : " + file.getCanonicalPath(), file.exists()); - - } catch (IOException e) { - e.printStackTrace(); - } - - } - + public void testExcludeNSWithPackageName() throws Exception { String[] args = new String[] {"-d", output.getCanonicalPath(), "-nexclude", Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?view=diff&rev=520342&r1=520341&r2=520342 ============================================================================== --- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java (original) +++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java Tue Mar 20 02:13:42 2007 @@ -224,7 +224,7 @@ File types = new File(helloworldsoaphttp, "types"); assertTrue(types.exists()); File[] files = helloworldsoaphttp.listFiles(); - assertEquals(6, files.length); + assertEquals(7, files.length); files = types.listFiles(); assertEquals(17, files.length);