Author: ningjiang
Date: Fri Oct 31 20:30:51 2008
New Revision: 709633
URL: http://svn.apache.org/viewvc?rev=709633&view=rev
Log:
Merged revisions 708035 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r708035 | bimargulies | 2008-10-27 04:34:42 +0800 (Mon, 27 Oct 2008) | 2 lines
Incremental progress on inheritance.
........
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/DocLitWrappedClientTestBeans.xml
cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 31 20:30:51 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,709353-709354
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,709353-709354
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java?rev=709633&r1=709632&r2=709633&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
Fri Oct 31 20:30:51 2008
@@ -19,6 +19,8 @@
package org.apache.cxf.javascript;
+import java.util.ArrayList;
+import java.util.List;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
@@ -136,6 +138,31 @@
return sequence;
}
+ public static List<XmlSchemaObject>
getContentElements(XmlSchemaComplexType type,
+ SchemaCollection
collection) {
+ List<XmlSchemaObject> results = new ArrayList<XmlSchemaObject>();
+ QName baseTypeName = getBaseType(type);
+ if (baseTypeName != null) {
+ XmlSchemaComplexType baseType =
(XmlSchemaComplexType)collection.getTypeByQName(baseTypeName);
+ // recurse onto the base type ...
+ 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));
+ }
+ return results;
+ } else {
+ // no base type, the simple case.
+ XmlSchemaSequence sequence = getSequence(type);
+ for (int i = 0; i < sequence.getItems().getCount(); i++) {
+ results.add(sequence.getItems().getItem(i));
+ }
+ return results;
+ }
+
+ }
+
public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) {
XmlSchemaParticle particle = type.getParticle();
XmlSchemaSequence sequence = null;
Modified:
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=709633&r1=709632&r2=709633&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Fri Oct 31 20:30:51 2008
@@ -179,7 +179,7 @@
public void complexTypeConstructorAndAccessors(QName name,
XmlSchemaComplexType type) {
accessors = new StringBuilder();
utils = new JavascriptUtils(code);
- XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(type);
+ List<XmlSchemaObject> items = XmlSchemaUtils.getContentElements(type,
xmlSchemaCollection);
final String elementPrefix = "this._";
@@ -190,16 +190,14 @@
code.append("function " + typeObjectName + " () {\n");
// to assist in debugging we put a type property into every object.
utils.appendLine("this.typeMarker = '" + typeObjectName + "';");
- for (int i = 0; i < sequence.getItems().getCount(); i++) {
- XmlSchemaObject thing = sequence.getItems().getItem(i);
- constructOneElement(type, sequence, elementPrefix, typeObjectName,
thing);
+ for (XmlSchemaObject thing : items) {
+ constructOneElement(type, elementPrefix, typeObjectName, thing);
}
code.append("}\n\n");
code.append(accessors.toString());
}
private void constructOneElement(XmlSchemaComplexType type,
- XmlSchemaSequence sequence,
final String elementPrefix,
String typeObjectName,
XmlSchemaObject thing) {
@@ -347,23 +345,8 @@
*/
protected void complexTypeSerializerBody(XmlSchemaComplexType type, String
elementPrefix,
JavascriptUtils bodyUtils) {
- XmlSchemaSequence sequence = null;
- // deal with type extension.
- QName baseTypeName = XmlSchemaUtils.getBaseType(type);
- if (baseTypeName != null) {
- XmlSchemaType baseType =
xmlSchemaCollection.getTypeByQName(baseTypeName);
- XmlSchemaComplexType baseComplexType = (XmlSchemaComplexType)
baseType;
- // I think we can recurse ...?
- complexTypeSerializerBody(baseComplexType, elementPrefix,
bodyUtils);
- sequence = XmlSchemaUtils.getContentSequence(type);
- }
-
- if (sequence == null) {
- sequence = XmlSchemaUtils.getSequence(type);
- }
-
- for (int i = 0; i < sequence.getItems().getCount(); i++) {
- XmlSchemaObject sequenceItem =
(XmlSchemaObject)sequence.getItems().getItem(i);
+ List<XmlSchemaObject> items = XmlSchemaUtils.getContentElements(type,
xmlSchemaCollection);
+ for (XmlSchemaObject sequenceItem : items) {
ParticleInfo itemInfo = ParticleInfo.forLocalItem(sequenceItem,
schemaInfo.getSchema(),
xmlSchemaCollection,
Modified:
cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java?rev=709633&r1=709632&r2=709633&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
Fri Oct 31 20:30:51 2008
@@ -242,7 +242,6 @@
});
}
-
@Test
public void callTest2WithNullString() {
Modified:
cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/DocLitWrappedClientTestBeans.xml
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/DocLitWrappedClientTestBeans.xml?rev=709633&r1=709632&r2=709633&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/DocLitWrappedClientTestBeans.xml
(original)
+++
cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/DocLitWrappedClientTestBeans.xml
Fri Oct 31 20:30:51 2008
@@ -30,6 +30,7 @@
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+ <import
resource="classpath:META-INF/cxf/cxf-extension-javascript-client.xml" />
<jaxws:server id="dlw-service-endpoint"
address="http://localhost:8808/SimpleDocLitWrapped" >
Modified:
cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
URL:
http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js?rev=709633&r1=709632&r2=709633&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
(original)
+++
cxf/branches/2.1.x-fixes/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitWrappedTests.js
Fri Oct 31 20:30:51 2008
@@ -115,4 +115,23 @@
intf.beanFunction(test1SuccessCallback, test1ErrorCallback, beanArg,
beansArg);
// Return the notifier as a convenience to the Java code.
return globalNotifier;
+}
+
+function testInheritance(url) {
+ org_apache_cxf_trace.trace("inheritance test.");
+ resetGlobals();
+ globalNotifier = new org_apache_cxf_notifier();
+
+ var intf;
+
+ intf = new org_apache_cxf_javascript_fortest_SimpleDocLitWrapped();
+ intf.url = url;
+
+ var derived = new
org_apache_cxf_javascript_testns_inheritanceTestDerived();
+ derived.setId(33);
+ derived.setDerived("arrived");
+ derived.setName("less");
+ intf.inheritanceTestFunction(derived);
+
+ return globalNotifier;
}
\ No newline at end of file