cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r930246 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Date Fri, 02 Apr 2010 11:28:30 GMT
Author: dkulp
Date: Fri Apr  2 11:28:30 2010
New Revision: 930246

URL: http://svn.apache.org/viewvc?rev=930246&view=rev
Log:
[CXF-2744] Support re-write of schema redefine elements

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=930246&r1=930245&r2=930246&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java Fri
Apr  2 11:28:30 2010
@@ -256,7 +256,15 @@ public class WSDLQueryHandler implements
                 el.setAttribute("schemaLocation", base + "?xsd=" + sl);
             }
         }
-        
+        elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
+                                                          "http://www.w3.org/2001/XMLSchema",
+                                                          "redefine");
+        for (Element el : elementList) {
+            String sl = el.getAttribute("schemaLocation");
+            if (smp.containsKey(sl)) {
+                el.setAttribute("schemaLocation", base + "?xsd=" + sl);
+            }
+        }
         elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
                                                           "http://schemas.xmlsoap.org/wsdl/",
                                                           "import");
@@ -450,6 +458,31 @@ public class WSDLQueryHandler implements
                 }
             }
         }
+        List<SchemaReference> redefines = CastUtils.cast(schema.getRedefines());
+        for (SchemaReference included : redefines) {
+            String start = included.getSchemaLocationURI();
+
+            if (start != null) {
+                String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
+                if (resolvedSchemaLocation == null) {
+                    if (!doneSchemas.containsKey(start)) {
+                        try {
+                            //check to see if it's aleady in a URL format.  If so, leave
it.
+                            new URL(start);
+                        } catch (MalformedURLException e) {
+                            if (doneSchemas.put(start, included) == null) {
+                                updateSchemaImports(included.getReferencedSchema(), doneSchemas,
base);
+                            }
+                        }
+                    }
+                } else if (!doneSchemas.containsKey(start) 
+                    || !doneSchemas.containsKey(resolvedSchemaLocation)) {
+                    doneSchemas.put(start, included);
+                    doneSchemas.put(resolvedSchemaLocation, included);
+                    updateSchemaImports(included.getReferencedSchema(), doneSchemas, base);
+                }
+            }
+        }
     }
     
     public boolean isRecognizedQuery(String baseUri, String ctx, EndpointInfo endpointInfo)
{



Mime
View raw message