Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 50608 invoked from network); 22 Oct 2007 21:09:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Oct 2007 21:09:49 -0000 Received: (qmail 64216 invoked by uid 500); 22 Oct 2007 21:09:36 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 64092 invoked by uid 500); 22 Oct 2007 21:09:36 -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 64083 invoked by uid 99); 22 Oct 2007 21:09:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Oct 2007 14:09:36 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED 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; Mon, 22 Oct 2007 21:09:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 41E1E1A9838; Mon, 22 Oct 2007 14:08:47 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r587255 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java Date: Mon, 22 Oct 2007 21:08:46 -0000 To: cxf-commits@incubator.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071022210847.41E1E1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Mon Oct 22 14:08:46 2007 New Revision: 587255 URL: http://svn.apache.org/viewvc?rev=587255&view=rev Log: Merged revisions 586965 via svnmerge from https://svn.apache.org/repos/asf/incubator/cxf/trunk ........ r586965 | bimargulies | 2007-10-21 18:40:17 -0400 (Sun, 21 Oct 2007) | 2 lines Add some javadoc and use some defined constants in the WSDL building code. This is a side-effect of studying the code. ........ Modified: incubator/cxf/branches/2.0.x-fixes/ (props changed) incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java Propchange: incubator/cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=587255&r1=587254&r2=587255&view=diff ============================================================================== --- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java (original) +++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java Mon Oct 22 14:08:46 2007 @@ -73,6 +73,15 @@ import org.apache.cxf.wsdl.WSDLConstants; import org.apache.cxf.wsdl.WSDLManager; +/** + * Consume a set of service definitions and produce a WSDL model. The ServiceInfo objects + * contain the bindings, operations, and ports, plus XMLSchema schemas. + * + * Each wsdl:definition has to have a single target namespace. The first service in the list + * defines the TNS of the overall WSDL. If a subsequent service has a divergent TNS, then + * the code creates a new definition element (i.e., Definition object), and imports it into + * the top-level object. + */ public final class ServiceWSDLBuilder { private final Map ns2prefix; @@ -83,25 +92,64 @@ private int xsdCount; private final Bus bus; + /** + * Sets up the builder on a bus with a list of services. + * @param b the bus. + * @param services the services. + */ public ServiceWSDLBuilder(Bus b, List services) { this.services = services; bus = b; ns2prefix = new HashMap(); } + + /** + * For callers who prefer varargs, an inline list of ServiceInfo objects instead of + * a List. Primarily used for tests or other callers with only one service in hand. + * @param b the bus. + * @param services the services. + */ public ServiceWSDLBuilder(Bus b, ServiceInfo ... services) { this(b, Arrays.asList(services)); } + + /** + * Set whether to emit references to imported schema files. + * This is only effective for {@link #build(Map)}, which is passed additional schemas for + * import. {@link #build()} resets this flag to false. + * @param b true to use imports. + */ public void setUseSchemaImports(boolean b) { useSchemaImports = b; } + + /** + * Base filename for imported files. + * @param s pathname. + */ public void setBaseFileName(String s) { baseFileName = s; } + /** + * Create the WSDL Definition object and return it. This function will never create + * imports to schemas. + * @return the WSDL definition. + * @throws WSDLException + */ public Definition build() throws WSDLException { useSchemaImports = false; return build(null); } + + /** + * Create the WSDL Definition object and return it. This function respects the + * setting of {@link #setUseSchemaImports(boolean)}. + * @param imports A set of schema imports to either reference as imports or read and + * then inline. + * @return the WSDL definition + * @throws WSDLException + */ public Definition build(Map imports) throws WSDLException { try { definition = services.get(0).getProperty(WSDLServiceBuilder.WSDL_DEFINITION, Definition.class); @@ -156,7 +204,12 @@ return d; } - + /** + * Return a list of ExtensibilityElements for a particular component, such as a BindingFaultInfo. + * This perhaps should be protected. + * @param holder The item containing the extensibility elements. + * @return the extensibility elements. + */ public List getWSDL11Extensors(AbstractPropertiesHolder holder) { return holder.getExtensors(ExtensibilityElement.class); } @@ -181,11 +234,11 @@ try { doc = XMLUtils.newDocument(); } catch (ParserConfigurationException e) { - //should not happen + throw new RuntimeException("DOM configuration problem", e); } - Element nd = XMLUtils.createElementNS(doc, new QName("http://www.w3.org/2001/XMLSchema", + Element nd = XMLUtils.createElementNS(doc, new QName(WSDLConstants.NU_SCHEMA_XSD, "schema")); - nd.setAttribute("xmlns", "http://www.w3.org/2001/XMLSchema"); + nd.setAttribute("xmlns", WSDLConstants.NU_SCHEMA_XSD); doc.appendChild(nd); for (SchemaInfo schemaInfo : schemas) { @@ -200,7 +253,7 @@ //imports String name = baseFileName + "_schema" + (++xsdCount) + ".xsd"; Element imp = XMLUtils.createElementNS(doc, - new QName("http://www.w3.org/2001/XMLSchema", + new QName(WSDLConstants.NU_SCHEMA_XSD, "import")); imp.setAttribute("schemaLocation", name); imp.setAttribute("namespace", schemaInfo.getNamespaceURI()); Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java?rev=587255&r1=587254&r2=587255&view=diff ============================================================================== --- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java (original) +++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLDefinitionBuilder.java Mon Oct 22 14:08:46 2007 @@ -51,6 +51,7 @@ import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.wsdl.JAXBExtensionHelper; import org.apache.cxf.wsdl.WSDLBuilder; +import org.apache.cxf.wsdl.WSDLConstants; import org.apache.cxf.wsdl.WSDLExtensibilityPlugin; public class WSDLDefinitionBuilder implements WSDLBuilder { @@ -79,7 +80,7 @@ try { wsdlFactory = WSDLFactory.newInstance(); registry = wsdlFactory.newPopulatedExtensionRegistry(); - QName header = new QName("http://schemas.xmlsoap.org/wsdl/soap/", "header"); + QName header = new QName(WSDLConstants.WSDL11_NAMESPACE, "header"); registry.registerDeserializer(MIMEPart.class, header, new SOAPHeaderSerializer());