You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by hu...@apache.org on 2006/07/10 14:19:54 UTC

svn commit: r420508 - in /incubator/woden/branches/WODEN-40: ./ src/org/apache/woden/internal/util/ test/org/apache/woden/wsdl20/extensions/http/ test/org/apache/woden/wsdl20/extensions/http/resources/

Author: hughesj
Date: Mon Jul 10 05:19:53 2006
New Revision: 420508

URL: http://svn.apache.org/viewvc?rev=420508&view=rev
Log:
Merged https://svn.apache.org/...../woden/java (a.k.a. trunk) changes r419883:420507 into the WODEN-40 branch

Modified:
    incubator/woden/branches/WODEN-40/.project
    incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java
    incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingOperationExtensionsTest.java
    incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingOperationExtensions.wsdl

Modified: incubator/woden/branches/WODEN-40/.project
URL: http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-40/.project?rev=420508&r1=420507&r2=420508&view=diff
==============================================================================
--- incubator/woden/branches/WODEN-40/.project (original)
+++ incubator/woden/branches/WODEN-40/.project Mon Jul 10 05:19:53 2006
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>java</name>
+	<name>woden-WODEN-40-speedier</name>
 	<comment></comment>
 	<projects>
 	</projects>

Modified: incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java
URL: http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java?rev=420508&r1=420507&r2=420508&view=diff
==============================================================================
--- incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java (original)
+++ incubator/woden/branches/WODEN-40/src/org/apache/woden/internal/util/ComponentModelBuilder.java Mon Jul 10 05:19:53 2006
@@ -16,7 +16,6 @@
 package org.apache.woden.internal.util;
 
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
@@ -65,6 +64,9 @@
 import org.apache.woden.wsdl20.xml.TypesElement;
 import org.apache.woden.wsdl20.xml.WSDLElement;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
 import org.apache.ws.commons.schema.XmlSchemaObjectTable;
 
 /**
@@ -141,24 +143,7 @@
 	private void buildElementsAndTypes(DescriptionImpl desc) {
 		TypesElement types = desc.getTypesElement();
 
-		URI typeSystemURI = null;
-		try {
-			typeSystemURI = new URI(Constants.TYPE_XSD_2001);
-		} catch (URISyntaxException e) {
-			// TODO this code will propagate 'throws WSDLException' up through
-			// the
-			// method call path to the API getter methods of the Component
-			// model. Try to
-			// find a better way of initializing the Component model without
-			// this
-			// consequence, if possible.
-			//
-			// String msg = fErrorRpt.getFormattedMessage(
-			// "WSDL506",
-			// new Object[] {Constants.TYPE_XSD_2001});
-			// throw new WSDLException(WSDLException.CONFIGURATION_ERROR, msg,
-			// e);
-		}
+		URI typeSystemURI = URI.create(Constants.TYPE_XSD_2001); //TODO support other type systems?
 
 		if (types != null) {
 			List referenceableSchemaDefs = ((TypesImpl) types)
@@ -166,76 +151,91 @@
 			Iterator i = referenceableSchemaDefs.iterator();
 			while (i.hasNext()) {
 				XmlSchema schemaDef = (XmlSchema) i.next();
-
-				// Following code is a work around for a bug in
-				// XmlSchemaObject.equals - this method
-				// gets invoked via List.contains(o), but currently it always
-				// return true!!!
-
-				boolean newSchema = true;
-				for (Iterator i2 = fSchemasDone.iterator(); i2.hasNext();) {
-					XmlSchema schemaDone = (XmlSchema) i2.next();
-					if (schemaDef == schemaDone) {
-						newSchema = false;
-						break;
-					}
-				}
-
-				// if(!fSchemasDone.contains(schemaDef)) TODO re-instate when
-				// XmlSchemaObject.equals bug is fixed
-				if (newSchema) {
-					buildElementDeclarations(schemaDef, typeSystemURI);
-					buildTypeDefinitions(schemaDef, typeSystemURI);
-					fSchemasDone.add(schemaDef);
-				}
+                buildElementsAndTypes(schemaDef, schemaDef.getTargetNamespace(), typeSystemURI);
 			}
 		}
 	}
+    
+    private void buildElementsAndTypes(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) {
+        
+        if(!fSchemasDone.contains(schemaDef)) {
+            
+            //TODO recurse imported schemas
+            
+            //recurse included schemas
+            XmlSchemaObjectCollection includeColl = schemaDef.getIncludes();
+            Iterator includes = includeColl.getIterator();
+            while(includes.hasNext()) {
+                Object o = includes.next();
+                if(o instanceof XmlSchemaImport) continue;  //TODO seems to be a bug in XmlSchema...includes contains an XmlSchemaImport object?
+                XmlSchemaInclude include = (XmlSchemaInclude)o;
+                XmlSchema schema = include.getSchema();
+                if(schemaTns.equals(schema.getTargetNamespace()) || 
+                   "DEFAULT".equals(schema.getTargetNamespace()) ) //this is how XmlSchema stores a null tns
+                {
+                    buildElementsAndTypes(schema, schemaTns, typeSystemURI);
+                }
+            }
+            
+            //parse elements and types declared directly in this schema
+            buildElementDeclarations(schemaDef, schemaTns, typeSystemURI);
+            buildTypeDefinitions(schemaDef, schemaTns, typeSystemURI);
+            fSchemasDone.add(schemaDef);
+        }
+    }
 
 	/*
 	 * Extract the element declarations from the given schema.
 	 */
-	private void buildElementDeclarations(XmlSchema schemaDef, URI typeSystemURI) {
-		String schemaTns = schemaDef.getTargetNamespace();
-		if (schemaTns != null) {
-			XmlSchemaObjectTable elementTable = schemaDef.getElements();
-			Iterator qnames = elementTable.getNames();
-			while (qnames.hasNext()) {
-				QName qname = (QName) qnames.next();
-
-				if (qname.getNamespaceURI().equals(schemaTns)) {
-					ElementDeclarationImpl ed = new ElementDeclarationImpl();
-					ed.setName(qname);
-					ed.setSystem(typeSystemURI);
-					ed.setContentModel(Constants.API_APACHE_WS_XS);
-					ed.setContent(elementTable.getItem(qname));
-					fDesc.addElementDeclaration(ed);
-				}
-			}
-		}
+	private void buildElementDeclarations(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) {
+        
+	    XmlSchemaObjectTable elementTable = schemaDef.getElements();
+	    Iterator qnames = elementTable.getNames();
+	    while (qnames.hasNext()) {
+	        QName xseQN = (QName) qnames.next();
+            QName edQN = xseQN;
+            if(xseQN.getNamespaceURI().equals("DEFAULT")) {
+                //this is how XmlSchema represents tns for chameleon xs:includes,
+                //so replace it with the including schema's tns.
+                edQN = new QName(schemaTns, xseQN.getLocalPart(), xseQN.getPrefix());
+            }
+	        if(edQN.getNamespaceURI().equals(schemaTns)) //TODO test with schema imports, may be incorrect.
+            {
+	            ElementDeclarationImpl ed = new ElementDeclarationImpl();
+	            ed.setName(edQN);
+	            ed.setSystem(typeSystemURI);
+	            ed.setContentModel(Constants.API_APACHE_WS_XS);
+	            ed.setContent(elementTable.getItem(xseQN));
+	            fDesc.addElementDeclaration(ed);
+	        }
+	    }
+	    
 	}
 
 	/*
 	 * Extract the type definitions from the given schema.
 	 */
-	private void buildTypeDefinitions(XmlSchema schemaDef, URI typeSystemURI) {
-		String schemaTns = schemaDef.getTargetNamespace();
-		if (schemaTns != null) {
-			XmlSchemaObjectTable typeTable = schemaDef.getSchemaTypes();
-			Iterator qnames = typeTable.getNames();
-			while (qnames.hasNext()) {
-				QName qname = (QName) qnames.next();
-
-				if (qname.getNamespaceURI().equals(schemaTns)) {
-					TypeDefinitionImpl td = new TypeDefinitionImpl();
-					td.setName(qname);
-					td.setSystem(typeSystemURI);
-					td.setContentModel(Constants.API_APACHE_WS_XS);
-					td.setContent(typeTable.getItem(qname));
-					fDesc.addTypeDefinition(td);
-				}
-			}
-		}
+	private void buildTypeDefinitions(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) {
+        
+	    XmlSchemaObjectTable typeTable = schemaDef.getSchemaTypes();
+	    Iterator qnames = typeTable.getNames();
+	    while (qnames.hasNext()) {
+	        QName xsdQN = (QName) qnames.next();
+            QName tdQN = xsdQN;
+            if(xsdQN.getNamespaceURI().equals("DEFAULT")) {
+                //this is how XmlSchema represents tns for chameleon xs:includes,
+                //so replace it with the including schema's tns.
+                tdQN = new QName(schemaTns, xsdQN.getLocalPart(), xsdQN.getPrefix());
+            }
+	        if (tdQN.getNamespaceURI().equals(schemaTns)) {
+	            TypeDefinitionImpl td = new TypeDefinitionImpl();
+	            td.setName(tdQN);
+	            td.setSystem(typeSystemURI);
+	            td.setContentModel(Constants.API_APACHE_WS_XS);
+	            td.setContent(typeTable.getItem(xsdQN));
+	            fDesc.addTypeDefinition(td);
+	        }
+	    }
 	}
 
 	/***************************************************************************

Modified: incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingOperationExtensionsTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingOperationExtensionsTest.java?rev=420508&r1=420507&r2=420508&view=diff
==============================================================================
--- incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingOperationExtensionsTest.java (original)
+++ incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/HTTPBindingOperationExtensionsTest.java Mon Jul 10 05:19:53 2006
@@ -414,8 +414,7 @@
                     ComponentExtensions.URI_NS_HTTP);
         
         String actual2 = httpBindOperExts2.getHttpQueryParameterSeparator();
-        assertEquals("Unexpected default value for http query parameter separator.",
-                "&",
+        assertNull("Expected a null value for http query parameter separator.",
                 actual2);
     }
 

Modified: incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingOperationExtensions.wsdl
URL: http://svn.apache.org/viewvc/incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingOperationExtensions.wsdl?rev=420508&r1=420507&r2=420508&view=diff
==============================================================================
--- incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingOperationExtensions.wsdl (original)
+++ incubator/woden/branches/WODEN-40/test/org/apache/woden/wsdl20/extensions/http/resources/HTTPBindingOperationExtensions.wsdl Mon Jul 10 05:19:53 2006
@@ -80,7 +80,7 @@
 	          {http input serialization} should default to application/xml if {http method} rules default to POST
 	          {http output serialization} should default to application/xml
 	          {http fault serialization} should default to application/xml
-	          {http query parameter separator} should default to ampersand
+	          {http query parameter separator} should default to null
 	          {http transfer coding default} should default to null
 	      </documentation>
 	  </operation>



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org