cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r759391 - in /cxf/trunk: api/src/main/java/org/apache/cxf/tools/common/ tools/common/src/main/java/org/apache/cxf/tools/common/ tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/ tools/wsdlto/databinding/jaxb/src/main/java/org/apa...
Date Fri, 27 Mar 2009 23:35:59 GMT
Author: bimargulies
Date: Fri Mar 27 23:35:59 2009
New Revision: 759391

URL: http://svn.apache.org/viewvc?rev=759391&view=rev
Log:
Phase one of removing the DOM cache.

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
    cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java Fri Mar 27
23:35:59 2009
@@ -203,7 +203,7 @@
 
 
 
-    public static final String SCHEMA_MAP = "schemaMap";
+    public static final String XML_SCHEMA_COLLECTION = "xmlSchemaCollection";
     public static final String PORTTYPE_MAP = "portTypeMap";
     public static final String SCHEMA_TARGET_NAMESPACES = "schemaTargetNameSpaces";
     public static final String WSDL_DEFINITION = "wsdlDefinition";

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
Fri Mar 27 23:35:59 2009
@@ -238,7 +238,8 @@
         assertTagEquals(expected, source, DEFAULT_IGNORE_ATTR, DEFAULT_IGNORE_TAG);
     }
 
-    protected void assertAttributesEquals(Map<QName, String> q1,
+    protected void assertAttributesEquals(QName element,
+                                          Map<QName, String> q1,
                                           Map<QName, String> q2, 
                                           Collection<String> ignoreAttr) {
         for (Map.Entry<QName, String>  attr : q1.entrySet()) {
@@ -248,7 +249,9 @@
             
             String found = q2.get(attr.getKey());
             if (found == null) {
-                throw new AssertionError("Attribute: " + attr.getKey() + " is missing.");
               
+                throw new AssertionError("Attribute: " + attr.getKey() 
+                                         + " is missing in " 
+                                         + element);                
             }
             if (!found.equals(attr.getValue())) {
                 throw new ComparisonFailure("Attribute not equal: ", 
@@ -267,8 +270,10 @@
                                         source.getName().toString());
         }
 
-        assertAttributesEquals(expected.getAttributes(), source.getAttributes(), ignoreAttr);
-        assertAttributesEquals(source.getAttributes(), expected.getAttributes(), ignoreAttr);
+        assertAttributesEquals(expected.getName(), 
+                               expected.getAttributes(), source.getAttributes(), ignoreAttr);
+        assertAttributesEquals(expected.getName(),
+                               source.getAttributes(), expected.getAttributes(), ignoreAttr);
 
         if (!StringUtils.isEmpty(expected.getText())
                 && !expected.getText().equals(source.getText())) {

Modified: cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Fri Mar 27 23:35:59 2009
@@ -25,7 +25,6 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -39,16 +38,14 @@
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
 
-import org.w3c.dom.Element;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PropertiesLoaderUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.service.model.InterfaceInfo;
-import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.AbstractCXFToolContainer;
 import org.apache.cxf.tools.common.ClassNameProcessor;
@@ -151,32 +148,17 @@
             }
             Map<String, InterfaceInfo> interfaces = new LinkedHashMap<String, InterfaceInfo>();
 
-            Map<String, Element> schemas = (Map<String, Element>)serviceList.get(0)
-                .getProperty(WSDLServiceBuilder.WSDL_SCHEMA_ELEMENT_LIST);
-            if (schemas == null) {
-                schemas = new java.util.HashMap<String, Element>();
-                ServiceInfo serviceInfo = serviceList.get(0);
-                for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
-                    if (schemaInfo.getElement() != null && schemaInfo.getSystemId()
== null) {
-                        String sysId = schemaInfo.getElement().getAttribute("targetNamespce");
-                        if (sysId == null) {
-                            sysId = serviceInfo.getTargetNamespace();
-                        }
-                        schemas.put(sysId, schemaInfo.getElement());
-                    }
-                    if (schemaInfo.getElement() != null && schemaInfo.getSystemId()
!= null) {
-                        schemas.put(schemaInfo.getSystemId(), schemaInfo.getElement());
-                    }
-                }
-            }
+            ServiceInfo service0 = serviceList.get(0);
+            SchemaCollection schemaCollection = service0.getXmlSchemaCollection();
+            context.put(ToolConstants.XML_SCHEMA_COLLECTION, schemaCollection);
             
-            if (context.isPackageNameChanged() && schemas.size() > 1 
+            // > 2 because the schema-schema is always in there.
+            if (context.isPackageNameChanged() && schemaCollection.getXmlSchemas().length
> 2
                 && context.get(ToolConstants.CFG_NO_ADDRESS_BINDING) == null) {
                 throw new ToolException(new Message("-p option cannot be used "
                     + "when wsdl contains mutiple schemas", LOG));
             }
             
-            context.put(ToolConstants.SCHEMA_MAP, schemas);
             context.put(ToolConstants.PORTTYPE_MAP, interfaces);
             context.put(ClassCollector.class, new ClassCollector());
             Processor processor = frontend.getProcessor();

Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Fri Mar 27 23:35:59 2009
@@ -65,10 +65,10 @@
 import com.sun.tools.xjc.api.TypeAndAnnotation;
 import com.sun.tools.xjc.api.XJC;
 
-
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.FileUtils;
@@ -81,8 +81,9 @@
 import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
 import org.apache.cxf.tools.wsdlto.core.DefaultValueProvider;
 import org.apache.cxf.tools.wsdlto.core.RandomValueProvider;
-
-
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaSerializer;
+import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException;
 
 public class JAXBDataBinding implements DataBindingProfile {
     private static final Logger LOG = LogUtils.getL7dLogger(JAXBDataBinding.class);
@@ -121,14 +122,14 @@
         JLDEFAULT_TYPE_MAP.put("java.lang.Float", "float");
         JLDEFAULT_TYPE_MAP.put("java.lang.Double", "double");
         DEFAULT_TYPE_MAP.addAll(JLDEFAULT_TYPE_MAP.keySet());
-    }    
-
-
+    }   
+    
     public void initialize(ToolContext c) throws ToolException {
         this.context = c;
         
         SchemaCompiler schemaCompiler = XJC.createSchemaCompiler();
         ClassCollector classCollector = context.get(ClassCollector.class);
+        //installResolverIntoSchemaCompiler(schemaCompiler);
         
         ClassNameAllocatorImpl allocator 
             = new ClassNameAllocatorImpl(classCollector,
@@ -140,11 +141,11 @@
         schemaCompiler.setErrorListener(listener);
         // Collection<SchemaInfo> schemas = serviceInfo.getSchemas();
         List<InputSource> jaxbBindings = context.getJaxbBindingFile();
-        Map<String, Element> schemaLists = CastUtils.cast((Map<?, ?>)context.get(ToolConstants.SCHEMA_MAP));
-
+        SchemaCollection schemas = (SchemaCollection) context.get(ToolConstants.XML_SCHEMA_COLLECTION);
         
         Options opts = null;
         opts = getOptions(schemaCompiler);
+        //schemaCompiler.setEntityResolver(entityResolver)
         List<String> args = new ArrayList<String>();
         
         if (context.get(ToolConstants.CFG_NO_ADDRESS_BINDING) == null) {
@@ -196,7 +197,7 @@
         }
         
         
-        addSchemas(opts, schemaCompiler, schemaLists);
+        addSchemas(opts, schemaCompiler, schemas);
 
         for (InputSource binding : jaxbBindings) {
             opts.addBindFile(binding);
@@ -220,7 +221,7 @@
 
         rawJaxbModelGenCode = schemaCompiler.bind();
 
-        addedEnumClassToCollector(schemaLists, allocator);
+        addedEnumClassToCollector(schemas, allocator);
 
         if (context.get(ToolConstants.CFG_DEFAULT_VALUES) != null) {
             String cname = (String)context.get(ToolConstants.CFG_DEFAULT_VALUES);
@@ -242,14 +243,29 @@
     }
 
     private void addSchemas(Options opts, SchemaCompiler schemaCompiler,
-                            Map<String, Element> schemaLists) {
-        for (String key : schemaLists.keySet()) {
-            Element ele = schemaLists.get(key);
+                            SchemaCollection schemaCollection) {
+        for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
+            if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schema.getTargetNamespace())) {
+                continue;
+            }
+                
+            String key = schema.getSourceURI();
+            XmlSchemaSerializer xser = new XmlSchemaSerializer();
+            xser.setExtReg(schemaCollection.getExtReg());
+            Document[] docs;
+            try {
+                docs = xser.serializeSchema(schema, false);
+            } catch (XmlSchemaSerializerException e) {
+                throw new RuntimeException(e);
+            }
+            Element ele = docs[0].getDocumentElement();
+
             ele = removeImportElement(ele);
             if (context.get(ToolConstants.CFG_VALIDATE_WSDL) != null) {
                 validateSchema(ele);
             }           
             InputSource is = new InputSource((InputStream)null);
+           // key = key.replaceFirst("#types[0-9]+$", "");
             is.setSystemId(key);
             is.setPublicId(key);
             opts.addGrammar(is);
@@ -275,10 +291,11 @@
     // JAXB bug. JAXB ClassNameCollector may not be invoked when generated
     // class is an enum. We need to use this method to add the missed file
     // to classCollector.
-    private void addedEnumClassToCollector(Map<String, Element> schemaList, 
+    private void addedEnumClassToCollector(SchemaCollection schemaCollection, 
                                            ClassNameAllocatorImpl allocator) {
-        for (Element schemaElement : schemaList.values()) {
-            String targetNamespace = schemaElement.getAttribute("targetNamespace");
+        //for (Element schemaElement : schemaList.values()) {
+        for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
+            String targetNamespace = schema.getTargetNamespace();
             if (StringUtils.isEmpty(targetNamespace)) {
                 continue;
             }

Modified: cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/JavaScriptContainer.java
Fri Mar 27 23:35:59 2009
@@ -33,15 +33,13 @@
 
 import javax.wsdl.Definition;
 
-import org.w3c.dom.Element;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.util.PropertiesLoaderUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.service.model.InterfaceInfo;
-import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
@@ -127,28 +125,10 @@
             }
         }
         Map<String, InterfaceInfo> interfaces = new LinkedHashMap<String, InterfaceInfo>();
-
-        Map<String, Element> schemas = (Map<String, Element>)serviceList.get(0)
-            .getProperty(WSDLServiceBuilder.WSDL_SCHEMA_ELEMENT_LIST);
-        if (schemas == null) {
-            schemas = new java.util.HashMap<String, Element>();
-            ServiceInfo serviceInfo = serviceList.get(0);
-            for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
-                if (schemaInfo.getElement() != null && schemaInfo.getSystemId() ==
null) {
-                    String sysId = schemaInfo.getElement().getAttribute("targetNamespce");
-                    if (sysId == null) {
-                        sysId = serviceInfo.getTargetNamespace();
-                    }
-                    if (sysId != null) {
-                        schemas.put(sysId, schemaInfo.getElement());
-                    }
-                }
-                if (schemaInfo.getElement() != null && schemaInfo.getSystemId() !=
null) {
-                    schemas.put(schemaInfo.getSystemId(), schemaInfo.getElement());
-                }
-            }
-        }
-        context.put(ToolConstants.SCHEMA_MAP, schemas);
+        
+        ServiceInfo service0 = serviceList.get(0);
+        SchemaCollection schemaCollection = service0.getXmlSchemaCollection();
+        context.put(ToolConstants.XML_SCHEMA_COLLECTION, schemaCollection);
         context.put(ToolConstants.PORTTYPE_MAP, interfaces);
         context.put(ClassCollector.class, new ClassCollector());
         WSDLToJavaScriptProcessor processor = new WSDLToJavaScriptProcessor();

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
Fri Mar 27 23:35:59 2009
@@ -96,7 +96,10 @@
             if (wsdlNode == null && env.get(ToolConstants.CFG_CATALOG) != null) {
                 wsdlNode = resolveNodeByCatalog(wsdlURL);
             }
-            // TODO: if wsdlNode is null throw exception
+            
+            if (wsdlNode == null) {
+                throw new ToolException(new Message("MISSING_WSDL", LOG, wsdlURL));
+            }
             customizedElements.put(wsdlURL.toString(), wsdlNode);
             bindingFiles = (String[])env.get(ToolConstants.CFG_BINDING);
             if (bindingFiles == null) {
@@ -490,28 +493,11 @@
 
         } else if (isValidJaxbBindingFile(reader)) {
             String schemaLocation = root.getAttribute("schemaLocation");
-            boolean hasJaxbBindingChild = false;
-            
-            List<Element> elemList = 
-                DOMUtils.findAllElementsByTagNameNS(root, 
-                                                    ToolConstants.JAXB_BINDINGS.getNamespaceURI(),

-                                                    ToolConstants.JAXB_BINDINGS.getLocalPart());

-            if (elemList.size() > 1) {
-                hasJaxbBindingChild = true;
-            }
-            
-            elemList = 
-                DOMUtils.findAllElementsByTagNameNS(root, 
-                                                    ToolConstants.JAXB_BINDINGS.getNamespaceURI(),

-                                                    "globalBindings");
-            if (elemList.size() > 1) {
-                hasJaxbBindingChild = true;
-            }
-                           
-            if (StringUtils.isEmpty(schemaLocation) && !hasJaxbBindingChild) {
+            String resolvedSchemaLocation = resolveByCatalog(schemaLocation);
+            if (resolvedSchemaLocation != null) {
                 InputSource tmpIns = null;
                 try {
-                    tmpIns = convertToTmpInputSource(root, wsdlURL);
+                    tmpIns = convertToTmpInputSource(root, resolvedSchemaLocation);
                 } catch (Exception e1) {
                     Message msg = new Message("FAILED_TO_ADD_SCHEMALOCATION", LOG, bindingFile);
                     throw new ToolException(msg, e1);
@@ -519,8 +505,7 @@
                 jaxbBindings.add(tmpIns);
             } else {
                 jaxbBindings.add(new InputSource(bindingFile));
-            }
-
+            } 
         } else {
             Message msg = new Message("UNKNOWN_BINDING_FILE", LOG, bindingFile, reader.getName());
             throw new ToolException(msg);
@@ -557,8 +542,14 @@
     }
 
     private String resolveByCatalog(String url) {
+        if (StringUtils.isEmpty(url)) {
+            return null;
+        }
         Bus bus = (Bus)env.get(Bus.class);
         Catalog catalogResolver = OASISCatalogManager.getCatalogManager(bus).getCatalog();
+        if (catalogResolver == null) {
+            return null;
+        }
         String resolvedLocation;
         try {
             resolvedLocation = catalogResolver.resolveSystem(url);

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/Messages.properties
Fri Mar 27 23:35:59 2009
@@ -31,3 +31,4 @@
 POINT_TO_WSDL_DOES_NOT_EXIST  = Binding file: {0} points to a nonexistent wsdl(resolved as
{1})
 POINT_TO_XSD_DOES_NOT_EXIST  = Binding file: {0} points to a nonexistent xsd(resolved as
{1})
 FAILED_RESOLVE_CATALOG = Failed to resolve catalog {0} 
+MISSING_WSDL = Unable to read {0}.

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
Fri Mar 27 23:35:59 2009
@@ -26,7 +26,6 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 
 import javax.xml.namespace.QName;
@@ -39,12 +38,10 @@
 import org.w3c.dom.Node;
 
 import org.apache.cxf.common.xmlschema.SchemaCollection;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.JavaUtils;
 import org.apache.cxf.jaxb.JAXBUtils;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.model.DefaultValueWriter;
 import org.apache.cxf.tools.util.ClassCollector;
@@ -379,20 +376,6 @@
        
         XmlSchemaElement elementByName = schema.getElementByQName(partElement);
         
-        //is elementByName is null,it could be generate from serviceInfo, we need read the
schema element
-        //into schemaCollection
-        if (elementByName == null) {
-            Map<String, Element> maps = CastUtils.cast((Map<?, ?>)context.get(ToolConstants.SCHEMA_MAP));
-            if (maps != null) {
-                for (Element ele : maps.values()) {
-                    synchronized (ele.getOwnerDocument()) {
-                        schema.read(ele);
-                    }
-                }
-                elementByName = schema.getElementByQName(partElement);
-            }
-        }
-
         XmlSchemaComplexType type = (XmlSchemaComplexType)elementByName.getSchemaType();
 
         XmlSchemaSequence seq = (XmlSchemaSequence)type.getParticle();

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=759391&r1=759390&r2=759391&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Fri Mar 27 23:35:59 2009
@@ -826,9 +826,10 @@
 
     }
     
-    
+    // See CXF-2135
+    @org.junit.Ignore
     @Test
-    public void testReuseJabBindingFile1() throws Exception {
+    public void testReuseJaxbBindingFile1() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, 
                 getLocation("/wsdl2java_wsdl/cxf1094/hello_world.wsdl"));
         env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/cxf1094/jaxbbinding.xml"));



Mime
View raw message