cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r632395 - in /incubator/cxf/branches/2.0.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/xmlschema/ rt/core/src/main/java/org/apache/cxf/databinding/source/ rt/core/src/main/java/org/apache/cxf/wsdl11/ tools/wsdlto/frontend/ja...
Date Fri, 29 Feb 2008 17:13:54 GMT
Author: dkulp
Date: Fri Feb 29 09:13:51 2008
New Revision: 632395

URL: http://svn.apache.org/viewvc?rev=632395&view=rev
Log:
Merged revisions 632324 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r632324 | dkulp | 2008-02-29 09:14:11 -0500 (Fri, 29 Feb 2008) | 2 lines
  
  Updates to prepare for XmlSchema 1.4 which is being voted on now.   This now works with
1.3.2 and 1.4.
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java?rev=632395&r1=632394&r2=632395&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
Fri Feb 29 09:13:51 2008
@@ -21,13 +21,13 @@
 
 import java.io.Reader;
 import java.io.StringReader;
+import java.lang.reflect.Method;
 
 import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
 import org.xml.sax.InputSource;
 
 import org.apache.ws.commons.schema.ValidationEventHandler;
@@ -46,6 +46,17 @@
  * One bug is WSCOMMONS-272.
  */
 public class SchemaCollection {
+    private static final Method GET_ELEMENT_BY_NAME_METHOD;
+    static {
+        Method m = null;
+        try {
+            m = XmlSchema.class.getMethod("getElementByName",
+                                          new Class[] {String.class});
+        } catch (Exception ex) {
+            //ignore
+        }
+        GET_ELEMENT_BY_NAME_METHOD = m;
+    }
     
     private XmlSchemaCollection schemaCollection;
     
@@ -156,6 +167,33 @@
         for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
             if (schema.getTargetNamespace().equals(namespaceURI)) {
                 return schema;
+            }
+        }
+        return null;
+    }
+
+    public XmlSchema getSchemaForElement(QName name) {
+        for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
+            if (name.getNamespaceURI().equals(schema.getTargetNamespace())) {
+
+                //for XmlSchema 1.4, we should use:
+                //schema.getElementByName(name.getLocalPart()) != null
+                //but that doesn't exist in 1.3 so for now, use reflection
+                try {
+                    if (GET_ELEMENT_BY_NAME_METHOD != null) {
+                        if (GET_ELEMENT_BY_NAME_METHOD.invoke(schema,
+                                                              new Object[] {name.getLocalPart()})
!= null) {
+                            return schema;
+                        }
+                    } else if (schema.getElementByName(name) != null) {
+                        return schema;
+                    }
+
+                } catch (java.lang.reflect.InvocationTargetException ex) {
+                    //ignore
+                } catch (IllegalAccessException ex) {
+                    //ignore
+                }
             }
         }
         return null;

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java?rev=632395&r1=632394&r2=632395&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
Fri Feb 29 09:13:51 2008
@@ -20,10 +20,10 @@
 package org.apache.cxf.databinding.source;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-
 import javax.xml.transform.dom.DOMSource;
 
 import org.w3c.dom.Document;
@@ -69,7 +69,7 @@
         }
         SchemaInfo schema = new SchemaInfo(serviceInfo, ns);
         schema.setSystemId(systemId);
-        XmlSchema xmlSchema = col.read(d, null);
+        XmlSchema xmlSchema = col.read(d, systemId, null);
         schema.setSchema(xmlSchema);
         serviceInfo.addSchema(schema);
         return xmlSchema;

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java?rev=632395&r1=632394&r2=632395&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
Fri Feb 29 09:13:51 2008
@@ -21,6 +21,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -63,10 +64,16 @@
         extractSchema(def, schemaCol, serviceInfo);
         // added
         getSchemaList(def);
+        
+        Map<Definition, Definition> done = new IdentityHashMap<Definition, Definition>();
+        done.put(def, def);
         for (Definition def2 : defList) {
-            extractSchema(def2, schemaCol, serviceInfo);
-            // added
-            getSchemaList(def2);
+            if (!done.containsKey(def2)) {
+                extractSchema(def2, schemaCol, serviceInfo);
+                // added
+                getSchemaList(def2);
+                done.put(def2, def2);
+            }
         }
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java?rev=632395&r1=632394&r2=632395&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
Fri Feb 29 09:13:51 2008
@@ -59,7 +59,7 @@
 
 public final class ProcessorUtil {
     private static final String KEYWORDS_PREFIX = "_";
-    
+
     private ProcessorUtil() {
     }
 
@@ -396,12 +396,9 @@
     public static boolean isSchemaFormQualified(ToolContext context, QName partElement) {
         ServiceInfo serviceInfo = (ServiceInfo)context.get(ServiceInfo.class);
         SchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();
-
-        for (int i = 0; i < schemaCol.getXmlSchemas().length; i++) {
-            XmlSchema schema = schemaCol.getXmlSchemas().clone()[i];
-            if (schema.getElementByName(partElement) != null) {
-                return schema.getElementFormDefault().getValue().equals(XmlSchemaForm.QUALIFIED);
-            }
+        XmlSchema schema = schemaCol.getSchemaForElement(partElement);
+        if (schema != null) {
+            return schema.getElementFormDefault().getValue().equals(XmlSchemaForm.QUALIFIED);
         }
         return false;
     

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=632395&r1=632394&r2=632395&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Fri Feb 29 09:13:51 2008
@@ -521,6 +521,7 @@
         String results = getStringFromFile(new File(output.getCanonicalPath(), 
                                                     "org/apache/sayhi/SayHi.java"));
         assertTrue(results.trim().length() > 0);
+        
         assertTrue(results.indexOf("@WebResult(name  =  \"return\",  " 
                                    + "targetNamespace  =  \"http://apache.org/sayHi\")")
!= -1);
         assertTrue(results.indexOf("@WebResult(name  =  \"return\",  targetNamespace  = 
\"\")") != -1);

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java?rev=632395&r1=632394&r2=632395&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
Fri Feb 29 09:13:51 2008
@@ -137,12 +137,7 @@
         env.put(ToolConstants.CFG_CLASSDIR, null);
 
         processor.setContext(env);
-        try {
-            processor.execute();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Catalog not working");
-        }
+        processor.execute();
     }
 
     @Test
@@ -153,11 +148,6 @@
         env.put(ToolConstants.CFG_CLASSDIR, null);
 
         processor.setContext(env);
-        try {
-            processor.execute();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Catalog not working");
-        }
+        processor.execute();
     }
 }



Mime
View raw message