cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r517587 - in /incubator/cxf/trunk/tools2/validator/src: main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
Date Tue, 13 Mar 2007 08:30:18 GMT
Author: mmao
Date: Tue Mar 13 01:30:17 2007
New Revision: 517587

URL: http://svn.apache.org/viewvc?view=rev&rev=517587
Log:
Load the wsdl.xsd and schema.xsd from the jar directly.

Modified:
    incubator/cxf/trunk/tools2/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
    incubator/cxf/trunk/tools2/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java

Modified: incubator/cxf/trunk/tools2/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java?view=diff&rev=517587&r1=517586&r2=517587
==============================================================================
--- incubator/cxf/trunk/tools2/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
(original)
+++ incubator/cxf/trunk/tools2/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
Tue Mar 13 01:30:17 2007
@@ -392,8 +392,26 @@
         NSFILEMAP.put(ToolConstants.WSDL_NAMESPACE_URI, "wsdl.xsd");
         NSFILEMAP.put(ToolConstants.SCHEMA_URI, "XMLSchema.xsd");
     }
+
+    private LSInput loadLSInput(String ns) {
+        String path = ToolConstants.CXF_SCHEMAS_DIR_INJAR + NSFILEMAP.get(ns);
+        URL url = getClass().getClassLoader().getResource(path);
+        LSInput lsin = new LSInputImpl();
+        lsin.setSystemId(url.toString());
+        try {
+            lsin.setByteStream(url.openStream());
+        } catch (IOException e) {
+            return null;
+        }
+        return lsin;
+    }
+    
     public LSInput resolveResource(String type, String namespaceURI, String publicId, String
systemId,
             String baseURI) {
+        if (NSFILEMAP.containsKey(namespaceURI)) {
+            return loadLSInput(namespaceURI);
+        }
+
         LSInput lsin = null;
         String resURL = null;
         String localFile = null;
@@ -401,7 +419,7 @@
             String schemaLocation = "";
             if (baseURI != null) {
                 schemaLocation = baseURI.substring(0, baseURI.lastIndexOf("/") + 1);
-            } 
+            }
             if (systemId.indexOf("http://") < 0) {
                 resURL = schemaLocation + systemId;
             } else {

Modified: incubator/cxf/trunk/tools2/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java?view=diff&rev=517587&r1=517586&r2=517587
==============================================================================
--- incubator/cxf/trunk/tools2/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
(original)
+++ incubator/cxf/trunk/tools2/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
Tue Mar 13 01:30:17 2007
@@ -25,8 +25,6 @@
 import java.util.Enumeration;
 
 import org.apache.cxf.tools.common.ToolTestBase;
-//import org.apache.cxf.wsdl11.WSDLBuilder;
-//import org.apache.cxf.wsdl11.WSDLDefinitionBuilder;
 
 public class WSDLValidationTest extends ToolTestBase {
     public void setUp() {



Mime
View raw message