cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r826300 - in /cxf/trunk: rt/javascript/src/main/java/org/apache/cxf/javascript/ rt/javascript/src/main/java/org/apache/cxf/javascript/types/ rt/javascript/src/test/java/org/apache/cxf/javascript/ rt/javascript/src/test/java/org/apache/cxf/j...
Date Sat, 17 Oct 2009 20:00:56 GMT
Author: bimargulies
Date: Sat Oct 17 20:00:56 2009
New Revision: 826300

URL: http://svn.apache.org/viewvc?rev=826300&view=rev
Log:
CXF-2477: change focus of SchemaJavascriptBuilder to XmlSchema object from CXF SchemaInfo.
This will
make it easier to add processing for entire collection.

Modified:
    cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
    cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/GenericAegisTest.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/AttributeTest.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/SerializationTest.java
    cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
    cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java

Modified: cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java?rev=826300&r1=826299&r2=826300&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
(original)
+++ cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandler.java
Sat Oct 17 20:00:56 2009
@@ -144,7 +144,7 @@
                 for (SchemaInfo schema : schemata) {
                     SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo
                         .getXmlSchemaCollection(), prefixManager, nameManager);
-                    String allThatJavascript = builder.generateCodeForSchema(schema);
+                    String allThatJavascript = builder.generateCodeForSchema(schema.getSchema());
                     writer.append(allThatJavascript);
                 }
 

Modified: cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=826300&r1=826299&r2=826300&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++ cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Sat Oct 17 20:00:56 2009
@@ -37,7 +37,6 @@
 import org.apache.cxf.javascript.NamespacePrefixAccumulator;
 import org.apache.cxf.javascript.ParticleInfo;
 import org.apache.cxf.javascript.UnsupportedConstruct;
-import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaAnnotated;
 import org.apache.ws.commons.schema.XmlSchemaAny;
@@ -62,7 +61,7 @@
     private SchemaCollection xmlSchemaCollection;
     private NameManager nameManager;
     private NamespacePrefixAccumulator prefixAccumulator;
-    private SchemaInfo schemaInfo;
+    //private SchemaInfo schemaInfo;
 
     // In general, I (bimargulies) hate fields that are temporary communications
     // between members of a class. However, given the style restrictions on the
@@ -70,6 +69,7 @@
     private StringBuilder code;
     private StringBuilder accessors;
     private JavascriptUtils utils;
+    private XmlSchema xmlSchema;
 
     public SchemaJavascriptBuilder(SchemaCollection schemaCollection,
                                    NamespacePrefixAccumulator prefixAccumulator, NameManager
nameManager) {
@@ -78,17 +78,17 @@
         this.prefixAccumulator = prefixAccumulator;
     }
 
-    public String generateCodeForSchema(SchemaInfo schema) {
-        schemaInfo = schema;
+    public String generateCodeForSchema(XmlSchema schema) {
+        xmlSchema = schema;
         code = new StringBuilder();
         code.append("//\n");
-        code.append("// Definitions for schema: " + schema.getNamespaceURI());
-        if (schema.getSystemId() != null) {
-            code.append("\n//  " + schema.getSystemId());
+        code.append("// Definitions for schema: " + schema.getTargetNamespace());
+        if (schema.getSourceURI() != null) {
+            code.append("\n//  " + schema.getSourceURI());
         }
         code.append("\n//\n");
 
-        XmlSchemaObjectTable schemaTypes = schema.getSchema().getSchemaTypes();
+        XmlSchemaObjectTable schemaTypes = schema.getSchemaTypes();
         Iterator namesIterator = schemaTypes.getNames();
         while (namesIterator.hasNext()) {
             QName name = (QName)namesIterator.next();
@@ -122,7 +122,7 @@
         }
 
         // now add in global elements with anonymous types.
-        schemaTypes = schema.getSchema().getElements();
+        schemaTypes = schema.getElements();
         namesIterator = schemaTypes.getNames();
         while (namesIterator.hasNext()) {
             QName name = (QName)namesIterator.next();
@@ -136,7 +136,8 @@
                     XmlSchemaElement element = (XmlSchemaElement)xmlSchemaObject;
                     if (element.getSchemaTypeName() == null && element.getSchemaType()
== null) {
                         Message message = new Message("ELEMENT_MISSING_TYPE", LOG, element.getQName(),
-                                                      element.getSchemaTypeName(), schema.getNamespaceURI());
+                                                      element.getSchemaTypeName(), 
+                                                      schema.getTargetNamespace());
                         LOG.warning(message.toString());
                         continue;
                     }
@@ -144,7 +145,7 @@
                     if (element.getSchemaType() != null) {
                         type = element.getSchemaType();
                     } else {
-                        type = schema.getSchema().getTypeByName(element.getSchemaTypeName());
+                        type = schema.getTypeByName(element.getSchemaTypeName());
                     }
                     if (!(type instanceof XmlSchemaComplexType)) {
                         // we never make classes for simple type.
@@ -194,7 +195,7 @@
         utils.appendLine("this.typeMarker = '" + typeObjectName + "';");
         for (XmlSchemaObject thing : items) {
             ParticleInfo itemInfo = ParticleInfo.forLocalItem(thing, 
-                                                              schemaInfo.getSchema(),
+                                                              xmlSchema,
                                                               xmlSchemaCollection, 
                                                               prefixAccumulator, 
                                                               type.getQName()); 
@@ -202,7 +203,7 @@
         }
         
         for (XmlSchemaAnnotated thing : attrs) {
-            AttributeInfo itemInfo = AttributeInfo.forLocalItem(thing, schemaInfo.getSchema(),
+            AttributeInfo itemInfo = AttributeInfo.forLocalItem(thing, xmlSchema,
                                                                 xmlSchemaCollection,
                                                                 prefixAccumulator,
                                                                 type.getQName());
@@ -358,7 +359,7 @@
         List<XmlSchemaObject> items = XmlSchemaUtils.getContentElements(type, xmlSchemaCollection);
         for (XmlSchemaObject sequenceItem : items) {
             ParticleInfo itemInfo = ParticleInfo.forLocalItem(sequenceItem, 
-                                                              schemaInfo.getSchema(), 
+                                                              xmlSchema, 
                                                               xmlSchemaCollection, 
                                                               prefixAccumulator, 
                                                               type.getQName()); 
@@ -404,7 +405,7 @@
             XmlSchemaObject contentElement = contentElements.get(i);
             utils.appendLine("cxfjsutils.trace('curElement: ' + cxfjsutils.traceElementName(curElement));");
             ParticleInfo itemInfo = ParticleInfo.forLocalItem(contentElement,
-                                                              schemaInfo.getSchema(),
+                                                              xmlSchema,
                                                               xmlSchemaCollection, 
                                                               prefixAccumulator, 
                                                               type.getQName()); 
@@ -413,7 +414,7 @@
                 if (i != nContentElements - 1) {
                     XmlSchemaObject nextThing = contentElements.get(i + 1);
                     nextItem = ParticleInfo.forLocalItem(nextThing, 
-                                                         schemaInfo.getSchema(), 
+                                                         xmlSchema, 
                                                          xmlSchemaCollection, 
                                                          prefixAccumulator, 
                                                          type.getQName()); 
@@ -440,7 +441,7 @@
             String ns = namespaces[x];
             nslist.append("'");
             if ("##targetNamespace".equals(ns)) {
-                nslist.append(schemaInfo.getNamespaceURI());
+                nslist.append(xmlSchema.getTargetNamespace());
             } else if ("##local".equals(ns)) {
                 // nothing, empty string
             } else {
@@ -499,7 +500,7 @@
         
         utils.appendLine("var matcher = new org_apache_cxf_any_ns_matcher("
                          + matchType
-                         + ", '" + schemaInfo.getNamespaceURI() + "'"
+                         + ", '" + xmlSchema.getTargetNamespace() + "'"
                          + ", " + namespaceList
                          + ", " + nextLocalPartConstant
                          + ");");
@@ -566,7 +567,7 @@
 
     private void deserializeElement(XmlSchemaComplexType type, XmlSchemaObject thing) {
         ParticleInfo itemInfo = ParticleInfo.forLocalItem(thing, 
-                                                          schemaInfo.getSchema(),
+                                                          xmlSchema,
                                                           xmlSchemaCollection, 
                                                           prefixAccumulator, 
                                                           type.getQName());
@@ -577,7 +578,7 @@
         String accessorName = "set" + StringUtils.capitalize(itemInfo.getJavascriptName());
         utils.appendLine("cxfjsutils.trace('processing " + itemInfo.getJavascriptName() +
"');");
         XmlSchemaElement element = (XmlSchemaElement) itemInfo.getParticle();
-        QName elementQName = XmlSchemaUtils.getElementQualifiedName(element, schemaInfo.getSchema());

+        QName elementQName = XmlSchemaUtils.getElementQualifiedName(element, xmlSchema);

         String elementNamespaceURI = elementQName.getNamespaceURI();
         boolean elementNoNamespace = "".equals(elementNamespaceURI);
         XmlSchema elementSchema = null;
@@ -587,7 +588,7 @@
         boolean qualified = !elementNoNamespace
                             && XmlSchemaUtils.isElementQualified(element, 
                                                                  itemInfo.isGlobal(), 
-                                                                 schemaInfo.getSchema(),
+                                                                 xmlSchema,
                                                                  elementSchema);
 
         if (!qualified) {

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/GenericAegisTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/GenericAegisTest.java?rev=826300&r1=826299&r2=826300&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/GenericAegisTest.java
(original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/GenericAegisTest.java
Sat Oct 17 20:00:56 2009
@@ -64,7 +64,7 @@
         for (SchemaInfo schema : schemata) {
             SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo
                 .getXmlSchemaCollection(), prefixManager, nameManager);
-            String allThatJavascript = builder.generateCodeForSchema(schema);
+            String allThatJavascript = builder.generateCodeForSchema(schema.getSchema());
             assertNotNull(allThatJavascript);
         }
 

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java?rev=826300&r1=826299&r2=826300&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java
(original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java
Sat Oct 17 20:00:56 2009
@@ -409,7 +409,7 @@
         for (SchemaInfo schema : schemata) {
             SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo
                 .getXmlSchemaCollection(), prefixManager, nameManager);
-            String allThatJavascript = builder.generateCodeForSchema(schema);
+            String allThatJavascript = builder.generateCodeForSchema(schema.getSchema());
             readStringIntoRhino(allThatJavascript, schema.toString() + ".js");
         }
 

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/AttributeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/AttributeTest.java?rev=826300&r1=826299&r2=826300&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/AttributeTest.java
(original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/AttributeTest.java
Sat Oct 17 20:00:56 2009
@@ -185,7 +185,7 @@
         for (SchemaInfo schema : schemata) {
             SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo
                 .getXmlSchemaCollection(), prefixAccumulator, nameManager);
-            String allThatJavascript = builder.generateCodeForSchema(schema);
+            String allThatJavascript = builder.generateCodeForSchema(schema.getSchema());
             assertNotNull(allThatJavascript);
             testUtilities.readStringIntoRhino(allThatJavascript, schema.toString() + ".js");
         }

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/SerializationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/SerializationTest.java?rev=826300&r1=826299&r2=826300&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/SerializationTest.java
(original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/types/SerializationTest.java
Sat Oct 17 20:00:56 2009
@@ -202,7 +202,7 @@
         for (SchemaInfo schema : schemata) {
             SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo
                 .getXmlSchemaCollection(), prefixAccumulator, nameManager);
-            String allThatJavascript = builder.generateCodeForSchema(schema);
+            String allThatJavascript = builder.generateCodeForSchema(schema.getSchema());
             assertNotNull(allThatJavascript);
             testUtilities.readStringIntoRhino(allThatJavascript, schema.toString() + ".js");
         }

Modified: cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java?rev=826300&r1=826299&r2=826300&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
(original)
+++ cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessor.java
Sat Oct 17 20:00:56 2009
@@ -124,7 +124,7 @@
             for (SchemaInfo schema : schemata) {
                 SchemaJavascriptBuilder jsBuilder = new SchemaJavascriptBuilder(serviceInfo
                     .getXmlSchemaCollection(), prefixManager, nameManager);
-                String allThatJavascript = jsBuilder.generateCodeForSchema(schema);
+                String allThatJavascript = jsBuilder.generateCodeForSchema(schema.getSchema());
                 writer.append(allThatJavascript);
             }
 

Modified: cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java?rev=826300&r1=826299&r2=826300&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/javascript/src/main/java/org/apache/cxf/tools/wsdlto/javascript/WSDLToJavaScriptProcessor.java
Sat Oct 17 20:00:56 2009
@@ -29,8 +29,10 @@
 import java.nio.charset.Charset;
 import java.util.Collection;
 import java.util.Map;
+import java.util.logging.Logger;
 
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.javascript.BasicNameManager;
 import org.apache.cxf.javascript.JavascriptQueryHandler;
@@ -44,6 +46,7 @@
 import org.apache.cxf.tools.wsdlto.core.WSDLToProcessor;
 
 public class WSDLToJavaScriptProcessor extends WSDLToProcessor {
+    private static final Logger LOG = LogUtils.getL7dLogger(WSDLToJavaScriptProcessor.class);
     private static final Charset UTF8 = Charset.forName("utf-8");
     
     public void process() throws ToolException {
@@ -79,10 +82,11 @@
             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);
+                String allThatJavascript = jsBuilder.generateCodeForSchema(schema.getSchema());
                 writer.append(allThatJavascript);
             }
 



Mime
View raw message