tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r447254 [3/3] - in /incubator/tuscany/java: samples/sca/echo.databinding/src/main/java/echo/ samples/sca/helloworldws/ samples/sca/helloworldws/src/main/java/helloworld/ samples/sca/helloworldws/src/main/resources/wsdl/ samples/sca/hellowor...
Date Mon, 18 Sep 2006 05:33:14 GMT
Modified: incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java
(original)
+++ incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java
Sun Sep 17 22:33:12 2006
@@ -21,18 +21,21 @@
 import org.apache.tuscany.databinding.TransformationContext;
 import org.apache.tuscany.databinding.TransformationException;
 import org.apache.tuscany.databinding.PullTransformer;
+import org.apache.tuscany.databinding.Transformer;
 import org.apache.tuscany.databinding.extension.TransformerExtension;
 import org.apache.tuscany.sdo.util.SDOUtil;
+import org.osoa.sca.annotations.Service;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.helper.TypeHelper;
 import commonj.sdo.helper.XMLHelper;
 
+@Service(Transformer.class)
 public class String2DataObject extends TransformerExtension<String, DataObject> implements
PullTransformer<String, DataObject> {
 
     public DataObject transform(String source, TransformationContext context) {
         try {
-            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context, false);
+            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
             XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
             return xmlHelper.load(source).getRootObject();
         } catch (Exception e) {

Added: incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java?view=auto&rev=447254
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java
(added)
+++ incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java
Sun Sep 17 22:33:12 2006
@@ -0,0 +1,63 @@
+/*
+ * 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
+ * "License"); you may not use this file except in compliance
+ * 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.    
+ */
+package org.apache.tuscany.databinding.sdo;
+
+import java.io.StringWriter;
+
+import org.apache.tuscany.databinding.PullTransformer;
+import org.apache.tuscany.databinding.TransformationContext;
+import org.apache.tuscany.databinding.TransformationException;
+import org.apache.tuscany.databinding.Transformer;
+import org.apache.tuscany.databinding.extension.TransformerExtension;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.osoa.sca.annotations.Service;
+
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+@Service(Transformer.class)
+public class XMLDocument2String extends TransformerExtension<XMLDocument, String> implements
+        PullTransformer<XMLDocument, String> {
+
+    public String transform(XMLDocument source, TransformationContext context) {
+        try {
+            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
+            XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
+            StringWriter writer = new StringWriter();
+            xmlHelper.save(source, writer, null);
+            return writer.toString();
+        } catch (Exception e) {
+            throw new TransformationException(e);
+        }
+    }
+
+    public Class getSourceType() {
+        return XMLDocument.class;
+    }
+
+    public Class getTargetType() {
+        return String.class;
+    }
+
+    public int getWeight() {
+        return 40;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java
(original)
+++ incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java
Sun Sep 17 22:33:12 2006
@@ -24,13 +24,16 @@
 import org.apache.tuscany.databinding.TransformationContext;
 import org.apache.tuscany.databinding.TransformationException;
 import org.apache.tuscany.databinding.PullTransformer;
+import org.apache.tuscany.databinding.Transformer;
 import org.apache.tuscany.databinding.extension.TransformerExtension;
 import org.apache.tuscany.sdo.helper.XMLStreamHelper;
 import org.apache.tuscany.sdo.util.SDOUtil;
+import org.osoa.sca.annotations.Service;
 
 import commonj.sdo.helper.TypeHelper;
 import commonj.sdo.helper.XMLDocument;
 
+@Service(Transformer.class)
 public class XMLDocument2XMLStreamReader extends TransformerExtension<XMLDocument, XMLStreamReader>
implements PullTransformer<XMLDocument, XMLStreamReader> {
     /**
      * @param source
@@ -39,7 +42,7 @@
      */
     public XMLStreamReader transform(XMLDocument source, TransformationContext context) {
         try {
-            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context, true);
+            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
             XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(typeHelper);
             return streamHelper.createXMLStreamReader(source);
         } catch (XMLStreamException e) {

Modified: incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java
(original)
+++ incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java
Sun Sep 17 22:33:12 2006
@@ -18,28 +18,37 @@
  */
 package org.apache.tuscany.databinding.sdo;
 
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.databinding.TransformationContext;
 import org.apache.tuscany.databinding.TransformationException;
 import org.apache.tuscany.databinding.PullTransformer;
+import org.apache.tuscany.databinding.Transformer;
 import org.apache.tuscany.databinding.extension.TransformerExtension;
 import org.apache.tuscany.sdo.helper.XMLStreamHelper;
 import org.apache.tuscany.sdo.util.SDOUtil;
+import org.osoa.sca.annotations.Service;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.helper.TypeHelper;
 
-public class XMLStreamReader2DataObject extends TransformerExtension<XMLStreamReader,
DataObject> implements PullTransformer<XMLStreamReader, DataObject> {
+@Service(Transformer.class)
+public class XMLStreamReader2DataObject extends TransformerExtension<XMLStreamReader,
DataObject> implements
+        PullTransformer<XMLStreamReader, DataObject> {
 
     public DataObject transform(XMLStreamReader source, TransformationContext context) {
         try {
-            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context, false);
+            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
             XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(typeHelper);
+            // The XMLStreamHelper requires that the reader is posistioned at START_ELEMENT
+            while (source.getEventType() != XMLStreamConstants.START_ELEMENT && source.hasNext())
{
+                source.next();
+            }
             return streamHelper.loadObject(source);
         } catch (Exception e) {
             throw new TransformationException(e);
-        } 
+        }
     }
 
     public Class getTargetType() {

Modified: incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java
(original)
+++ incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java
Sun Sep 17 22:33:12 2006
@@ -23,19 +23,22 @@
 import org.apache.tuscany.databinding.TransformationContext;
 import org.apache.tuscany.databinding.TransformationException;
 import org.apache.tuscany.databinding.PullTransformer;
+import org.apache.tuscany.databinding.Transformer;
 import org.apache.tuscany.databinding.extension.TransformerExtension;
 import org.apache.tuscany.sdo.helper.XMLStreamHelper;
 import org.apache.tuscany.sdo.util.SDOUtil;
+import org.osoa.sca.annotations.Service;
 
 import commonj.sdo.helper.TypeHelper;
 import commonj.sdo.helper.XMLDocument;
 
+@Service(Transformer.class)
 public class XMLStreamReader2XMLDocument extends TransformerExtension<XMLStreamReader,
XMLDocument> implements
         PullTransformer<XMLStreamReader, XMLDocument> {
 
     public XMLDocument transform(XMLStreamReader source, TransformationContext context) {
         try {
-            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context, false);
+            TypeHelper typeHelper = SDODataTypeHelper.getTypeHelper(context);
             XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(typeHelper);
             return streamHelper.load(source);
         } catch (Exception e) {

Modified: incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl
(original)
+++ incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl
Sun Sep 17 22:33:12 2006
@@ -31,4 +31,30 @@
         <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
     </component>
     
+    <component name="databinding.sdo">
+        <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding"
/>
+    </component>    
+
+    <component name="transformer.DataObject2String">
+        <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+    </component>
+    <component name="transformer.DataObject2XMLStreamReader">
+        <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+    </component>
+    <component name="transformer.XMLDocument2String">
+        <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+    </component>
+    <component name="transformer.String2DataObject">
+        <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+    </component>
+    <component name="transformer.XMLDocument2XMLStreamReader">
+        <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+    </component>
+    <component name="transformer.XMLStreamReader2DataObject">
+        <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+    </component>
+    <component name="transformer.XMLStreamReader2XMLDocument">
+        <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+    </component>
+    
 </composite>

Modified: incubator/tuscany/java/sca/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java
(original)
+++ incubator/tuscany/java/sca/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java
Sun Sep 17 22:33:12 2006
@@ -25,7 +25,9 @@
 import java.io.StringReader;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
@@ -43,6 +45,7 @@
 import org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader;
 import org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject;
 import org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument;
+import org.apache.tuscany.databinding.sdo.ImportSDOLoader.SDOType;
 import org.apache.tuscany.databinding.xml.Node2String;
 import org.apache.tuscany.databinding.xml.String2Node;
 import org.apache.tuscany.databinding.xml.String2XMLStreamReader;
@@ -51,26 +54,32 @@
 import org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject;
 import org.apache.tuscany.databinding.xmlbeans.XmlObject2Node;
 import org.apache.tuscany.databinding.xmlbeans.XmlObject2XMLStreamReader;
+import org.apache.tuscany.sdo.util.SDOUtil;
 import org.apache.tuscany.spi.model.DataType;
 import org.apache.xmlbeans.XmlObject;
 import org.w3c.dom.Node;
 
 import commonj.sdo.DataObject;
+import commonj.sdo.helper.TypeHelper;
 import commonj.sdo.helper.XMLDocument;
 import commonj.sdo.helper.XMLHelper;
 import commonj.sdo.helper.XSDHelper;
 
 public class TransformationTestCase extends TestCase {
-    private static final String IPO_XML = "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
-            + "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + "  xmlns:ipo=\"http://www.example.com/IPO\""
-            + "  xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\"" + "  orderDate=\"1999-12-01\">"
-            + "  <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">" + "    <name>Helen
Zoe</name>" + "    <street>47 Eden Street</street>"
-            + "    <city>Cambridge</city>" + "    <postcode>CB1 1JR</postcode>"
+ "  </shipTo>" + "  <billTo xsi:type=\"ipo:USAddress\">"
-            + "    <name>Robert Smith</name>" + "    <street>8 Oak Avenue</street>"
+ "    <city>Old Town</city>" + "    <state>PA</state>"
-            + "    <zip>95819</zip>" + "  </billTo>" + "  <items>"
+ "    <item partNum=\"833-AA\">"
-            + "      <productName>Lapis necklace</productName>" + "      <quantity>1</quantity>"
+ "      <USPrice>99.95</USPrice>"
-            + "      <ipo:comment>Want this for the holidays</ipo:comment>" +
"      <shipDate>1999-12-05</shipDate>" + "    </item>" + "  </items>"
-            + "</ipo:purchaseOrder>";
+    private static final String IPO_XML =
+            "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+                    + "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+                    + "  xmlns:ipo=\"http://www.example.com/IPO\""
+                    + "  xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\"" + " 
orderDate=\"1999-12-01\">"
+                    + "  <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">" + "
   <name>Helen Zoe</name>"
+                    + "    <street>47 Eden Street</street>" + "    <city>Cambridge</city>"
+                    + "    <postcode>CB1 1JR</postcode>" + "  </shipTo>"
+ "  <billTo xsi:type=\"ipo:USAddress\">"
+                    + "    <name>Robert Smith</name>" + "    <street>8
Oak Avenue</street>"
+                    + "    <city>Old Town</city>" + "    <state>PA</state>"
+ "    <zip>95819</zip>" + "  </billTo>"
+                    + "  <items>" + "    <item partNum=\"833-AA\">" + "     
<productName>Lapis necklace</productName>"
+                    + "      <quantity>1</quantity>" + "      <USPrice>99.95</USPrice>"
+                    + "      <ipo:comment>Want this for the holidays</ipo:comment>"
+                    + "      <shipDate>1999-12-05</shipDate>" + "    </item>"
+ "  </items>" + "</ipo:purchaseOrder>";
 
     private TransformerRegistry registry;
 
@@ -125,7 +134,9 @@
     // XMLBeans --> SDO
     public void testTransformation1() throws Exception {
         URL xsdFile = getClass().getClassLoader().getResource("ipo.xsd");
-        XSDHelper.INSTANCE.define(xsdFile.openStream(), null);
+        TypeHelper typeHelper = SDOUtil.createTypeHelper();
+        XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
+        xsdHelper.define(xsdFile.openStream(), xsdFile.toExternalForm());
 
         // URL/Stream/Reader to XmlObject
         XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
@@ -134,6 +145,7 @@
         System.out.println("Path: " + path);
 
         TransformationContext tContext = createTransformationContext();
+        tContext.getMetadata().put(SDOType.class, new SDOType(typeHelper));
 
         Object result = object;
         for (Transformer transformer : path) {
@@ -197,11 +209,12 @@
         DataType dataType = new DataType<Class>(Object.class, null);
         dataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
 
-
         TransformationContext tContext = createMock(TransformationContext.class);
         expect(tContext.getTargetDataType()).andReturn(dataType).anyTimes();
 
         expect(tContext.getSourceDataType()).andReturn(dataType).anyTimes();
+        Map<Class<?>, Object> metadata = new HashMap<Class<?>, Object>();
+        expect(tContext.getMetadata()).andReturn(metadata).anyTimes();
         replay(tContext);
         return tContext;
     }

Modified: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java
(original)
+++ incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java
Sun Sep 17 22:33:12 2006
@@ -30,7 +30,6 @@
 import org.apache.tuscany.spi.idl.InvalidServiceContractException;
 import org.apache.tuscany.spi.model.InteractionScope;
 import org.osoa.sca.annotations.Constructor;
-import org.osoa.sca.annotations.Property;
 
 /**
  * Introspector for creating WSDLServiceContract definitions from WSDL PortTypes.
@@ -38,12 +37,8 @@
 public class InterfaceWSDLIntrospectorImpl implements InterfaceWSDLIntrospector {
     public static final String INPUT_PARTS = "idl:input";
 
-    public static final String IDL_WSDL_DOCUMENT_LITERAL_WRPPED = "idl.wsdl.documentLiteralWrpped";
-
     private WSDLDefinitionRegistry wsdlDefinitionRegistry;
 
-    private String defaultDataBinding = "org.w3c.dom.Node"; // Default to DOM binding?
-
     /**
      * @param wsdlDefinitionRegistry
      */
@@ -53,11 +48,6 @@
         this.wsdlDefinitionRegistry = wsdlDefinitionRegistry;
     }
 
-    @Property(name = "defaultDataBinding")
-    public void setDefaultDataBinding(String defaultDataBinding) {
-        this.defaultDataBinding = defaultDataBinding;
-    }
-
     // FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS
spec?
     protected Map<String, org.apache.tuscany.spi.model.Operation<QName>> introspectOperations(PortType
portType)
         throws InvalidServiceContractException {
@@ -73,7 +63,7 @@
     protected org.apache.tuscany.spi.model.Operation<QName> introspectOperation(Operation
wsdlOp)
         throws InvalidServiceContractException {
 
-        WSDLOperation op = new WSDLOperation(wsdlOp, defaultDataBinding, wsdlDefinitionRegistry.getSchemaRegistry());
+        WSDLOperation op = new WSDLOperation(wsdlOp, null, wsdlDefinitionRegistry.getSchemaRegistry());
         return op.getOperation();
     }
 

Modified: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
(original)
+++ incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
Sun Sep 17 22:33:12 2006
@@ -60,9 +60,6 @@
 
     protected List<DataType<QName>> faultTypes;
 
-    // Keep a list of types so that the databindings can be reset
-    private List<DataType<?>> types = new ArrayList<DataType<?>>();
-
     /**
      * @param operation The WSDL4J operation
      * @param dataBinding The default databinding
@@ -171,7 +168,6 @@
                 WSDLPart part = new WSDLPart((Part) p);
                 DataType<QName> partType = part.getDataType();
                 partTypes.add(partType);
-                types.add(partType);
             }
         }
         return new DataType<List<DataType<QName>>>(dataBinding, Object[].class,
partTypes);
@@ -187,7 +183,15 @@
             operationModel =
                     new org.apache.tuscany.spi.model.Operation<QName>(operation.getName(),
getInputType(),
                             getOutputType(), getFaultTypes(), oneway, dataBinding);
-            operationModel.addMetaData(WSDLOperation.class.getName(), this);
+            operationModel.setMetaData(WSDLOperation.class.getName(), this);
+            if (isWrapperStyle()) {
+                // Register the operation with the types
+                for (DataType<?> d : wrapper.getUnwrappedInputType().getLogical())
{
+                    d.setMetadata(org.apache.tuscany.spi.model.Operation.class.getName(),
operationModel);
+                }
+                wrapper.getUnwrappedOutputType().setMetadata(org.apache.tuscany.spi.model.Operation.class.getName(),
+                        operationModel);
+            }
         }
         return operationModel;
     }
@@ -413,7 +417,6 @@
                     DataType<QName> type = new DataType<QName>(dataBinding, Object.class,
element.getQName());
                     type.setMetadata(XmlSchemaElement.class.getName(), element);
                     childTypes.add(type);
-                    types.add(type);
                 }
                 unwrappedInputType =
                         new DataType<List<DataType<QName>>>("idl:unwrapped.input",
Object[].class, childTypes);
@@ -432,31 +435,9 @@
                     XmlSchemaElement element = elements.get(0);
                     unwrappedOutputType = new DataType<QName>(dataBinding, Object.class,
element.getQName());
                     unwrappedOutputType.setMetadata(XmlSchemaElement.class.getName(), element);
-                    types.add(unwrappedOutputType);
                 }
             }
             return unwrappedOutputType;
         }
     }
-
-    /**
-     * @return the dataBinding
-     */
-    public String getDataBinding() {
-        return dataBinding;
-    }
-
-    /**
-     * @param dataBinding the dataBinding to set
-     */
-    public void setDataBinding(String dataBinding) {
-        String oldDataBinding = this.dataBinding;
-        this.dataBinding = dataBinding;
-        if (!dataBinding.equals(oldDataBinding)) {
-            for (DataType<?> d : types) {
-                d.setDataBinding(this.dataBinding);
-            }
-        }
-    }
-
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
(original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
Sun Sep 17 22:33:12 2006
@@ -120,6 +120,13 @@
     }
 
     public String getDataBinding() {
+        if (dataBinding == null) {
+            // databinding is not set at the DataType level, check the operation
+            Operation<?> operation = (Operation<?>) getMetadata(Operation.class.getName());
+            if (operation != null) {
+                return operation.getDataBinding();
+            }
+        }
         return dataBinding;
     }
 
@@ -135,7 +142,9 @@
         result = dataBinding != null ? dataBinding.hashCode() : 0;
         result = 29 * result + (physical != null ? physical.hashCode() : 0);
         result = 29 * result + (logical != null ? logical.hashCode() : 0);
-        result = 29 * result + (metadata != null ? metadata.hashCode() : 0);
+        // Commented the following line out since it causes infinite loop from Operation.hashCode()

+        // if the metadata map contains the Operation
+        // result = 29 * result + (metadata != null ? metadata.hashCode() : 0);
         return result;
     }
 

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
(original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
Sun Sep 17 22:33:12 2006
@@ -84,9 +84,17 @@
         List<DataType<T>> types = Collections.emptyList();
         this.inputType = (inputType != null) ? inputType : new DataType<List<DataType<T>>>(Object[].class,
types);
         this.outputType = (outputType != null) ? outputType : new DataType<T>(void.class,
null);
-        this.faultTypes = faultTypes;
+        this.faultTypes = (faultTypes == null) ? types : faultTypes;
         this.nonBlocking = nonBlocking;
         this.dataBinding = dataBinding;
+        // Register the operation with the types
+        for (DataType<?> d : this.inputType.getLogical()) {
+            d.setMetadata(Operation.class.getName(), this);
+        }
+        this.outputType.setMetadata(Operation.class.getName(), this);
+        for (DataType<?> d : this.faultTypes) {
+            d.setMetadata(Operation.class.getName(), this);
+        }
     }
 
     /**
@@ -182,7 +190,7 @@
      * @return the data binding type specified for the operation or null.
      */
     public String getDataBinding() {
-        return dataBinding;
+        return (dataBinding == null && contract != null) ? contract.getDataBinding()
: dataBinding;
     }
 
     /**
@@ -212,7 +220,7 @@
      * @param key the metadata key
      * @param val the metadata value
      */
-    public void addMetaData(String key, Object val) {
+    public void setMetaData(String key, Object val) {
         if (metaData == null) {
             metaData = new HashMap<String, Object>();
         }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
(original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
Sun Sep 17 22:33:12 2006
@@ -188,7 +188,7 @@
      * @param key the metadata key
      * @param val the metadata value
      */
-    public void addMetaData(String key, Object val) {
+    public void setMetaData(String key, Object val) {
         if (metaData == null) {
             metaData = new HashMap<String, Object>();
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message