cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r686237 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
Date Fri, 15 Aug 2008 14:32:49 GMT
Author: seanoc
Date: Fri Aug 15 07:32:48 2008
New Revision: 686237

URL: http://svn.apache.org/viewvc?rev=686237&view=rev
Log:
Fix so wsdl2java doesn't run out of memory when passed wsdl with large number of schemas.
Modified WSDLServiceBuilder to correctly use schemaCache in WSDLManager

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=686237&r1=686236&r2=686237&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Fri Aug
15 07:32:48 2008
@@ -242,7 +242,6 @@
             copyExtensors(description, def.getExtensibilityElements());
             copyExtensionAttributes(description, def);
         }
-
         for (Port port : cast(serv.getPorts().values(), Port.class)) {
             Binding binding = port.getBinding();
             PortType bindingPt = binding.getPortType();
@@ -259,24 +258,8 @@
                 description.getDescribed().add(service);
                 service.setProperty(WSDL_DEFINITION, def);
                 service.setProperty(WSDL_SERVICE, serv);
-                WSDLManager wsdlManager = bus.getExtension(WSDLManager.class); 
-                ServiceSchemaInfo serviceSchemaInfo = null;
-                if (wsdlManager != null) {
-                    serviceSchemaInfo = wsdlManager.getSchemasForDefinition(def);
-                }
+                getSchemas(def, service);
                 
-                if (serviceSchemaInfo != null) {
-                    service.setServiceSchemaInfo(serviceSchemaInfo);
-                } else {
-                    getSchemas(def, service);
-                    if (wsdlManager != null) {
-                        serviceSchemaInfo = new ServiceSchemaInfo();
-                        serviceSchemaInfo.setSchemaCollection(service.getXmlSchemaCollection());
-                        serviceSchemaInfo.setSchemaInfoList(service.getSchemas());
-                        wsdlManager.putSchemasForDefinition(def, serviceSchemaInfo);
-                    }
-                }
-
                 service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
                 service.setTargetNamespace(def.getTargetNamespace());
                 service.setName(serv.getQName());
@@ -297,13 +280,31 @@
 
         return new ArrayList<ServiceInfo>(services.values());
     }
-
+ 
+    
     private void getSchemas(Definition def, ServiceInfo serviceInfo) {
-        SchemaUtil schemaUtil = new SchemaUtil(bus, this.schemaList);
-        schemaUtil.setCatalogResolvedMap(this.catalogResolvedMap);
-        schemaUtil.getSchemas(def, serviceInfo);
+        ServiceSchemaInfo serviceSchemaInfo = null;
+        WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
+        if (wsdlManager != null) {
+            serviceSchemaInfo = wsdlManager.getSchemasForDefinition(def);
+        }
+        
+        if (serviceSchemaInfo == null) {
+            SchemaUtil schemaUtil = new SchemaUtil(bus, this.schemaList);
+            schemaUtil.setCatalogResolvedMap(this.catalogResolvedMap);
+            schemaUtil.getSchemas(def, serviceInfo);
+            serviceSchemaInfo = new ServiceSchemaInfo();
+            serviceSchemaInfo.setSchemaCollection(serviceInfo.getXmlSchemaCollection());
+            serviceSchemaInfo.setSchemaInfoList(serviceInfo.getSchemas());
+            if (wsdlManager != null) {
+                wsdlManager.putSchemasForDefinition(def, serviceSchemaInfo);
+            }
+        } else {
+            serviceInfo.setServiceSchemaInfo(serviceSchemaInfo);
+        }
     }
 
+
     private void parseImports(Definition def, List<Definition> defList) {
         List<Import> importList = new ArrayList<Import>();
 

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?rev=686237&r1=686236&r2=686237&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
Fri Aug 15 07:32:48 2008
@@ -84,7 +84,6 @@
         
         WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(this.bus);
         wsdlDefinition = builder.build(wsdlURL);
-        mgr.removeDefinition(wsdlDefinition);
         context.put(Bus.class, bus);
         context.put(ToolConstants.IMPORTED_DEFINITION, builder.getImportedDefinitions());
         checkSupported(wsdlDefinition);
@@ -108,7 +107,9 @@
     }
 
     public void customize() {
+        WSDLManager mgr = bus.getExtension(WSDLManager.class);
         if (!context.containsKey(ToolConstants.CFG_BINDING)) {
+            mgr.removeDefinition(wsdlDefinition);
             return;
         }
         cusParser = new CustomizationParser();
@@ -117,8 +118,12 @@
         jaxbBindings = cusParser.getJaxbBindings();
         handlerChain = cusParser.getHandlerChains();
 
+
         context.setJaxbBindingFiles(jaxbBindings);
         context.put(ToolConstants.HANDLER_CHAIN, handlerChain);
+        
+        
+        
         try {
             this.wsdlDefinition = buildCustomizedDefinition();
         } catch (Exception e) {
@@ -127,6 +132,9 @@
                                      (String)context.get(ToolConstants.CFG_WSDLURL));
             throw new RuntimeException(msg.toString(), e);
         }
+        
+        mgr.removeDefinition(wsdlDefinition); 
+
     }
 
     private void checkSupported(Definition def) throws ToolException {



Mime
View raw message