You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2006/08/17 07:47:45 UTC

svn commit: r432156 - in /incubator/tuscany/java/sca/bindings/binding.axis2: ./ src/main/java/org/apache/tuscany/binding/axis2/ src/main/java/org/apache/tuscany/binding/axis2/util/ src/main/resources/META-INF/sca/ src/test/java/org/apache/tuscany/bindi...

Author: rfeng
Date: Wed Aug 16 22:47:44 2006
New Revision: 432156

URL: http://svn.apache.org/viewvc?rev=432156&view=rev
Log:
Integrate Axis2 and SDO databinding for Web Service  

Modified:
    incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl
    incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
    incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml Wed Aug 16 22:47:44 2006
@@ -65,6 +65,13 @@
             <version>${sca.version}</version>
             <scope>compile</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.databinding</groupId>
+            <artifactId>databinding-sdo</artifactId>
+            <version>${sca.version}</version>
+            <scope>compile</scope>
+        </dependency>        
 
         <!-- axis 2.0 SNAPSHOT      -->
 

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java Wed Aug 16 22:47:44 2006
@@ -18,6 +18,7 @@
  */
 package org.apache.tuscany.binding.axis2;
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
 import org.apache.tuscany.spi.annotation.Autowire;
@@ -29,6 +30,8 @@
 import org.apache.tuscany.spi.model.BoundReferenceDefinition;
 import org.apache.tuscany.spi.model.BoundServiceDefinition;
 
+import commonj.sdo.helper.TypeHelper;
+
 /**
  * Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.Reference} configured with the Axis2 binding
  * 
@@ -41,25 +44,29 @@
     private ConfigurationContext configContext;
 
     @Autowire()
-    public void setServletHost(ServletHost servletHost) {
+    public void setServletHost(ServletHost servletHost) throws AxisFault {
         this.servletHost = servletHost;
-        this.configContext = new TuscanyAxisConfigurator(null).getConfigurationContext();
+        this.configContext = new TuscanyAxisConfigurator().getConfigurationContext();
     }
 
     public SCAObject build(CompositeComponent parent, BoundServiceDefinition<WebServiceBinding> serviceDefinition, DeploymentContext deploymentContext) {
 
         WebServiceBinding wsBinding = serviceDefinition.getBinding();
         Class<?> interfaze = serviceDefinition.getServiceContract().getInterfaceClass();
+        TypeHelper typeHelper = (TypeHelper) deploymentContext.getExtension(TypeHelper.class.getName());
+        if(typeHelper==null) typeHelper = TypeHelper.INSTANCE;
 
-        return new Axis2Service(serviceDefinition.getName(), interfaze, parent, wireService, wsBinding, servletHost, configContext);
+        return new Axis2Service(serviceDefinition.getName(), interfaze, parent, wireService, wsBinding, servletHost, configContext, typeHelper);
     }
 
     public SCAObject build(CompositeComponent parent, BoundReferenceDefinition<WebServiceBinding> boundReferenceDefinition,
             DeploymentContext deploymentContext) {
         
         WebServiceBinding wsBinding = boundReferenceDefinition.getBinding();
+        TypeHelper typeHelper = (TypeHelper) deploymentContext.getExtension(TypeHelper.class.getName());
+        if(typeHelper==null) typeHelper = TypeHelper.INSTANCE;
 
-        return new Axis2Reference(boundReferenceDefinition.getName(), parent, wireService, wsBinding, boundReferenceDefinition.getServiceContract());
+        return new Axis2Reference(boundReferenceDefinition.getName(), parent, wireService, wsBinding, boundReferenceDefinition.getServiceContract(), typeHelper);
     }
 
     protected Class<WebServiceBinding> getBindingType() {

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java Wed Aug 16 22:47:44 2006
@@ -54,18 +54,21 @@
 
     private WebServicePortMetaData wsPortMetaData;
     private ServiceClient serviceClient;
+    private TypeHelper typeHelper;
     
     public Axis2Reference(String theName,
                           CompositeComponent<?> parent,
                           WireService wireService,
                           WebServiceBinding wsBinding,
-                          ServiceContract contract) {
+                          ServiceContract contract,
+                          TypeHelper typeHelper) {
         super(theName, (Class<T>)contract.getInterfaceClass(), parent, wireService);
         try {
             Definition wsdlDefinition = wsBinding.getWSDLDefinition();
             wsPortMetaData =
                 new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false);
             serviceClient = createServiceClient(wsdlDefinition, wsPortMetaData);
+            this.typeHelper = typeHelper;
         } catch (AxisFault e) {
             e.printStackTrace();
             throw new RuntimeException(e);
@@ -76,11 +79,7 @@
         Axis2TargetInvoker invoker = null;
         try {
             //FIXME: SDODataBinding needs to pass in TypeHelper and classLoader as parameters.
-            //TypeHelper typeHelper = wsBinding.getTypeHelper();
-            //ClassLoader cl = wsBinding.getResourceLoader().getClassLoader();
-            TypeHelper typeHelper = null;
-            ClassLoader cl = null;
-            invoker = createOperationInvokers(serviceClient, operation, typeHelper, cl, wsPortMetaData);
+            invoker = createOperationInvokers(serviceClient, operation, typeHelper, wsPortMetaData);
         } catch (AxisFault e) {
             e.printStackTrace();
             throw new RuntimeException(e);
@@ -94,7 +93,7 @@
     private ServiceClient createServiceClient(Definition wsdlDefinition,
                                               WebServicePortMetaData wsPortMetaData) throws AxisFault {
 
-        TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(null);
+        TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
         ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();
         QName serviceQName = wsPortMetaData.getServiceName();
         String portName = wsPortMetaData.getPortName().getLocalPart();
@@ -109,7 +108,6 @@
     private Axis2TargetInvoker createOperationInvokers(ServiceClient serviceClient,
                                                        Method m,
                                                        TypeHelper typeHelper,
-                                                       ClassLoader cl,
                                                        WebServicePortMetaData wsPortMetaData)
         throws AxisFault {
         SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
@@ -122,7 +120,7 @@
         List<?> sig = operationMetaData.getOperationSignature();
 
         SDODataBinding dataBinding =
-            new SDODataBinding(cl, typeHelper, isWrapped, sig.size() > 0 ? (QName) sig.get(0) : null);
+            new SDODataBinding(typeHelper, isWrapped, sig.size() > 0 ? (QName) sig.get(0) : null);
 
         Options options = new Options();
         options.setTo(new EndpointReference(wsPortMetaData.getEndpoint()));

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java Wed Aug 16 22:47:44 2006
@@ -58,15 +58,18 @@
     private ConfigurationContext configContext;
 
     private WebServiceBinding binding;
+    
+    private TypeHelper typeHelper;
 
     public Axis2Service(String theName, Class<T> interfaze, CompositeComponent parent, WireService wireService, WebServiceBinding binding,
-            ServletHost servletHost, ConfigurationContext configContext) {
+            ServletHost servletHost, ConfigurationContext configContext, TypeHelper typeHelper) {
 
         super(theName, interfaze, parent, wireService);
 
         this.binding = binding;
         this.servletHost = servletHost;
         this.configContext = configContext;
+        this.typeHelper = typeHelper;
     }
 
     public void start() {
@@ -113,12 +116,6 @@
         Parameter userWSDL = new Parameter("useOriginalwsdl", "true");
         axisService.addParameter(userWSDL );
 
-        // FIXME:
-        // TypeHelper typeHelper = wsBinding.getTypeHelper();
-        // ClassLoader cl = wsBinding.getResourceLoader().getClassLoader();
-        TypeHelper typeHelper = null;
-        ClassLoader cl = null;
-
         Class<?> serviceInterface = this.getInterface();
 
         PortType wsdlPortType = wsdlPortInfo.getPortType();
@@ -129,13 +126,14 @@
             Object entryPointProxy = this.getServiceInstance();
 
             WebServiceOperationMetaData omd = wsdlPortInfo.getOperationMetaData(operationName);
+            QName responseQN = omd.getOutputPart(0).getElementName();
 
             Method operationMethod = getMethod(serviceInterface, operationName);
             // outElementQName is not needed when calling fromOMElement method, and we can not get elementQName for
             // oneway operation.
-            SDODataBinding dataBinding = new SDODataBinding(cl, typeHelper, omd.isDocLitWrapped(), null);
+            SDODataBinding dataBinding = new SDODataBinding(typeHelper, omd.isDocLitWrapped(), responseQN);
             Axis2ServiceInOutSyncMessageReceiver msgrec = new Axis2ServiceInOutSyncMessageReceiver(entryPointProxy, operationMethod,
-                    dataBinding, cl);
+                    dataBinding);
 
             AxisOperation axisOp = axisService.getOperation(operationQN);
             axisOp.setMessageExchangePattern(WSDL20_2004Constants.MEP_URI_IN_OUT);
@@ -163,6 +161,10 @@
             }
         }
         throw new BuilderConfigException("no operation named " + operationName + " found on service interface: " + serviceInterface.getName());
+    }
+
+    TypeHelper getTypeHelper() {
+        return typeHelper;
     }
 
 }

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java Wed Aug 16 22:47:44 2006
@@ -34,17 +34,16 @@
 
     protected Method operationMethod;
     protected SDODataBinding dataBinding;
-    protected ClassLoader classLoader;
+    // protected ClassLoader classLoader;
     private Object entryPointProxy;
 
     public Axis2ServiceInOutSyncMessageReceiver(Object entryPointProxy,
                                                         Method operationMethod,
-                                                        SDODataBinding dataBinding,
-                                                        ClassLoader classLoader) {
+                                                        SDODataBinding dataBinding) {
         this.entryPointProxy = entryPointProxy;
         this.operationMethod = operationMethod;
         this.dataBinding = dataBinding;
-        this.classLoader = classLoader;
+        // this.classLoader = classLoader;
     }
 
     @Override
@@ -52,8 +51,17 @@
         try {
 
             OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
-
-            OMElement responseOM = (OMElement) operationMethod.invoke(entryPointProxy, requestOM);
+            OMElement responseOM = null;
+            Class<?>[] parameterTypes = operationMethod.getParameterTypes();
+            // Try to guess if it's passing OMElements
+            if(parameterTypes.length>0 && OMElement.class.isAssignableFrom(parameterTypes[0])) {    
+                responseOM = (OMElement) operationMethod.invoke(entryPointProxy, requestOM);
+            } else {
+                // Assumming it's SDO then
+                Object[] args = dataBinding.fromOMElement(requestOM);
+                Object result = operationMethod.invoke(entryPointProxy,args);
+                responseOM = dataBinding.toOMElement(new Object[] {result} );
+            }
 
             SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope();
             soapEnvelope.getBody().addChild(responseOM);

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java Wed Aug 16 22:47:44 2006
@@ -19,14 +19,10 @@
 package org.apache.tuscany.binding.axis2;
 
 import java.lang.reflect.InvocationTargetException;
-import javax.xml.namespace.QName;
 
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
-import org.apache.tuscany.spi.wire.Message;
-import org.apache.tuscany.spi.wire.TargetInvoker;
+import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
@@ -36,6 +32,9 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.tuscany.binding.axis2.util.SDODataBinding;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
 
 /**
  * Axis2TargetInvoker uses an Axis2 OperationClient to invoke a remote web service
@@ -70,8 +69,7 @@
     public Object invokeTarget(final Object payload) throws InvocationTargetException {
         try {
             operationClient.setOptions(options);
-            boolean pureOMelement =false;
-            
+            boolean pureOMelement = false;
 
             SOAPEnvelope env = soapFactory.getDefaultEnvelope();
 
@@ -79,25 +77,18 @@
                 // OMElement requestOM = dataBinding.toOMElement((Object[]) payload);
                 // env.getBody().addChild(requestOM);
                 // TODO HACK
-                if(((Object [])payload)[0] instanceof OMElement){
+                if (((Object[]) payload)[0] instanceof OMElement) {
                     SOAPBody body = env.getBody();
-                    for(Object bc : ((Object [])payload)){
-                        if(bc instanceof OMElement){
-                            body.addChild((OMElement)bc);
-                        }else{
+                    for (Object bc : ((Object[]) payload)) {
+                        if (bc instanceof OMElement) {
+                            body.addChild((OMElement) bc);
+                        } else {
                             throw new IllegalArgumentException("Can't handle mixed payloads betweem OMElements and other types.");
                         }
                     }
-                }else{
-                    OMFactory fac = env.getOMFactory();
-                    OMElement opE = fac.createOMElement("getGreetings", "http://helloworld", "helloworld");
-                    // <helloworld:name>World</helloworld:name>
-
-                    OMElement parmE = fac.createOMElement("name", "http://helloworld", "helloworld");
-                    opE.addChild(parmE);
-                    parmE.addChild(fac.createOMText(((Object[]) payload)[0] + ""));
-                    env.getBody().addChild(opE);
-                    // TODO HACK
+                } else {
+                    OMElement requestOM = dataBinding.toOMElement((Object[]) payload);
+                    env.getBody().addChild(requestOM);
                 }
 
             }
@@ -106,21 +97,21 @@
             requestMC.setEnvelope(env);
 
             operationClient.addMessageContext(requestMC);
-//Class loader switching is taken out 8/15/06 .. we shouldn't require this any more
-//            ClassLoader tccl = Thread.currentThread().getContextClassLoader();
-//            ClassLoader scl = this.getClass().getClassLoader();
-//            try {
-//               if (tccl != scl) {
-//                    Thread.currentThread().setContextClassLoader(scl);
-//                }
-
-                operationClient.execute(true);
-
-//            } finally {
-//                if (tccl != scl) {
-//                    Thread.currentThread().setContextClassLoader(tccl);
-//                }
-//            }
+            // Class loader switching is taken out 8/15/06 .. we shouldn't require this any more
+            // ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+            // ClassLoader scl = this.getClass().getClassLoader();
+            // try {
+            // if (tccl != scl) {
+            // Thread.currentThread().setContextClassLoader(scl);
+            // }
+
+            operationClient.execute(true);
+
+            // } finally {
+            // if (tccl != scl) {
+            // Thread.currentThread().setContextClassLoader(tccl);
+            // }
+            // }
 
             MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             OMElement responseOM = responseMC.getEnvelope().getBody().getFirstElement();
@@ -131,9 +122,9 @@
             }
 
             Object response;
-            if(pureOMelement){
-                response= responseOM;
-            }else{
+            if (pureOMelement) {
+                response = responseOM;
+            } else {
                 if (os == null || os.length < 1) {
                     response = null;
                 } else {

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java Wed Aug 16 22:47:44 2006
@@ -18,77 +18,133 @@
  */
 package org.apache.tuscany.binding.axis2.util;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+import java.util.List;
+
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.tuscany.databinding.TransformationContext;
+import org.apache.tuscany.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader;
+import org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument;
+import org.apache.tuscany.databinding.xml.StAXBinding;
+import org.apache.tuscany.sdo.util.SDOUtil;
 import org.apache.tuscany.spi.wire.InvocationRuntimeException;
 
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
 import commonj.sdo.helper.TypeHelper;
-import org.apache.axiom.om.OMElement;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
 
 /**
  * DataBinding for converting between AXIOM OMElement and Java Objects
  */
 public class SDODataBinding {
 
-    //private ClassLoader classLoader;
-    //private TypeHelper typeHelper;
-    //private boolean isWrapped;
-    //private QName outElementQName;
-
-    public SDODataBinding(ClassLoader classLoader, TypeHelper typeHelper, boolean isWrapped, QName outElementQName) {
-        //this.classLoader = classLoader;
-        //this.typeHelper = typeHelper;
-        //this.isWrapped = isWrapped;
-        //this.outElementQName = outElementQName;
+    private TypeHelper typeHelper;
+
+    private boolean isWrapped;
+
+    private QName elementName;
+
+    public SDODataBinding(TypeHelper typeHelper, boolean isWrapped, QName elementName) {
+        this.typeHelper = typeHelper;
+        this.isWrapped = isWrapped;
+        this.elementName = elementName;
     }
 
     public Object[] fromOMElement(OMElement omElement) {
-        try {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            omElement.serialize(baos);
-            baos.flush();
-            baos.close();
-
-            //FIXME: need to use SDOXMLHelper
-            //return SDOXMLHelper.toObjects(classLoader,typeHelper, baos.toByteArray(), isWrapped);
-            return null;
-
-        } catch (IOException e) {
-            throw new InvocationRuntimeException(e);
-        } catch (XMLStreamException e) {
-            throw new InvocationRuntimeException(e);
-        }
+        XMLStreamReader reader = omElement.getXMLStreamReader();
+        // HACK: [rfeng] We should use the transformer in an interceptor
+        XMLStreamReader2XMLDocument transformer = new XMLStreamReader2XMLDocument();
+        TransformationContext context = new TransformationContextImpl();
+        StAXBinding binding = new StAXBinding();
+        binding.setAttribute(TypeHelper.class.getName(), typeHelper);
+        context.setTargetDataBinding(binding);
+        XMLDocument document = transformer.transform(reader, context);
+        return toObjects(document, isWrapped);
     }
 
     public OMElement toOMElement(Object[] os) {
-        //FIXME
-/*
-        try {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-            DataObject dataObject = SDOXMLHelper.toDataObject(classLoader, typeHelper, os, outElementQName, isWrapped);
-            XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
-            xmlHelper.save(dataObject, outElementQName.getNamespaceURI(), outElementQName.getLocalPart(), baos);
-            baos.close();
-
-            XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(
-            baos.toByteArray()));
-            OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), xsr);
-            OMElement omElement = builder.getDocumentElement();
-
-            return omElement;
-            return null;
-        } catch (IOException e) {
-            throw new ServiceRuntimeException(e);
-        } catch (XMLStreamException e) {
-            throw new ServiceRuntimeException(e);
-        } catch (FactoryConfigurationError e) {
-            throw new ServiceRuntimeException(e);
-        }*/
-        return null;
+        XMLDocument document = toXMLDocument(typeHelper, os, elementName, isWrapped);
+        // HACK: [rfeng] We should use the transformer in an interceptor
+        XMLDocument2XMLStreamReader transformer = new XMLDocument2XMLStreamReader();
+        XMLStreamReader reader = transformer.transform(document, null);
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), reader);
+        OMElement omElement = builder.getDocumentElement();
+        return omElement;
+    }
+
+    /**
+     * Convert a typed DataObject to Java objects
+     * 
+     * @param dataObject
+     * @param isWrapped
+     * @return the array of Objects from the DataObject
+     */
+    public static Object[] toObjects(XMLDocument document, boolean isWrapped) {
+        DataObject dataObject = document.getRootObject();
+        if (isWrapped) {
+            List ips = dataObject.getInstanceProperties();
+            Object[] os = new Object[ips.size()];
+            for (int i = 0; i < ips.size(); i++) {
+                os[i] = dataObject.get((Property) ips.get(i));
+            }
+            return os;
+        } else {
+            Object object = dataObject;
+            Type type = dataObject.getType();
+            if (type.isSequenced()) {
+                object = dataObject.getSequence().getValue(0);
+            }
+            return new Object[] { object };
+        }
+    }
+
+    /**
+     * Convert objects to typed DataObject
+     * 
+     * @param typeNS
+     * @param typeName
+     * @param os
+     * @return the DataObject
+     */
+    private static XMLDocument toXMLDocument(TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
+        XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
+
+        Property property = xsdHelper.getGlobalProperty(elementQName.getNamespaceURI(), elementQName.getLocalPart(), true);
+        if (null == property) {
+            throw new InvocationRuntimeException("Type '" + elementQName.toString() + "' not found in registered SDO types.");
+        }
+        DataObject dataObject = null;
+        if (isWrapped) {
+            DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper);
+            dataObject = dataFactory.create(property.getType());
+            List ips = dataObject.getInstanceProperties();
+            for (int i = 0; i < ips.size(); i++) {
+                dataObject.set(i, os[i]);
+            }
+        } else {
+            Object value = os[0];
+            Type type = property.getType();
+            if (!type.isDataType()) {
+                dataObject = (DataObject) value;
+            } else {
+                dataObject = SDOUtil.createDataTypeWrapper(type, value);
+            }
+        }
+
+        XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
+        return xmlHelper.createDocument(dataObject, elementQName.getNamespaceURI(), elementQName.getLocalPart());
+
     }
 
 }

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java Wed Aug 16 22:47:44 2006
@@ -18,73 +18,27 @@
  */
 package org.apache.tuscany.binding.axis2.util;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.deployment.AxisConfigBuilder;
-import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.deployment.URLBasedAxisConfigurator;
 import org.apache.axis2.engine.AxisConfigurator;
-import org.osoa.sca.ServiceRuntimeException;
 
 /**
- * Helps configure Axis2 from a resource in binding.axis2 instead of Axis2.xml
- * <p/>
- * TODO: Review: should there be a single global Axis ConfigurationContext
+ * Helps configure Axis2 from a resource in binding.axis2 instead of Axis2.xml 
+ * <p/> TODO: Review: should there be a single global Axis
+ * ConfigurationContext
  */
-public class TuscanyAxisConfigurator implements AxisConfigurator {
-
-    protected AxisConfiguration axisConfiguration;
-
-    //FIXME: how to get component specific classloader
-    //protected final ResourceLoader resourceLoader;
-
-    /**
-     * @param axisConfiguration Starting axis configuration, null then use uninitialized configuration.
-     */
-    /*
-    public TuscanyAxisConfigurator(ResourceLoader resourceLoader, AxisConfiguration axisConfiguration) {
-        this.resourceLoader = resourceLoader != null ? resourceLoader :
-            new ResourceLoaderImpl(getClass().getClassLoader());
-        this.axisConfiguration = axisConfiguration == null ? new AxisConfiguration() : axisConfiguration;
-    }
-    */
-    public TuscanyAxisConfigurator(AxisConfiguration axisConfiguration) {
-        this.axisConfiguration = axisConfiguration == null ? new AxisConfiguration() : axisConfiguration;
-    }
+public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator {
 
-    public AxisConfiguration getAxisConfiguration() {
-        return axisConfiguration;
+    public TuscanyAxisConfigurator() throws AxisFault {
+        super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/binding/axis2/engine/config/axis2.xml"), null);
     }
 
-    public ConfigurationContext getConfigurationContext() throws ServiceRuntimeException {
-        try {
-            //FIXME: use component specific classloader to load config file
-            //URL url = resourceLoader.getResource("org/apache/tuscany/binding/axis2/engine/config/axis2.xml");
-            URL url = this.getClass().getResource("/org/apache/tuscany/binding/axis2/engine/config/axis2.xml");
-
-            InputStream serviceInputStream = url.openStream();
-            AxisConfigBuilder axisConfigBuilder =
-//                new AxisConfigBuilder(serviceInputStream, new DeploymentEngine(), axisConfiguration);
-                new AxisConfigBuilder(serviceInputStream,  axisConfiguration);
-            axisConfigBuilder.populateConfig();
-            serviceInputStream.close();
-            return ConfigurationContextFactory.createConfigurationContext(this);
-        } catch (IOException e) {
-            throw new ServiceRuntimeException(e);
-        }
-    }
-
-    public void loadServices() {
-        // TODO Auto-generated method stub
-
+    public ConfigurationContext getConfigurationContext() throws AxisFault {
+        if (configContext == null)
+            configContext = ConfigurationContextFactory.createConfigurationContext(this);
+        return configContext;
     }
 
-    public void engageGlobalModules() throws AxisFault {
-        // TODO Auto-generated method stub
-
-    }
 }

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/resources/META-INF/sca/default.scdl Wed Aug 16 22:47:44 2006
@@ -17,24 +17,24 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
+<!-- Axis2 based WebService binding extension -->
 <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
            xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
-
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/1.0-SNAPSHOT"
            name="org.apache.tuscany.binding.axis2.WebServiceBinding">
 
-    <dependency>
+    <tuscany:dependency>
         <group>axis2</group>
         <artifact>axis2-core</artifact>
         <version>SNAPSHOT</version>
-    </dependency>
+    </tuscany:dependency>
     
-    <component name="ws.implementationLoader">
+    <component name="webservice.bindingLoader">
         <system:implementation.system class="org.apache.tuscany.binding.axis2.WebServiceBindingLoader"/>
     </component>
 
-    <component name="ws.componentBuilder">
+    <component name="webservice.axis2.bindingBuilder">
         <system:implementation.system class="org.apache.tuscany.binding.axis2.Axis2BindingBuilder"/>
     </component>
-
 
 </composite>

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java Wed Aug 16 22:47:44 2006
@@ -37,6 +37,8 @@
 import org.apache.tuscany.spi.wire.TargetInvoker;
 import org.apache.tuscany.spi.wire.WireService;
 
+import commonj.sdo.helper.TypeHelper;
+
 public class Axis2ReferenceTestCase extends TestCase {
 
     public void testInvokeService() throws Exception {
@@ -69,6 +71,6 @@
         // TODO figure out what to do with the service contract
         ServiceContract contract = new WSDLServiceContract();
         contract.setInterfaceClass(Greeter.class);
-        return new Axis2Reference(serviceName, parent, wireService, wsBinding, contract);
+        return new Axis2Reference(serviceName, parent, wireService, wsBinding, contract, TypeHelper.INSTANCE);
     }
 }

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java?rev=432156&r1=432155&r2=432156&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java Wed Aug 16 22:47:44 2006
@@ -38,6 +38,8 @@
 import junit.framework.TestCase;
 import org.easymock.classextension.EasyMock;
 
+import commonj.sdo.helper.TypeHelper;
+
 public class Axis2ServiceTestCase extends TestCase {
 
     public void testInvokeService() throws Exception {
@@ -85,7 +87,7 @@
         EasyMock.replay(inboundWire);
 
         Axis2Service<Greeter> axis2Service =
-            new Axis2Service<Greeter>(serviceName, Greeter.class, null, wireService, wsBinding, tomcatHost, null);
+            new Axis2Service<Greeter>(serviceName, Greeter.class, null, wireService, wsBinding, tomcatHost, null, TypeHelper.INSTANCE);
         axis2Service.setInboundWire(inboundWire);
 
         return axis2Service;



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


Re: svn commit: r432156

Posted by Jim Marino <jm...@myromatours.com>.
On Aug 19, 2006, at 9:20 AM, Raymond Feng wrote:

> Hi,
>
> Sorry for not responding promtly as I'm busy with the DataBinding  
> Inteceptor story. Please see my comments inline below.
>
> Thanks,
> Raymond
>
> ----- Original Message ----- From: "Jim Marino"  
> <jm...@myromatours.com>
> To: <tu...@ws.apache.org>
> Sent: Thursday, August 17, 2006 9:45 AM
> Subject: Re: svn commit: r432156
>
>
>>
>> On Aug 17, 2006, at 9:29 AM, Raymond Feng wrote:
>>
>>> Hi, Jim.
>>>
>>> Sorry for the confusion.
>>>
>>> First of all, I want to reassure you that we're still on the  
>>> same  page
>>> for the overrall direction:
>> Based on your comments below, I'm not sure we are :-)
>>>
>>> 1. I fully agree with you that it's a real hack and it's only a
>>> temporary fix for one or two weeks while I'm working out the   
>>> databinding
>>> integration. The hack will be definitely removed before  we  
>>> release the
>>> Axis2 binding.
>>> 2. Axis2 binding is an extension instead of part of the core. We   
>>> need to
>>> deploy it as an extension instead of poluting the webapp  runtime.
>>>
>>> Here's some background that I decided to add such a hack. Rick had
>>> pinged me to see if we can bring up the Axis2 binding to the same
>>> functionality as it had for M1 so that we can perform the Axis2
>>> intergration tests without having to rewrite all the interop  
>>> tests  using
>>> AXIOM. I thought it's reasonable and a working end-to-end  case  
>>> might
>>> also help me to better understand the core/extension/ databinding
>>> integration picture so that I can get it right quickly.  I  
>>> apologized
>>> that I didn't communicate it clearly before the check-in.
>>
>> Could you explain why all of the interop tests require SDO? That   
>> seems a
>> bit strange.
>
> We need to exchange some data conforming to the WSDL/XSD. One  
> convenient way to do that is using a XML databinding framework such  
> as SDO and JAXB. I happened to pick SDO just because I'm familar  
> with SDO and I wanted to stay with SDO as the starting point as the  
> M1 does.
>
Are we testing interop of SDO/Axis or just Axis? If it is the former,  
then we should have integration tests that do this away from the Axis  
package so we don't pollute it with this hack. If we are testing  
Axis, shouldn't we be just using its native databinding?

>>
>> I don't think this should be checked into the main line but  
>> rather  done
>> in the sandbox as it violates one of the architecture principles   
>> we set
>> forth. In terms of working out databinding integration, this  should
>> really be done through unit testing as much as possible first.   
>> Note that
>> none of the steps you mentioned below need to be done  outside the  
>> context
>> of core, much less require breaking modularity.
>>
>
> I promise I'll be more cautious next time.
>
What I'd like to do is fix this, as it is leading (again) to hack  
upon hack which gave us tremendous problems in M1. For example,  
Celtix needs to modify the POMs to run in the webapp. I think we have  
a few options:

1. Add the necessary things to make databinding pluggable over the  
next few days
2. Isolate the intergation dependencies into another project to  
decouple SDO and Axis
3. Fix any classloader problems in webapp
4. If we need to do a hack like this in the future, do it in the  
sandbox and not on the main dev line :-)

Comments?

Jim


>>>
>>> Anyway, here's the path I'm full-time on now to work toward the   
>>> solution
>>> that we have been discussing on this list.
>>>
>>> 1. Integrate the DataBinding framework with the ServiceContract/
>>> Operation/DataType model
>>> 2. Integrate the DataBinding framework with the wiring fabric  
>>> using  an
>>> Interceptor
>>>    * Associate some databinding-related context to the composite
>>> hierachary
>>>        * Adjust the builder delegation strategy
>>>    * Attach an interceptor the wiring fabric to perform the data
>>> transformation based on the databinding context
>>>        * Question: Do we model databinding as a policy or part  
>>> of  the
>>> core?
>>>
>> Data binding should be done as part of the wiring infrastructure  
>> in  core.
>> "Policy" is a euphemism for the the part of core that  introduces
>> interceptors and handlers, and is itself extensible. We  may need to
>> modify it somewhat so that the databinding policy builder  has  
>> information
>> about the target and source of a wire.
>
> Thank you for the information. I'm actively looking into the policy  
> builder now to get the databinding into the wiring infrastructure  
> as interceptors. I'll post the progress and questions as I go.
>
>>
>>> Thanks,
>>> Raymond
>>>
>>> ----- Original Message ----- From: "Jim Marino"
>>> <jm...@myromatours.com>
>>> To: <tu...@ws.apache.org>
>>> Sent: Thursday, August 17, 2006 12:14 AM
>>> Subject: Fwd: svn commit: r432156
>>>
>>>
>>>> Raymond,
>>>>
>>>> I've noticed an SDO and databinding implementation dependencies   
>>>> have
>>>> been introduced into the Axis2 binding. Based on your  comments  
>>>> in the
>>>> code, it appears this is temporary and related to  implementing an
>>>> interceptor into the policy framework. I'd prefer  that we work on
>>>> getting the correct solution in place ASAP and am  uncomfortable  
>>>> with
>>>> introducing hacks such as this one. There was  an email thread the
>>>> other day about introducing an interceptor  and am happy to provide
>>>> assistance if required.
>>>>
>>>> Could you please outline what is required so we can work towards  a
>>>> proper solution?
>>>>
>>>> Thanks,
>>>> Jim
>>>>
>>>>>
>>>>> Modified:
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/Axis2Reference.java
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/Axis2Service.java
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/
>>>>> Axis2ServiceInOutSyncMessageReceiver.java
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/util/SDODataBinding.java
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/util/  
>>>>> TuscanyAxisConfigurator.java
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/
>>>>> resources/META-INF/sca/default.scdl
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
>>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/  
>>>>> java/
>>>>> org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------- 
>>>> --
>>>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>>>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>


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


Re: svn commit: r432156

Posted by Raymond Feng <en...@gmail.com>.
Hi,

Sorry for not responding promtly as I'm busy with the DataBinding Inteceptor 
story. Please see my comments inline below.

Thanks,
Raymond

----- Original Message ----- 
From: "Jim Marino" <jm...@myromatours.com>
To: <tu...@ws.apache.org>
Sent: Thursday, August 17, 2006 9:45 AM
Subject: Re: svn commit: r432156


>
> On Aug 17, 2006, at 9:29 AM, Raymond Feng wrote:
>
>> Hi, Jim.
>>
>> Sorry for the confusion.
>>
>> First of all, I want to reassure you that we're still on the same  page
>> for the overrall direction:
> Based on your comments below, I'm not sure we are :-)
>>
>> 1. I fully agree with you that it's a real hack and it's only a
>> temporary fix for one or two weeks while I'm working out the  databinding
>> integration. The hack will be definitely removed before  we release the
>> Axis2 binding.
>> 2. Axis2 binding is an extension instead of part of the core. We  need to
>> deploy it as an extension instead of poluting the webapp  runtime.
>>
>> Here's some background that I decided to add such a hack. Rick had
>> pinged me to see if we can bring up the Axis2 binding to the same
>> functionality as it had for M1 so that we can perform the Axis2
>> intergration tests without having to rewrite all the interop tests  using
>> AXIOM. I thought it's reasonable and a working end-to-end  case might
>> also help me to better understand the core/extension/ databinding
>> integration picture so that I can get it right quickly.  I apologized
>> that I didn't communicate it clearly before the check-in.
>
> Could you explain why all of the interop tests require SDO? That  seems a
> bit strange.

We need to exchange some data conforming to the WSDL/XSD. One convenient way 
to do that is using a XML databinding framework such as SDO and JAXB. I 
happened to pick SDO just because I'm familar with SDO and I wanted to stay 
with SDO as the starting point as the M1 does.

>
> I don't think this should be checked into the main line but rather  done
> in the sandbox as it violates one of the architecture principles  we set
> forth. In terms of working out databinding integration, this  should
> really be done through unit testing as much as possible first.  Note that
> none of the steps you mentioned below need to be done  outside the context
> of core, much less require breaking modularity.
>

I promise I'll be more cautious next time.

>>
>> Anyway, here's the path I'm full-time on now to work toward the  solution
>> that we have been discussing on this list.
>>
>> 1. Integrate the DataBinding framework with the ServiceContract/
>> Operation/DataType model
>> 2. Integrate the DataBinding framework with the wiring fabric using  an
>> Interceptor
>>    * Associate some databinding-related context to the composite
>> hierachary
>>        * Adjust the builder delegation strategy
>>    * Attach an interceptor the wiring fabric to perform the data
>> transformation based on the databinding context
>>        * Question: Do we model databinding as a policy or part of  the
>> core?
>>
> Data binding should be done as part of the wiring infrastructure in  core.
> "Policy" is a euphemism for the the part of core that  introduces
> interceptors and handlers, and is itself extensible. We  may need to
> modify it somewhat so that the databinding policy builder  has information
> about the target and source of a wire.

Thank you for the information. I'm actively looking into the policy builder 
now to get the databinding into the wiring infrastructure as interceptors. 
I'll post the progress and questions as I go.

>
>> Thanks,
>> Raymond
>>
>> ----- Original Message ----- From: "Jim Marino"
>> <jm...@myromatours.com>
>> To: <tu...@ws.apache.org>
>> Sent: Thursday, August 17, 2006 12:14 AM
>> Subject: Fwd: svn commit: r432156
>>
>>
>>> Raymond,
>>>
>>> I've noticed an SDO and databinding implementation dependencies  have
>>> been introduced into the Axis2 binding. Based on your  comments in the
>>> code, it appears this is temporary and related to  implementing an
>>> interceptor into the policy framework. I'd prefer  that we work on
>>> getting the correct solution in place ASAP and am  uncomfortable with
>>> introducing hacks such as this one. There was  an email thread the
>>> other day about introducing an interceptor  and am happy to provide
>>> assistance if required.
>>>
>>> Could you please outline what is required so we can work towards  a
>>> proper solution?
>>>
>>> Thanks,
>>> Jim
>>>
>>>>
>>>> Modified:
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ java/
>>>> org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ java/
>>>> org/apache/tuscany/binding/axis2/Axis2Reference.java
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ java/
>>>> org/apache/tuscany/binding/axis2/Axis2Service.java
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ java/
>>>> org/apache/tuscany/binding/axis2/
>>>> Axis2ServiceInOutSyncMessageReceiver.java
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ java/
>>>> org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ java/
>>>> org/apache/tuscany/binding/axis2/util/SDODataBinding.java
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ java/
>>>> org/apache/tuscany/binding/axis2/util/ TuscanyAxisConfigurator.java
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/
>>>> resources/META-INF/sca/default.scdl
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/ java/
>>>> org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
>>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/ java/
>>>> org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>


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


Re: svn commit: r432156

Posted by Jim Marino <jm...@myromatours.com>.
On Aug 17, 2006, at 9:29 AM, Raymond Feng wrote:

> Hi, Jim.
>
> Sorry for the confusion.
>
> First of all, I want to reassure you that we're still on the same  
> page for the overrall direction:
Based on your comments below, I'm not sure we are :-)
>
> 1. I fully agree with you that it's a real hack and it's only a  
> temporary fix for one or two weeks while I'm working out the  
> databinding integration. The hack will be definitely removed before  
> we release the Axis2 binding.
> 2. Axis2 binding is an extension instead of part of the core. We  
> need to deploy it as an extension instead of poluting the webapp  
> runtime.
>
> Here's some background that I decided to add such a hack. Rick had  
> pinged me to see if we can bring up the Axis2 binding to the same  
> functionality as it had for M1 so that we can perform the Axis2  
> intergration tests without having to rewrite all the interop tests  
> using AXIOM. I thought it's reasonable and a working end-to-end  
> case might also help me to better understand the core/extension/ 
> databinding integration picture so that I can get it right quickly.  
> I apologized that I didn't communicate it clearly before the check-in.

Could you explain why all of the interop tests require SDO? That  
seems a bit strange.

I don't think this should be checked into the main line but rather  
done in the sandbox as it violates one of the architecture principles  
we set forth. In terms of working out databinding integration, this  
should really be done through unit testing as much as possible first.  
Note that none of the steps you mentioned below need to be done  
outside the context of core, much less require breaking modularity.

>
> Anyway, here's the path I'm full-time on now to work toward the  
> solution that we have been discussing on this list.
>
> 1. Integrate the DataBinding framework with the ServiceContract/ 
> Operation/DataType model
> 2. Integrate the DataBinding framework with the wiring fabric using  
> an Interceptor
>    * Associate some databinding-related context to the composite  
> hierachary
>        * Adjust the builder delegation strategy
>    * Attach an interceptor the wiring fabric to perform the data  
> transformation based on the databinding context
>        * Question: Do we model databinding as a policy or part of  
> the core?
>
Data binding should be done as part of the wiring infrastructure in  
core. "Policy" is a euphemism for the the part of core that  
introduces interceptors and handlers, and is itself extensible. We  
may need to modify it somewhat so that the databinding policy builder  
has information about the target and source of a wire.

> Thanks,
> Raymond
>
> ----- Original Message ----- From: "Jim Marino"  
> <jm...@myromatours.com>
> To: <tu...@ws.apache.org>
> Sent: Thursday, August 17, 2006 12:14 AM
> Subject: Fwd: svn commit: r432156
>
>
>> Raymond,
>>
>> I've noticed an SDO and databinding implementation dependencies  
>> have  been introduced into the Axis2 binding. Based on your  
>> comments in the  code, it appears this is temporary and related to  
>> implementing an  interceptor into the policy framework. I'd prefer  
>> that we work on  getting the correct solution in place ASAP and am  
>> uncomfortable with  introducing hacks such as this one. There was  
>> an email thread the  other day about introducing an interceptor  
>> and am happy to provide  assistance if required.
>>
>> Could you please outline what is required so we can work towards  
>> a  proper solution?
>>
>> Thanks,
>> Jim
>>
>>>
>>> Modified:
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
>>> java/ org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
>>> java/ org/apache/tuscany/binding/axis2/Axis2Reference.java
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
>>> java/ org/apache/tuscany/binding/axis2/Axis2Service.java
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
>>> java/ org/apache/tuscany/binding/axis2/  
>>> Axis2ServiceInOutSyncMessageReceiver.java
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
>>> java/ org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
>>> java/ org/apache/tuscany/binding/axis2/util/SDODataBinding.java
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
>>> java/ org/apache/tuscany/binding/axis2/util/ 
>>> TuscanyAxisConfigurator.java
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/  
>>> resources/META-INF/sca/default.scdl
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/ 
>>> java/ org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
>>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/ 
>>> java/ org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>


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


Re: svn commit: r432156

Posted by Raymond Feng <en...@gmail.com>.
Hi, Jim.

Sorry for the confusion.

First of all, I want to reassure you that we're still on the same page for 
the overrall direction:

1. I fully agree with you that it's a real hack and it's only a temporary 
fix for one or two weeks while I'm working out the databinding integration. 
The hack will be definitely removed before we release the Axis2 binding.
2. Axis2 binding is an extension instead of part of the core. We need to 
deploy it as an extension instead of poluting the webapp runtime.

Here's some background that I decided to add such a hack. Rick had pinged me 
to see if we can bring up the Axis2 binding to the same functionality as it 
had for M1 so that we can perform the Axis2 intergration tests without 
having to rewrite all the interop tests using AXIOM. I thought it's 
reasonable and a working end-to-end case might also help me to better 
understand the core/extension/databinding integration picture so that I can 
get it right quickly. I apologized that I didn't communicate it clearly 
before the check-in.

Anyway, here's the path I'm full-time on now to work toward the solution 
that we have been discussing on this list.

1. Integrate the DataBinding framework with the 
ServiceContract/Operation/DataType model
2. Integrate the DataBinding framework with the wiring fabric using an 
Interceptor
    * Associate some databinding-related context to the composite hierachary
        * Adjust the builder delegation strategy
    * Attach an interceptor the wiring fabric to perform the data 
transformation based on the databinding context
        * Question: Do we model databinding as a policy or part of the core?

Thanks,
Raymond

----- Original Message ----- 
From: "Jim Marino" <jm...@myromatours.com>
To: <tu...@ws.apache.org>
Sent: Thursday, August 17, 2006 12:14 AM
Subject: Fwd: svn commit: r432156


> Raymond,
>
> I've noticed an SDO and databinding implementation dependencies have  been 
> introduced into the Axis2 binding. Based on your comments in the  code, it 
> appears this is temporary and related to implementing an  interceptor into 
> the policy framework. I'd prefer that we work on  getting the correct 
> solution in place ASAP and am uncomfortable with  introducing hacks such 
> as this one. There was an email thread the  other day about introducing an 
> interceptor and am happy to provide  assistance if required.
>
> Could you please outline what is required so we can work towards a  proper 
> solution?
>
> Thanks,
> Jim
>
>>
>> Modified:
>>     incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
>> org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
>> org/apache/tuscany/binding/axis2/Axis2Reference.java
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
>> org/apache/tuscany/binding/axis2/Axis2Service.java
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
>> org/apache/tuscany/binding/axis2/ 
>> Axis2ServiceInOutSyncMessageReceiver.java
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
>> org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
>> org/apache/tuscany/binding/axis2/util/SDODataBinding.java
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
>> org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
>> resources/META-INF/sca/default.scdl
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/ 
>> org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
>>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/ 
>> org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> 


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


Fwd: svn commit: r432156

Posted by Jim Marino <jm...@myromatours.com>.
Raymond,

I've noticed an SDO and databinding implementation dependencies have  
been introduced into the Axis2 binding. Based on your comments in the  
code, it appears this is temporary and related to implementing an  
interceptor into the policy framework. I'd prefer that we work on  
getting the correct solution in place ASAP and am uncomfortable with  
introducing hacks such as this one. There was an email thread the  
other day about introducing an interceptor and am happy to provide  
assistance if required.

Could you please outline what is required so we can work towards a  
proper solution?

Thanks,
Jim

>
> Modified:
>     incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
> org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
> org/apache/tuscany/binding/axis2/Axis2Reference.java
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
> org/apache/tuscany/binding/axis2/Axis2Service.java
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
> org/apache/tuscany/binding/axis2/ 
> Axis2ServiceInOutSyncMessageReceiver.java
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
> org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
> org/apache/tuscany/binding/axis2/util/SDODataBinding.java
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ 
> org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/main/ 
> resources/META-INF/sca/default.scdl
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/ 
> org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
>     incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/ 
> org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
>
>


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