tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1236129 - in /tuscany/sca-java-2.x/trunk: modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/ modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/ modules/databinding-...
Date Thu, 26 Jan 2012 10:24:44 GMT
Author: slaws
Date: Thu Jan 26 10:24:43 2012
New Revision: 1236129

URL: http://svn.apache.org/viewvc?rev=1236129&view=rev
Log:
TUSCANY-3800, TUSCANY-3283, TUSCANY-3298 - more wsdlgen updates from 1.x.

Added:
    tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite
    tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite
Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
    tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
    tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
    tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
    tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
    tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
    tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
    tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/java/datatypes/impl/GetDataServiceWithoutExceptionImpl.java
    tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/resources/helloworld.composite
    tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DataTypesTestCase.java
    tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DynamicSDOTestCase.java
    tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/helloworld/WSDLGenTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
Thu Jan 26 10:24:43 2012
@@ -85,6 +85,8 @@ import org.apache.tuscany.sca.xsd.XSDFac
 import org.apache.tuscany.sca.xsd.XSDefinition;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexContent;
+import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaException;
@@ -197,10 +199,11 @@ public class Interface2WSDLGenerator {
         if (db == null) {
             return null;
         }
-        if ("java:array".equals(db)) {
-            DataType dt = (DataType)type.getLogical();
-            db = dt.getDataBinding();
-        }
+        // TUSCANY-3800
+        while ("java:array".equals(db)) {
+            type = (DataType)type.getLogical();
+            db = type.getDataBinding();
+         }        
         return helpers.get(db);
     }
     
@@ -373,7 +376,7 @@ public class Interface2WSDLGenerator {
         // call each helper in turn to populate the wsdl.types element
         XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
 
-        // TUSCANY-3283 - "true" here means also generate the include the wrapper types for
xsd generation using JAXB
+        // TUSCANY-3283 - "true" here means also generate the wrapper types using JAXB
         Map<XMLTypeHelper, List<DataType>> dataTypes = getDataTypes(interfaze,
true, helpers);
         for (Map.Entry<XMLTypeHelper, List<DataType>> en: dataTypes.entrySet())
{
             XMLTypeHelper helper = en.getKey();
@@ -387,7 +390,9 @@ public class Interface2WSDLGenerator {
             mergeNoNamespaceSchema(namespaceURI, xsDefinitions);
             
             for (XSDefinition xsDef: xsDefinitions) {
-                addSchemaExtension(xsDef, schemaCollection, wsdlDefinition, definition);
+                //addSchemaExtension(xsDef, schemaCollection, wsdlDefinition, definition);
+                loadXSD(schemaCollection, xsDef);
+                wsdlDefinition.getXmlSchemas().add(xsDef);
             }
         }
         
@@ -397,10 +402,17 @@ public class Interface2WSDLGenerator {
                 wrappers.remove(wrapperName);
             }
         }
+        
+        // below we might generate wrapper schema into a DOM. If the schema are in a namespace
+        // that is already been loaded then we need to throw away the schema collection and
reload
+        // it because you can't load a DOM into a schema collection if the schema for the
namespace
+        // has already been loaded
+        boolean reloadSchema = false;
 
         // generate schema elements for wrappers that aren't defined in the schemas
         // TUSCANY-3283 - as we're generating wrappers with JAXB it won't 
-        //                go through here for all wrappers???
+        //                go through here for all wrappers. It will just have to do there
ones
+        //                where there is no JAXB mapping for the child types, e.g. SDO DataObject
         if (wrappers.size() > 0) {
             int i = 0;
             int index = 0;
@@ -415,24 +427,25 @@ public class Interface2WSDLGenerator {
                     schemaDoc = xsDef.getDocument();
                     schema = schemaDoc.getDocumentElement();
                 } else {
-                    // TUSCANY-3283 - if we have to generate a new check to see if the 
+                    // TUSCANY-3283 - if we have to generate a new schema check to see if
the 
                     //                WSDL doc already has a schema in this namespace   
                   
-//                    xsDef = wsdlDefinition.getSchema(targetNS);
-//                    if (xsDef != null) {
-//                        schemaDoc = xsDef.getDocument();
-//                        schema = schemaDoc.getDocumentElement();
-//                        wrapperXSDs.put(targetNS, xsDef);
-//                        Map<String, String> prefixMap = prefixMaps.get(schema);
-//                        if (prefixMap == null){
-//                            prefixMap = new HashMap<String, String>();
-//                            prefixMaps.put(schema, prefixMap);
-//                            String [] prefixes = xsDef.getSchema().getNamespaceContext().getDeclaredPrefixes();
-//                            for (int j = 0; j < prefixes.length; j++){
-//                                prefixMap.put(xsDef.getSchema().getNamespaceContext().getNamespaceURI(prefixes[j]),
-//                                              prefixes[j]);
-//                            }
-//                        } 
-//                    } else {                    
+                    xsDef = wsdlDefinition.getSchema(targetNS);
+                    if (xsDef != null) {
+                        schemaDoc = xsDef.getDocument();
+                        schema = schemaDoc.getDocumentElement();
+                        //wrapperXSDs.put(targetNS, xsDef);
+                        Map<String, String> prefixMap = prefixMaps.get(schema);
+                        if (prefixMap == null){
+                            prefixMap = new HashMap<String, String>();
+                            prefixMaps.put(schema, prefixMap);
+                            String [] prefixes = xsDef.getSchema().getNamespaceContext().getDeclaredPrefixes();
+                            for (int j = 0; j < prefixes.length; j++){
+                                prefixMap.put(xsDef.getSchema().getNamespaceContext().getNamespaceURI(prefixes[j]),
+                                             prefixes[j]);
+                            }
+                        } 
+                        reloadSchema = true;
+                    } else {                    
                         schemaDoc = createDocument();
                         schema = schemaDoc.createElementNS(SCHEMA_NS, "xs:schema");
                         // The elementFormDefault should be set to unqualified, see TUSCANY-2388
@@ -441,8 +454,9 @@ public class Interface2WSDLGenerator {
                         schema.setAttribute("targetNamespace", targetNS);
                         schema.setAttributeNS(XMLNS_NS, "xmlns:xs", SCHEMA_NS);
                         schemaDoc.appendChild(schema);
-                        Schema schemaExt = createSchemaExt(definition);
-                        schemaExt.setElement(schema);
+                        // TUSCANY-3283 - the extension is created at the bottom
+                        //Schema schemaExt = createSchemaExt(definition);
+                        //schemaExt.setElement(schema);
                         prefixMaps.put(schema, new HashMap<String, String>());
                         xsDef = xsdFactory.createXSDefinition();
                         xsDef.setUnresolved(true);
@@ -452,7 +466,8 @@ public class Interface2WSDLGenerator {
                         xsDef.setLocation(URI.create("xsd_" + index + ".xsd"));
                         index++;
                         wrapperXSDs.put(targetNS, xsDef);
-//                    }
+                        wsdlDefinition.getXmlSchemas().add(xsDef);
+                    }
                 }
                 Element wrapper = schemaDoc.createElementNS(SCHEMA_NS, "xs:element");
                 schema.appendChild(wrapper);
@@ -523,13 +538,19 @@ public class Interface2WSDLGenerator {
                     }
                 }
             }
- 
-            // resolve XSDefinitions containing generated wrappers
-            for (XSDefinition xsDef: wrapperXSDs.values()) {
-                loadXSD(schemaCollection, xsDef);
-                wsdlDefinition.getXmlSchemas().add(xsDef);
+        }
+        
+        if (reloadSchema){
+            schemaCollection = new XmlSchemaCollection();
+            for (XSDefinition xsDef: wsdlDefinition.getXmlSchemas()){
+                xsDef.setSchema(null);
+                xsDef.setSchemaCollection(null);
             }
         }
+        
+        for (XSDefinition xsDef: wsdlDefinition.getXmlSchemas()){
+            addSchemaExtension(xsDef, schemaCollection, wsdlDefinition, definition);
+        }
 
         return definition;
     }
@@ -618,6 +639,7 @@ public class Interface2WSDLGenerator {
         // copy all the FROM items to the TO schema
         XmlSchemaObjectCollection fromItems = fromSchema.getItems();
         XmlSchemaObjectCollection toItems = toSchema.getItems();
+        List<XmlSchemaObject> movedItems = new ArrayList<XmlSchemaObject>();
        
         Iterator<XmlSchemaObject> iter = fromItems.getIterator();
         while(iter.hasNext()){
@@ -628,16 +650,20 @@ public class Interface2WSDLGenerator {
                 // do nothing
             } else {
                 toItems.add(obj);
-                // correct any references to the item just moved
-                fixUpMovedTypeReferences(fromNamespace, toNamespace, obj, resultSchema);
+                movedItems.add(obj);
             }
         }
         
+        // check that all types in the TO namespace are now referred to correctly across
the schema
+        for(XmlSchemaObject obj : movedItems){
+            fixUpMovedTypeReferences(fromNamespace, toNamespace, obj, resultSchema);
+        }
+        
         return resultSchema;
     }
     
     // TUSCANY-3283 - fix up any references to types moved to the default namespace schema
-    public void fixUpMovedTypeReferences(String fromNamespace, String toNamespace, XmlSchemaObject
fixUpObj, List<org.apache.ws.commons.schema.XmlSchema> relatedSchema){
+    public void fixUpMovedTypeReferences(String fromNamespace, String toNamespace, XmlSchemaObject
fixUpObj, List<XmlSchema> relatedSchema){
         
         if (!(fixUpObj instanceof XmlSchemaComplexType)){
             return;
@@ -648,11 +674,7 @@ public class Interface2WSDLGenerator {
             for (int i = 0; i < schema.getItems().getCount(); i++){
                 XmlSchemaObject obj = schema.getItems().getItem(i);
                 
-                // if this is not the TO schema then fix up all references
-                // to items moved to the TO schema
-                if(!schema.getTargetNamespace().equals(toNamespace)){
-                    processXMLSchemaObject(toNamespace, obj, fixUpObj);
-                }
+                processXMLSchemaObject(toNamespace, obj, fixUpObj);
                 
                 // remove FROM imports
                 if (obj instanceof XmlSchemaImport &&
@@ -671,6 +693,9 @@ public class Interface2WSDLGenerator {
     public void processXMLSchemaObject(String toNamespace, XmlSchemaObject obj,  XmlSchemaObject
fixUpObj){
         if (obj instanceof XmlSchemaComplexType){
             processXMLSchemaObject(toNamespace, ((XmlSchemaComplexType)obj).getParticle(),
fixUpObj);
+            processXMLSchemaObject(toNamespace, ((XmlSchemaComplexType)obj).getContentModel(),
fixUpObj);
+        } else if (obj instanceof XmlSchemaComplexContent){
+            processXMLSchemaObject(toNamespace, ((XmlSchemaComplexContent)obj).getContent(),
fixUpObj);            
         } else if (obj instanceof XmlSchemaElement){
             XmlSchemaElement element = (XmlSchemaElement)obj;
             if(element.getSchemaType() == fixUpObj){
@@ -685,6 +710,11 @@ public class Interface2WSDLGenerator {
             while(iter.hasNext()){
                 processXMLSchemaObject(toNamespace, iter.next(), fixUpObj);
             }
+        } else if (obj instanceof XmlSchemaComplexContentExtension){
+            XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension)obj;
+            QName name = extension.getBaseTypeName();
+            QName newName = new QName(toNamespace, name.getLocalPart());
+            extension.setBaseTypeName(newName);
         }
         // TODO - what other structure items will be generated by JAXB?
     }    
@@ -765,7 +795,7 @@ public class Interface2WSDLGenerator {
                 }
             }
             loadXSD(schemaCollection, xsDef);
-            wsdlDefinition.getXmlSchemas().add(xsDef);
+            //wsdlDefinition.getXmlSchemas().add(xsDef);
             Element schema = document.getDocumentElement();
             Schema schemaExt = createSchemaExt(definition);
             schemaExt.setDocumentBaseURI(document.getDocumentURI());
@@ -1062,6 +1092,12 @@ public class Interface2WSDLGenerator {
             element.setMany(javaType.isArray());
         }
 
+        // TUSCANY-3298: Check the "many" flag set by databinding introspection
+        Object logical = dataType.getLogical();
+        if (logical instanceof XMLType && ((XMLType)logical).isMany()) {
+            element.setMany(true);
+        }
+        
         element.setNillable(!javaType.isPrimitive());
         return element;
     }

Modified: tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
Thu Jan 26 10:24:43 2012
@@ -113,13 +113,28 @@ public class Input2InputTransformer exte
         for (int i = 0; i < list1.size(); i++) {
             String n1 = list1.get(i).getQName().getLocalPart();
             String n2 = list2.get(i).getQName().getLocalPart();
-            if (!n1.equals(n2)) {
+            // TUSCANY-3298: In the following situation:
+            //  1. The child is a java.util.Map type
+            //  2. The child's name is a Java keyword (e.g., return)
+            //  3. Tuscany is using a generated JAXB wrapper class for WSDL generation
+            // the Java to WSDL generation process results in the WSDL element name
+            // having a leading underscore added to the actual element name.  This is
+            // because of a known JAXB issue that prevents the @XmlElement annotation
+            // being used on a java.util.Map type property field in the wrapper bean
+            // (see https://jaxb.dev.java.net/issues/show_bug.cgi?id=268).
+            // To prevent the compatibility match from failing in this situation,
+            // we strip any leading underscore before doing the comparison.
+            if (!stripLeadingUnderscore(n1).equals(stripLeadingUnderscore(n2))) {
                 return false;
             }
         }
         return true;
     }
 
+    private static String stripLeadingUnderscore(String name) {
+        return name.startsWith("_") ? name.substring(1) : name;
+    }
+    
     @SuppressWarnings("unchecked")
     public Object[] transform(Object[] source, TransformationContext context) {
         // Check if the source operation is wrapped

Modified: tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
Thu Jan 26 10:24:43 2012
@@ -139,23 +139,27 @@ public class Output2OutputTransformer ex
             String n1 = list1.get(i).getQName().getLocalPart();
             String n2 = list2.get(i).getQName().getLocalPart();
             
-            // TUSCANY-3283 - strip off any leading "_" characters for this comparison.
-            //                Now we generate wrappers with JAXB it names the response
-            //                wrapper's child as "_return"
-            if (n1.startsWith("_")){
-                n1 = n1.substring(1);
-            }
-            
-            if (n2.startsWith("_")){
-                n2 = n2.substring(1);
-            }
-            
-            if (!n1.equals(n2)) {
+            // TUSCANY-3298: In the following situation:
+            //  1. The child is a java.util.Map type
+            //  2. The child's name is a Java keyword (e.g., return)
+            //  3. Tuscany is using a generated JAXB wrapper class for WSDL generation
+            // the Java to WSDL generation process results in the WSDL element name
+            // having a leading underscore added to the actual element name.  This is
+            // because of a known JAXB issue that prevents the @XmlElement annotation
+            // being used on a java.util.Map type property field in the wrapper bean
+            // (see https://jaxb.dev.java.net/issues/show_bug.cgi?id=268).
+            // To prevent the compatibility match from failing in this situation,
+            // we strip any leading underscore before doing the comparison.
+            if (!stripLeadingUnderscore(n1).equals(stripLeadingUnderscore(n2))) {
                 return false;
             }
         }
         return true;
     }
+    
+    private static String stripLeadingUnderscore(String name) {
+        return name.startsWith("_") ? name.substring(1) : name;
+    }
 
     @SuppressWarnings("unchecked")
     public Object transform(Object response, TransformationContext context) {

Modified: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
Thu Jan 26 10:24:43 2012
@@ -19,8 +19,10 @@
 
 package org.apache.tuscany.sca.databinding.sdo;
 
+import java.lang.reflect.ParameterizedType;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 
@@ -62,7 +64,7 @@ public class SDODataBinding extends Base
 
     @Override
     public boolean introspect(DataType dataType, final Operation operation) {
-        final Class javaType = dataType.getPhysical();
+        Class javaType = dataType.getPhysical();
         // Allow privileged access to read system properties. Requires PropertyPermission
         // java.specification.version read in security policy.
         final HelperContext context = AccessController.doPrivileged(new PrivilegedAction<HelperContext>()
{
@@ -74,11 +76,33 @@ public class SDODataBinding extends Base
         final Type type = context.getTypeHelper().getType(javaType);
         if (type == null) {
             // FIXME: Need a better to test dynamic SDO
+            // TUSCANY-3298: get underlying element type for collections
+            boolean isMany = false;
+            if (Collection.class.isAssignableFrom(javaType)) {
+                java.lang.reflect.Type genericType = dataType.getGenericType();
+                if (genericType instanceof ParameterizedType) {
+                    java.lang.reflect.Type actualType = ((ParameterizedType)genericType).getActualTypeArguments()[0];
+                    if (actualType instanceof Class) {
+                        javaType = (Class)actualType;
+                        isMany = true;
+                    }
+                }
+            }            
             if (DataObject.class.isAssignableFrom(javaType)) {
                 // Dynamic SDO
                 dataType.setDataBinding(getName());
-                if (dataType.getLogical() == null) {
-                    dataType.setLogical(XMLType.UNKNOWN);
+                // TUSCANY-3298: use XMLType many value to indicate a collection
+                Object logical = dataType.getLogical();
+                if (logical == null) {
+                    if (!isMany) {
+                        dataType.setLogical(XMLType.UNKNOWN);
+                    } else {
+                        XMLType xmlType = new XMLType(null, null);
+                        xmlType.setMany(true);
+                        dataType.setLogical(xmlType);
+                    }
+                } else if (logical instanceof XMLType && isMany) {
+                    ((XMLType)logical).setMany(true);
                 }
                 return true;
             }

Modified: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
Thu Jan 26 10:24:43 2012
@@ -32,6 +32,7 @@ import org.apache.tuscany.sca.contributi
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.databinding.XMLTypeHelper;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
@@ -91,8 +92,8 @@ public class SDOTypeHelper implements XM
                 xmlType = ((XMLType)logical).getTypeName();
             }
             if (xmlType == null) {
-                xmlType =
-                    new QName(JavaXMLMapper.getNamespace(javaType), Introspector.decapitalize(javaType.getSimpleName()));
+                // TUSCANY-3298: dynamic SDO or collection of dynamic SDO
+                return new TypeInfo(SimpleTypeMapperImpl.XSD_ANYTYPE, true, null);
             }
             return new TypeInfo(xmlType, false, null);
         }

Modified: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
(original)
+++ tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
Thu Jan 26 10:24:43 2012
@@ -17,11 +17,11 @@
 
 # Implementation classes for the transformers
 org.apache.tuscany.sca.databinding.sdo.DataObject2String;source=commonj.sdo.DataObject,target=java.lang.String,weight=510
-org.apache.tuscany.sca.databinding.sdo.DataObject2XMLStreamReader;source=commonj.sdo.DataObject,target=javax.xml.stream.XMLStreamReader,weight=490
-org.apache.tuscany.sca.databinding.sdo.XMLDocument2String;source=commonj.sdo.helper.XMLDocument,target=java.lang.String,weight=510
+#org.apache.tuscany.sca.databinding.sdo.DataObject2XMLStreamReader;source=commonj.sdo.DataObject,target=javax.xml.stream.XMLStreamReader,weight=490
+#org.apache.tuscany.sca.databinding.sdo.XMLDocument2String;source=commonj.sdo.helper.XMLDocument,target=java.lang.String,weight=510
 org.apache.tuscany.sca.databinding.sdo.String2DataObject;source=java.lang.String,target=commonj.sdo.DataObject,weight=500
-org.apache.tuscany.sca.databinding.sdo.XMLDocument2XMLStreamReader;source=commonj.sdo.helper.XMLDocument,target=javax.xml.stream.XMLStreamReader,weight=490
-org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2DataObject;source=javax.xml.stream.XMLStreamReader,target=commonj.sdo.DataObject,weight=490
-org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2XMLDocument;source=javax.xml.stream.XMLStreamReader,target=commonj.sdo.helper.XMLDocument,weight=490
-org.apache.tuscany.sca.databinding.sdo.DataObject2Node;source=commonj.sdo.DataObject,target=org.w3c.dom.Node,weight=500
-org.apache.tuscany.sca.databinding.sdo.Node2DataObject;source=org.w3c.dom.Node,target=commonj.sdo.DataObject,weight=500
+#org.apache.tuscany.sca.databinding.sdo.XMLDocument2XMLStreamReader;source=commonj.sdo.helper.XMLDocument,target=javax.xml.stream.XMLStreamReader,weight=490
+#org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2DataObject;source=javax.xml.stream.XMLStreamReader,target=commonj.sdo.DataObject,weight=490
+#org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2XMLDocument;source=javax.xml.stream.XMLStreamReader,target=commonj.sdo.helper.XMLDocument,weight=490
+#org.apache.tuscany.sca.databinding.sdo.DataObject2Node;source=commonj.sdo.DataObject,target=org.w3c.dom.Node,weight=500
+#org.apache.tuscany.sca.databinding.sdo.Node2DataObject;source=org.w3c.dom.Node,target=commonj.sdo.DataObject,weight=500

Added: tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite?rev=1236129&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite
(added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite
Thu Jan 26 10:24:43 2012
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * with the License.  You may obtain a copy of the License at
+    *
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" 
+           xmlns:foo="http://foo" targetNamespace="http://foo"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           name="MatchWSDistributedClient" >
+
+    <component name="DistributedClientComponent">
+        <implementation.java class="org.apache.tuscany.sca.itest.interfaces.ClientComponentImpl"
/>
+        <reference name="aCallBackService" target="DistributedServiceComponent" />
+    </component> 
+    
+</composite>
\ No newline at end of file

Added: tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite?rev=1236129&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite
(added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/main/resources/org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite
Thu Jan 26 10:24:43 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * with the License.  You may obtain a copy of the License at
+    *
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" 
+           xmlns:foo="http://foo" targetNamespace="http://foo"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           name="MatchWSDistributedService" >
+    
+    <component name="DistributedServiceComponent">
+        <implementation.java class="org.apache.tuscany.sca.itest.interfaces.ServiceComponentImpl"
/> 
+        <service name="ServiceComponent">
+            <binding.ws/>   
+        </service>    
+    </component>  
+</composite>
\ No newline at end of file

Modified: tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/interface-matching/src/test/java/org/apache/tuscany/sca/itest/interfaces/InerfaceMatchTestCase.java
Thu Jan 26 10:24:43 2012
@@ -208,5 +208,53 @@ public class InerfaceMatchTestCase {
         
         node1.stop();
         node2.stop();
+    }
+    
+    /**
+     * Remotable client and service interfaces where the interfaces match.
+     * Components running in the separate composite/JVM, i.e. there is a remote registry
+     * and with binding.ws explicitly configured at the service
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testWSDistributedRemotable() throws Exception {
+        
+        
+        String [] contributions = {"./target/classes"};
+        Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"), 
+                                                                     "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedClient.composite",

+                                                                     contributions);
+        node1.start();
+
+        Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"), 
+                                                                     "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchWSDistributedService.composite",

+                                                                     contributions);
+        
+        // force default binding on node2 to use a different port from node 1(which will
default to 8080)
+        ((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/");
+        ((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/");
+        node2.start();
+        
+        ClientComponent local = node1.getService(ClientComponent.class, "DistributedClientComponent");
+        ParameterObject po = new ParameterObject();
+        
+        try {
+            String response = local.foo1(po);
+            Assert.assertEquals("AComponent", response);
+        } catch (ServiceRuntimeException ex){
+            Assert.fail("Unexpected exception with foo " + ex.toString());
+        }
+        
+        try {
+            local.callback("Callback");
+            String response = local.getCallbackValue();
+            Assert.assertEquals("Callback", response);
+        } catch (ServiceRuntimeException ex){
+            Assert.fail("Unexpected exception with callback" + ex.toString());
+        }        
+        
+        node1.stop();
+        node2.stop();
     }    
 }

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/java/datatypes/impl/GetDataServiceWithoutExceptionImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/java/datatypes/impl/GetDataServiceWithoutExceptionImpl.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/java/datatypes/impl/GetDataServiceWithoutExceptionImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/java/datatypes/impl/GetDataServiceWithoutExceptionImpl.java
Thu Jan 26 10:24:43 2012
@@ -37,7 +37,7 @@ public class GetDataServiceWithoutExcept
     public DataObject getMessageSDO(String paramString) {
         return null;
     }
-
+    
     public List<DataObject> getMessageListSDOList(String paramString) {
         return null;
     }

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/resources/helloworld.composite?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/resources/helloworld.composite
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/main/resources/helloworld.composite
Thu Jan 26 10:24:43 2012
@@ -27,7 +27,7 @@
         <implementation.java class="helloworld.HelloWorldClientImpl" />
         <service name="HelloWorldService">
             <binding.sca/>
-        </service>
+        </service>      
         <reference name="hwService">
             <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent"/>
         </reference>
@@ -45,13 +45,11 @@
          gen'd WSDL by setting the service interface to the RI WSDL. Tuscany should
          generate a WSDL for the component and compare the two for compatibility
     --> 
-<!--
     <component name="HelloWorldServiceCompatibilityComponent">
         <implementation.java class="helloworld.HelloWorldImpl" />
 	    <service name="HelloWorldService">
 	        <interface.wsdl interface="http://helloworld/#wsdl.interface(HelloWorldImpl)"/>
-            <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent"/>
+            <binding.ws uri="http://localhost:8085/HelloWorldServiceCompatibilityComponent"/>
         </service>
     </component>
- -->
 </composite>

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DataTypesTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DataTypesTestCase.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DataTypesTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DataTypesTestCase.java
Thu Jan 26 10:24:43 2012
@@ -31,7 +31,7 @@ import static org.junit.Assert.assertEqu
  *
  * @version $Rev: 814373 $ $Date: 2009-09-13 19:06:29 +0100 (Sun, 13 Sep 2009) $
  */
-@Ignore("In the process of porting from 1.x")
+//@Ignore("In the process of porting from 1.x")
 public class DataTypesTestCase extends BaseFramework {
 
     @Test

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DynamicSDOTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DynamicSDOTestCase.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DynamicSDOTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/datatypes/DynamicSDOTestCase.java
Thu Jan 26 10:24:43 2012
@@ -31,7 +31,7 @@ import static org.junit.Assert.assertEqu
  *
  * @version $Rev: 814373 $ $Date: 2009-09-13 19:06:29 +0100 (Sun, 13 Sep 2009) $
  */
-@Ignore("In the process of porting from 1.x")
+//@Ignore("In the process of porting from 1.x")
 public class DynamicSDOTestCase extends BaseFramework {
 
     @Test

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/helloworld/WSDLGenTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/helloworld/WSDLGenTestCase.java?rev=1236129&r1=1236128&r2=1236129&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/helloworld/WSDLGenTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/wsdlgen/src/test/java/helloworld/WSDLGenTestCase.java
Thu Jan 26 10:24:43 2012
@@ -86,6 +86,13 @@ public class WSDLGenTestCase{
         abean.setField3(bbean);
             
         assertEquals("Hello Hello 3 4 1 2", helloWorldClient.getGreetingsDBean(abean));
+        
+        try {
+            helloWorldClient.getGreetingsException("Fred");
+            fail("exception not returned");
+        } catch(Exception ex) {
+            
+        }  
     }
     
     @Test



Mime
View raw message