cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r826742 - in /cxf/branches/2.2.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/xmlschema/ rt/javascript/src/main/java/org/apache/cxf/javascript/types/ tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/...
Date Mon, 19 Oct 2009 18:11:01 GMT
Author: dkulp
Date: Mon Oct 19 18:11:00 2009
New Revision: 826742

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

........
  r826301 | bimargulies | 2009-10-17 16:01:22 -0400 (Sat, 17 Oct 2009) | 1 line
  
  CXF-2477: in wsdl2js, process all the schemas, not just those that end up attached to the
service info with SchemaInfo objects.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
    cxf/branches/2.2.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java

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

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java?rev=826742&r1=826741&r2=826742&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
Mon Oct 19 18:11:00 2009
@@ -338,8 +338,10 @@
             results.addAll(getContentElements(baseType, collection));
             // and now process our sequence.
             XmlSchemaSequence extSequence = getContentSequence(type);
-            for (int i = 0; i < extSequence.getItems().getCount(); i++) {
-                results.add(extSequence.getItems().getItem(i));
+            if (extSequence != null) {
+                for (int i = 0; i < extSequence.getItems().getCount(); i++) {
+                    results.add(extSequence.getItems().getItem(i));
+                }
             }
             return results;
         } else {

Modified: cxf/branches/2.2.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=826742&r1=826741&r2=826742&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Mon Oct 19 18:11:00 2009
@@ -29,6 +29,7 @@
 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.common.xmlschema.XmlSchemaConstants;
 import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
 import org.apache.cxf.javascript.AttributeInfo;
 import org.apache.cxf.javascript.ItemInfo;
@@ -41,6 +42,7 @@
 import org.apache.ws.commons.schema.XmlSchemaAnnotated;
 import org.apache.ws.commons.schema.XmlSchemaAny;
 import org.apache.ws.commons.schema.XmlSchemaAttribute;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaObject;
@@ -77,6 +79,16 @@
         this.nameManager = nameManager;
         this.prefixAccumulator = prefixAccumulator;
     }
+    
+    public String generateCodeForSchemaCollection(XmlSchemaCollection collection) {
+        StringBuilder accumulatedCode = new StringBuilder();
+        for (XmlSchema schema : collection.getXmlSchemas()) {
+            if (!XmlSchemaConstants.XSD_NAMESPACE_URI.equals(schema.getTargetNamespace()))
{
+                accumulatedCode.append(generateCodeForSchema(schema));
+            }
+        }
+        return accumulatedCode.toString();
+    }
 
     public String generateCodeForSchema(XmlSchema schema) {
         xmlSchema = schema;

Modified: cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java?rev=826742&r1=826741&r2=826742&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java
Mon Oct 19 18:11:00 2009
@@ -27,7 +27,6 @@
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.nio.charset.Charset;
-import java.util.Collection;
 import java.util.Map;
 import java.util.logging.Logger;
 
@@ -39,11 +38,11 @@
 import org.apache.cxf.javascript.NamespacePrefixAccumulator;
 import org.apache.cxf.javascript.service.ServiceJavascriptBuilder;
 import org.apache.cxf.javascript.types.SchemaJavascriptBuilder;
-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.ToolException;
 import org.apache.cxf.tools.wsdlto.core.WSDLToProcessor;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
 
 public class WSDLToJavaScriptProcessor extends WSDLToProcessor {
     private static final Logger LOG = LogUtils.getL7dLogger(WSDLToJavaScriptProcessor.class);
@@ -70,7 +69,6 @@
             }
         }
         
-        Collection<SchemaInfo> schemata = serviceInfo.getSchemas();
         try {
             FileOutputStream fileOutputStream = new FileOutputStream(jsFile);
             if (null != context.get(ToolConstants.CFG_JAVASCRIPT_UTILS)) {
@@ -80,15 +78,13 @@
             
             OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream,
UTF8);
             BufferedWriter writer = new BufferedWriter(outputStreamWriter);
-                
-            for (SchemaInfo schema : schemata) {
-                LOG.fine("Processing schema " + schema.toString());
-                SchemaJavascriptBuilder jsBuilder = 
-                    new SchemaJavascriptBuilder(serviceInfo
-                    .getXmlSchemaCollection(), prefixManager, nameManager);
-                String allThatJavascript = jsBuilder.generateCodeForSchema(schema.getSchema());
-                writer.append(allThatJavascript);
-            }
+            
+            XmlSchemaCollection collection = serviceInfo.getXmlSchemaCollection().getXmlSchemaCollection();
+            SchemaJavascriptBuilder jsBuilder = 
+                new SchemaJavascriptBuilder(serviceInfo
+                .getXmlSchemaCollection(), prefixManager, nameManager);
+            String jsForSchemas = jsBuilder.generateCodeForSchemaCollection(collection);

+            writer.append(jsForSchemas);
 
             ServiceJavascriptBuilder serviceBuilder = new ServiceJavascriptBuilder(serviceInfo,

                                                                                    null,



Mime
View raw message