cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r598051 - in /incubator/cxf/trunk/rt/javascript/src: main/java/org/apache/cxf/javascript/ main/java/org/apache/cxf/javascript/service/ test/java/org/apache/cxf/javascript/ test/java/org/apache/cxf/javascript/fortest/ test/resources/
Date Sun, 25 Nov 2007 21:01:54 GMT
Author: bimargulies
Date: Sun Nov 25 13:01:53 2007
New Revision: 598051

URL: http://svn.apache.org/viewvc?rev=598051&view=rev
Log:
Code Doc/Literal/Bare

This runs into a service/schema model problem, so the test is commented out.

Modified:
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java?rev=598051&r1=598050&r2=598051&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
Sun Nov 25 13:01:53 2007
@@ -200,12 +200,13 @@
                                                String referencingURI,
                                                XmlSchemaType containingType) {
         boolean nillable = element.isNillable();
+        boolean optional = XmlSchemaUtils.isParticleOptional(element);
         
         XmlSchemaType elType = 
             XmlSchemaUtils.getElementType(xmlSchemaCollection, referencingURI, element, containingType);
         
         // first question: optional?
-        if (XmlSchemaUtils.isParticleOptional(element)) {
+        if (optional) {
             startIf(elementJavascriptName + " != null");
         }
         
@@ -216,7 +217,7 @@
             appendString("<" + elementXmlName + " " + XmlSchemaUtils.NIL_ATTRIBUTES +
"/>");
             appendElse();
         }
-        
+
         if (XmlSchemaUtils.isParticleArray(element)) {
             // protected against null in arrays.
             startIf(elementJavascriptName + " != null");
@@ -225,27 +226,21 @@
             // we need an extra level of 'nil' testing here. Or do we, depending on the type
structure?
             // Recode and fiddle appropriately.
             startIf(elementJavascriptName + " == null");
-            appendString("<" + elementXmlName + " " + XmlSchemaUtils.NIL_ATTRIBUTES +
"/>");
+            if (nillable) {
+                appendString("<" + elementXmlName + " " + XmlSchemaUtils.NIL_ATTRIBUTES
+ "/>");
+            } else {
+                appendString("<" + elementXmlName + "/>");                    
+            }
             appendElse();
         }
         
         // now for the thing itself.
         if (elType instanceof XmlSchemaComplexType) {
-            if (element.getMinOccurs() != 0) { // required
-                startIf(elementJavascriptName + " == null");
-                appendString("<" + elementXmlName + " " + XmlSchemaUtils.NIL_ATTRIBUTES
+ "/>");
-                appendElse();
-                appendExpression(elementJavascriptName + ".serialize(" 
-                                 + utilsVarName + ", '" 
-                                 + elementXmlName + "')");
-                endBlock();
-            } else {
-                startIf(elementJavascriptName + " != null");
-                appendExpression(elementJavascriptName + ".serialize(cxfjsutils, '"  
-                                 + elementXmlName + "')");
-                endBlock();
-            }
-        } else {
+            // it has a value
+            appendExpression(elementJavascriptName + ".serialize(" 
+                                     + utilsVarName + ", '" 
+                                     + elementXmlName + "')");
+        } else { // simple type
             QName typeName = elType.getQName();
             appendString("<" + elementXmlName + ">");
             // warning: this assumes that ordinary Javascript serialization is all we need.

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java?rev=598051&r1=598050&r2=598051&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
Sun Nov 25 13:01:53 2007
@@ -198,6 +198,7 @@
     }
     
     public static boolean isParticleArray(XmlSchemaParticle particle) {
+        // I don't know why maxOccurs=0 is popular.
         return particle.getMaxOccurs() > 1;
     }
     

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=598051&r1=598050&r2=598051&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
Sun Nov 25 13:01:53 2007
@@ -455,28 +455,20 @@
                                                  serviceSchemaInfo.getNamespaceURI(),
                                                  null);
         } else {
+            int px = 0;
             // Multiple parts violates WS-I, but we can still do them.
             for (ElementAndNames ean : unwrappedElementsAndNames) {
                 utils.generateCodeToSerializeElement("cxfutils",
                                                      ean.getElement(),
-                                                     ean.getJavascriptName(),
+                                                     "args[" + px + "]",
                                                      ean.getXmlName(),
                                                      xmlSchemaCollection,
                                                      serviceSchemaInfo.getNamespaceURI(),
                                                      null);
+                px++;
             }
         }
 
-//        int px = 0;
-//        for (ElementAndNames partElement : elements) {
-//            LOG.fine("Serialize part - message " + msg.getName() + " part " + partElement.getXmlName());

-//            utils.generateCodeToSerializeElement("cxfutils", partElement.getElement(),
-//                                                 "args[" + px + "]",
-//                                                 partElement.getXmlName(), xmlSchemaCollection,
-//                                                 serviceSchemaInfo.getNamespaceURI(), null);
-//            px++;
-//        }
-
         utils.appendLine("xml = xml + cxfutils.endSoap11Message();");
         utils.appendLine("return xml;");
         code.append("}\n\n");
@@ -579,7 +571,7 @@
     public void begin(ServiceInfo service) {
         
         code.append("//\n");
-        code.append("// Definitions for service: " + service.toString() + "\n");
+        code.append("// Definitions for service: " + service.getName().toString() + "\n");
         code.append("//\n");
 
         BindingInfo xml = null;

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java?rev=598051&r1=598050&r2=598051&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
Sun Nov 25 13:01:53 2007
@@ -40,6 +40,11 @@
 import org.mozilla.javascript.Scriptable;
 import org.springframework.context.support.GenericApplicationContext;
 
+/*
+ * We end up here with a part with isElement == true, a non-array element, 
+ * but a complex type for an array of the element.
+ */
+
 @org.junit.Ignore
 public class DocLitBareClientTest extends AbstractCXFSpringTest {
 

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java?rev=598051&r1=598050&r2=598051&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
Sun Nov 25 13:01:53 2007
@@ -21,13 +21,13 @@
 
 import javax.jws.WebService;
 
-//import org.apache.cxf.feature.Features;
+import org.apache.cxf.feature.Features;
 
 /**
  * 
  */
 @WebService(endpointInterface = "org.apache.cxf.javascript.fortest.SimpleDocLitBare")
-//@Features(features = "org.apache.cxf.feature.LoggingFeature")   
+@Features(features = "org.apache.cxf.feature.LoggingFeature")   
 public class SimpleDocLitBareImpl implements SimpleDocLitBare {
     
     private String lastString;

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties?rev=598051&r1=598050&r2=598051&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties (original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/logging.properties Sun Nov 25 13:01:53
2007
@@ -23,8 +23,8 @@
 .level= INFO
 java.util.logging.ConsoleHandler.level = FINEST
 java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-#org.apache.cxf.javascript.service.ServiceJavascriptBuilder.level=FINEST
-#org.apache.cxf.javascript.types.SchemaJavascriptBuilder.level=FINEST
+org.apache.cxf.javascript.service.ServiceJavascriptBuilder.level=FINEST
+org.apache.cxf.javascript.types.SchemaJavascriptBuilder.level=FINEST
 #org.apache.cxf.javascript.JavascriptTestUtilities.level=FINE
 #org.apache.cxf.javascript.JsXMLHttpRequest.level = FINE
 #org.apache.cxf.javascript.service.DocLitWrappedTest.level=FINE



Mime
View raw message