You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2007/03/14 11:15:34 UTC

svn commit: r518088 - in /incubator/tuscany/java/sca/extensions/axis2: ./ binding/ binding/src/main/java/org/apache/tuscany/binding/axis2/ binding/src/test/java/org/apache/tuscany/binding/axis2/

Author: antelder
Date: Wed Mar 14 03:15:19 2007
New Revision: 518088

URL: http://svn.apache.org/viewvc?view=rev&rev=518088
Log:
Copy latest Axis2 binding code from integration brn and start getting to go with latest trunk spi. Compiles cleanly but a lot still to do before it works

Added:
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java   (with props)
Modified:
    incubator/tuscany/java/sca/extensions/axis2/binding/pom.xml
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
    incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
    incubator/tuscany/java/sca/extensions/axis2/pom.xml

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/pom.xml?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/pom.xml (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/pom.xml Wed Mar 14 03:15:19 2007
@@ -19,13 +19,16 @@
 -->
 <project>
     <parent>
-        <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+        <groupId>org.apache.tuscany.sca.axis2</groupId>
         <artifactId>parent</artifactId>
-        <version>1.0-incubator-SNAPSHOT</version>
+        <version>2.0-alpha2-incubating-SNAPSHOT</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+    <groupId>org.apache.tuscany.sca.axis2</groupId>
     <artifactId>tuscany-axis2</artifactId>
+
     <name>Apache Tuscany Binding for Axis2</name>
     <description>Implementation of the SCA Web Services binding using Axis2</description>
 
@@ -33,21 +36,22 @@
         <dependency>
             <groupId>org.apache.tuscany.sca.services.idl</groupId>
             <artifactId>wsdl</artifactId>
-            <version>${scaKernelVersion}</version>
+            <version>2.0-alpha2-incubating-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
 
         <!-- A hack to bring in databinding-axiom transitively -->
-        <dependency>
+        <!-- dependency>
             <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
             <artifactId>databinding-axiom</artifactId>
-            <version>${extensionVersion}</version>
+            <version>2.0-alpha2-incubating-SNAPSHOT</version>
             <scope>runtime</scope>
-        </dependency>
+        </dependency -->
 
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
+		<version>2.4</version>
         </dependency>
 
         <dependency>
@@ -73,6 +77,7 @@
         <dependency>
             <groupId>woodstox</groupId>
             <artifactId>wstx-asl</artifactId>
+            <version>3.2.0</version>
         </dependency>
 
         <dependency>
@@ -119,12 +124,14 @@
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
+		<version>2.2</version>
         </dependency>
 
-        <dependency>
+        <!-- dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>test</artifactId>
-        </dependency>
+            <version>2.0-alpha2-incubating-SNAPSHOT</version>
+        </dependency -->
 
     </dependencies>
 </project>

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java Wed Mar 14 03:15:19 2007
@@ -19,20 +19,20 @@
 package org.apache.tuscany.binding.axis2;
 
 import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
 import java.util.LinkedList;
 import java.util.concurrent.CountDownLatch;
 
 import javax.xml.namespace.QName;
 
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
-import org.apache.tuscany.spi.wire.Message;
-
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
 
 public class Axis2AsyncTargetInvoker extends Axis2TargetInvoker {
 
@@ -49,7 +49,7 @@
         throw new InvocationTargetException(new InvocationRuntimeException("Operation not supported"));
     }
 
-    private Object invokeTarget(final Object payload, LinkedList<Object> callbackRoutingChain)
+    private Object invokeTarget(final Object payload, LinkedList<URI> callbackRoutingChain)
         throws InvocationTargetException {
         try {
             Object[] args = (Object[]) payload;
@@ -80,7 +80,8 @@
 
     public Message invoke(Message msg) throws InvocationRuntimeException {
         try {
-            Object resp = invokeTarget(msg.getBody(), msg.getCallbackRoutingChain());
+//            Object resp = invokeTarget(msg.getBody(), msg.getCallbackRoutingChain()); // TODO: getCallbackRoutingChain no longer exists
+            Object resp = invokeTarget(msg.getBody(), null);
             msg.setBody(resp);
         } catch (Throwable e) {
             msg.setBodyWithFault(e);

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java Wed Mar 14 03:15:19 2007
@@ -18,12 +18,20 @@
  */
 package org.apache.tuscany.binding.axis2;
 
+import java.net.URI;
+
 import javax.wsdl.Port;
 import javax.wsdl.PortType;
 
-import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
+import org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector;
+import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
 import org.apache.tuscany.spi.builder.BuilderConfigException;
-import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.builder.BuilderException;
 import org.apache.tuscany.spi.component.ReferenceBinding;
 import org.apache.tuscany.spi.component.ServiceBinding;
 import org.apache.tuscany.spi.component.WorkContext;
@@ -31,17 +39,10 @@
 import org.apache.tuscany.spi.extension.BindingBuilderExtension;
 import org.apache.tuscany.spi.host.ServletHost;
 import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.model.BoundReferenceDefinition;
-import org.apache.tuscany.spi.model.BoundServiceDefinition;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
-import org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector;
-import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.osoa.sca.annotations.Reference;
 
 /**
  * Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.ReferenceBinding} configured
@@ -49,9 +50,13 @@
  *
  * @version $Rev$ $Date$
  */
+@SuppressWarnings("deprecation")
 public class Axis2BindingBuilder extends BindingBuilderExtension<WebServiceBindingDefinition> {
     private static final String OM_DATA_BINDING = OMElement.class.getName();
 
+    // TODO: what to do about the base URI?
+    private static final String BASE_URI = "http://localhost:8080/";
+
     private ServletHost servletHost;
 
     private ConfigurationContext configContext;
@@ -60,11 +65,13 @@
 
     private WorkContext workContext;
 
+    private WSDLDefinitionRegistry wsdlReg;
+
     public Axis2BindingBuilder() throws BuilderConfigException {
         initAxis();
     }
 
-    @Autowire(required = false)
+    @Reference(required = false)
     public void setServletHost(ServletHost servletHost) {
         this.servletHost = servletHost;
     }
@@ -72,30 +79,43 @@
     /**
      * @param introspector the introspector to set
      */
-    @Autowire
+    @Reference
     public void setIntrospector(InterfaceWSDLIntrospector introspector) {
         this.introspector = introspector;
     }
 
-    @Autowire
+    @Reference
     public void setWorkContext(WorkContext workContext) {
         this.workContext = workContext;
     }
 
+    @Reference
+    public void setWSDLDefinitionRegistry(WSDLDefinitionRegistry wsdlReg) {
+        this.wsdlReg = wsdlReg;
+    }
 
     @SuppressWarnings("unchecked")
     public ServiceBinding build(
-        CompositeComponent parent,
-        BoundServiceDefinition serviceDefinition,
+        ServiceDefinition serviceDefinition,
         WebServiceBindingDefinition wsBinding, DeploymentContext deploymentContext) {
 
         try {
             // Set the default databinding
-            ServiceContract<?> outboundContract = serviceDefinition.getServiceContract();
-            if (WSDLServiceContract.class.isInstance(outboundContract)) {
+            ServiceContract outboundContract = serviceDefinition.getServiceContract();
+            if (outboundContract instanceof WSDLServiceContract) {
                 outboundContract.setDataBinding(OM_DATA_BINDING);
             }
 
+            // TODO: TUSCANY-1148, <binding.ws> with no wsdl only works with <interface.wsdl>
+            if (wsBinding.getWSDLDefinition() == null) {
+                if (outboundContract instanceof WSDLServiceContract) {
+                    String ns = ((WSDLServiceContract)outboundContract).getPortType().getQName().getNamespaceURI();
+                    wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
+                } else {
+                    throw new IllegalStateException("<binding.ws> with no WSDL requires using <interface.wsdl>");
+                }
+            }
+
             // FIXME: We need to define how the WSDL PortType is honored in the case that
             // both the service.ws and interface.wsdl are in place.
             // The WSDL portType from the WSDL Port decides the incoming SOAP message format
@@ -116,15 +136,30 @@
             inboundContract.setInterfaceClass(serviceDefinition.getServiceContract().getInterfaceClass());
             inboundContract.setDataBinding(OM_DATA_BINDING);
             inboundContract.setCallbackName(serviceDefinition.getServiceContract().getCallbackName());
-            inboundContract.setInteractionScope(serviceDefinition.getServiceContract().getInteractionScope());
-            try {
-                wireService.checkCompatibility(inboundContract, outboundContract, true);
-            } catch (IncompatibleServiceContractException e) {
-                throw new Axis2BindingBuilderRuntimeException(e);
+            
+//            inboundContract.setInteractionScope(serviceDefinition.getServiceContract().getInteractionScope()); // TODO: gone
+
+// TODO: gone            
+//            try {
+//                wireService.checkCompatibility(inboundContract, outboundContract, true);
+//            } catch (IncompatibleServiceContractException e) {
+//                throw new Axis2BindingBuilderRuntimeException(e);
+//            }
+
+            URI axisServiceName;
+            if (wsBinding.isSpec10Compliant()) {
+                wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, serviceDefinition.getTarget(), serviceDefinition.getUri()));
+                String name = wsBinding.getActualURI().getPath();
+                if (name != null && name.length() > 1 && name.startsWith("/")) {
+                    name = name.substring(1);
+                }
+                axisServiceName = URI.create(name);
+            } else {
+                axisServiceName = serviceDefinition.getUri();  // TODO: verify name
             }
 
             ServiceBinding serviceBinding =
-                new Axis2ServiceBinding(serviceDefinition.getName(), outboundContract, inboundContract, parent, wsBinding,
+                new Axis2ServiceBinding(axisServiceName, outboundContract, inboundContract, wsBinding,
                     servletHost, configContext, workContext);
             return serviceBinding;
 
@@ -135,49 +170,63 @@
 
     @SuppressWarnings("unchecked")
     public ReferenceBinding build(
-        CompositeComponent parent,
-        BoundReferenceDefinition boundReferenceDefinition,
+        ReferenceDefinition boundReferenceDefinition,
         WebServiceBindingDefinition wsBinding,
         DeploymentContext deploymentContext) {
 
-        try {
-            // Set the default binding
-            ServiceContract<?> inboundContract = boundReferenceDefinition.getServiceContract();
-            if (WSDLServiceContract.class.isInstance(inboundContract)) {
-                inboundContract.setDataBinding(OM_DATA_BINDING);
-            }
-
-            // FIXME: We need to define how the WSDL PortType is honored in the case that
-            // both the binding.ws and interface.wsdl are in place
-            // The WSDL portType from the WSDL Port decides the incoming SOAP message format
+        // Set the default binding
+        ServiceContract inboundContract = boundReferenceDefinition.getServiceContract();
+        if (inboundContract instanceof WSDLServiceContract) {
+            inboundContract.setDataBinding(OM_DATA_BINDING);
+        }
 
-            ServiceContract<?> outboundContract = inboundContract;
-            Port port = wsBinding.getWSDLPort();
-            if (port == null) {
-                // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one from
-                // the inbound service contract if it's JavaServiceContract
-                outboundContract = inboundContract;
+        // TODO: TUSCANY-1148, <binding.ws> with no wsdl only works with <interface.wsdl>
+        if (wsBinding.getWSDLDefinition() == null) {
+            if (inboundContract instanceof WSDLServiceContract) {
+                String ns = ((WSDLServiceContract)inboundContract).getPortType().getQName().getNamespaceURI();
+                wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
+            } else {
+                throw new IllegalStateException("<binding.ws> with no WSDL requires using <interface.wsdl>");
             }
-            PortType portType = port.getBinding().getPortType();
-            outboundContract = introspector.introspect(portType);
+        }
 
-            // Set the default databinding
-            outboundContract.setDataBinding(OM_DATA_BINDING);
-            //FIXME ... need to figure out how to specify scope on wsdl.
-            outboundContract.setInteractionScope(inboundContract.getInteractionScope());
-
-            try {
-                wireService.checkCompatibility(inboundContract, outboundContract, true);
-            } catch (IncompatibleServiceContractException e) {
-                throw new Axis2BindingBuilderRuntimeException(e);
-            }
+        // FIXME: We need to define how the WSDL PortType is honored in the case that
+        // both the binding.ws and interface.wsdl are in place
+        // The WSDL portType from the WSDL Port decides the incoming SOAP message format
+
+        ServiceContract<?> outboundContract = inboundContract;
+        Port port = wsBinding.getWSDLPort();
+        if (port == null) {
+            // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one from
+            // the inbound service contract if it's JavaServiceContract
+            outboundContract = inboundContract;
+        }
+        PortType portType = port.getBinding().getPortType();
+        try {
+            outboundContract = introspector.introspect(portType);
+        } catch (InvalidServiceContractException e) {
+            new Axis2BindingBuilderRuntimeException(e);
+        }
 
-            return new Axis2ReferenceBinding(boundReferenceDefinition.getName(), parent, wsBinding,
-                inboundContract, outboundContract, workContext);
+        // Set the default databinding
+        outboundContract.setDataBinding(OM_DATA_BINDING);
+        //FIXME ... need to figure out how to specify scope on wsdl.
+//        outboundContract.setInteractionScope(inboundContract.getInteractionScope()); // methdod gone
+
+// TODO: gone        
+//        try {
+//            wireService.checkCompatibility(inboundContract, outboundContract, true);
+//        } catch (IncompatibleServiceContractException e) {
+//            throw new Axis2BindingBuilderRuntimeException(e);
+//        }
 
-        } catch (InvalidServiceContractException e) {
-            throw new Axis2BindingBuilderRuntimeException(e);
+        if (wsBinding.isSpec10Compliant()) {
+            wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, null, boundReferenceDefinition.getUri()));
         }
+
+        return new Axis2ReferenceBinding(boundReferenceDefinition.getUri(), wsBinding,
+            inboundContract, outboundContract, workContext);
+
     }
 
     protected Class<WebServiceBindingDefinition> getBindingType() {
@@ -191,6 +240,94 @@
         } catch (AxisFault e) {
             throw new BuilderConfigException(e);
         }
+    }
+    
+    /**
+     * Compute the endpoint URI based on section 2.1.1 of the WS binding spec
+     * 1. The URIs in the endpoint(s) of the referenced WSDL, which may be relative
+     * 2. The URI specified by the wsa:Address element of the wsa:EndpointReference, which may be relative
+     * 3. The explicitly stated URI in the "uri" attribute of the binding.ws element, which may be relative,
+     * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly spec 
+     * If the <binding.ws> has no wsdlElement but does have a uri attribute then the uri takes precidence
+     * over any implicitly used WSDL.
+     * @param parent 
+     */
+    protected URI computeActualURI(WebServiceBindingDefinition wsBinding, String baseURI, URI componentURI, URI bindingName) {
+        URI wsdlURI = null;         
+        if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) {
+            // <binding.ws> explicitly points at a wsdl port, may be a relative URI
+            wsdlURI = wsBinding.getPortURI();
+        }
+        if (wsdlURI != null && wsdlURI.isAbsolute()) {
+            if (wsBinding.getURI() != null && (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null)) {
+                throw new IllegalArgumentException("binding URI cannot be used with absolute WSDL endpoint URI");
+            }
+            return URI.create(wsdlURI.toString());
+        }
+        
+        // there is no wsdl port endpoint URI or that URI is relative
+        
+        URI bindingURI = null;
+        if (wsBinding.getURI() != null) {
+            bindingURI = URI.create(wsBinding.getURI());
+        }
+
+        if (bindingURI != null && bindingURI.isAbsolute()) {
+            if (wsdlURI != null) {
+                return URI.create(bindingURI + "/" + wsdlURI).normalize();
+            } else {
+                return bindingURI;
+            }
+        }
+        
+        if (componentURI == null) { // null for references
+            wsdlURI = wsBinding.getPortURI();
+            if (bindingURI != null) {
+                return URI.create(wsdlURI + "/" + bindingURI).normalize();
+            } else {
+                return wsdlURI;
+            }
+        }
+        
+
+        // TODO: TUSCANY-xxx, how to tell if component has multiple services using <binding.ws>?
+        //        boolean singleService = (parent != null) && (((Component)parent.getChild(componentURI.toString())).getInboundWires().size() == 1);
+        //        if (bindingURI == null && !singleService) {
+
+        if (bindingURI == null) {
+            bindingURI = bindingName;
+        }
+
+        if (componentURI.isAbsolute()) {
+            if (bindingURI == null && wsdlURI == null) {
+                return componentURI;
+            } else if (wsdlURI == null) {
+                return URI.create(componentURI + "/" + bindingURI).normalize();
+            } else if (bindingURI == null) {
+                return URI.create(componentURI + "/" + wsdlURI).normalize();
+            } else {
+                return URI.create(componentURI + "/" + bindingURI + "/" + wsdlURI).normalize();
+            }
+        }
+                
+        String actualURI = "";
+
+        if (bindingURI == null) {
+            actualURI = baseURI + "/" + componentURI + "/";
+        } else {
+            actualURI = baseURI + "/" + componentURI + "/" + bindingURI + "/";
+        }
+
+        if (wsdlURI != null) {
+            actualURI = actualURI + wsdlURI.toString();
+        }
+
+        if (actualURI.endsWith("/")) {
+            actualURI = actualURI.substring(0, actualURI.length() -1);
+        }
+        
+        // normalize to handle any . or .. occurances 
+        return URI.create(actualURI).normalize();
     }
 
 }

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java Wed Mar 14 03:15:19 2007
@@ -18,32 +18,33 @@
  */
 package org.apache.tuscany.binding.axis2;
 
+import java.net.URI;
 import java.util.LinkedList;
 import java.util.Map;
 
 import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.wire.AbstractOutboundInvocationHandler;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.AbstractInvocationHandler;
+import org.apache.tuscany.spi.wire.InvocationChain;
 import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
 
-public class Axis2CallbackInvocationHandler extends AbstractOutboundInvocationHandler {
+public class Axis2CallbackInvocationHandler extends AbstractInvocationHandler {
 
-    private InboundWire inboundWire;
+    private Wire inboundWire;
 
-    public Axis2CallbackInvocationHandler(InboundWire inboundWire) {
+    public Axis2CallbackInvocationHandler(Wire inboundWire) {
         this.inboundWire = inboundWire;
     }
 
-    public Object invoke(Operation operation, Object[] args, LinkedList<Object> callbackRoutingChain) throws Throwable {
+    public Object invoke(Operation operation, Object[] args, LinkedList<URI> callbackRoutingChain) throws Throwable {
         Object targetAddress = callbackRoutingChain.removeFirst();
         if (targetAddress == null) {
             throw new AssertionError("Popped a null from address from stack");
         }
         //TODO optimize as this is slow in local invocations
-        Map<Operation<?>, OutboundInvocationChain> sourceCallbackInvocationChains =
-            inboundWire.getSourceCallbackInvocationChains(targetAddress);
-        OutboundInvocationChain chain = sourceCallbackInvocationChains.get(operation);
+        Map<Operation<?>, InvocationChain> sourceCallbackInvocationChains =
+            inboundWire.getCallbackInvocationChains();
+        InvocationChain chain = sourceCallbackInvocationChains.get(operation);
         TargetInvoker invoker = chain.getTargetInvoker();
         return invoke(chain, invoker, args, null, callbackRoutingChain);
     }

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2OneWayTargetInvoker.java Wed Mar 14 03:15:19 2007
@@ -19,11 +19,8 @@
 package org.apache.tuscany.binding.axis2;
 
 import java.lang.reflect.InvocationTargetException;
-import javax.xml.namespace.QName;
 
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
-import org.apache.tuscany.spi.wire.Message;
+import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPFactory;
@@ -31,6 +28,9 @@
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
 
 public class Axis2OneWayTargetInvoker extends Axis2TargetInvoker {
 

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java Wed Mar 14 03:15:19 2007
@@ -18,19 +18,14 @@
  */
 package org.apache.tuscany.binding.axis2;
 
+import static org.osoa.sca.Constants.SCA_NS;
+
+import java.net.URI;
 import java.util.Collection;
+
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
 
-import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
-
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
@@ -43,25 +38,31 @@
 import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
 import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData;
 import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.wire.TargetInvoker;
 
 /**
  * Axis2Reference uses Axis2 to invoke a remote web service
  */
 public class Axis2ReferenceBinding<T> extends ReferenceBindingExtension {
-    private static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws");
+    private static final QName BINDING_WS = new QName(SCA_NS, "binding.ws");
 
     private WebServicePortMetaData wsPortMetaData;
     private ServiceClient serviceClient;
     private WorkContext workContext;
 
     @SuppressWarnings("unchecked")
-    public Axis2ReferenceBinding(String theName,
-                                 CompositeComponent parent,
+    public Axis2ReferenceBinding(URI uri,
                                  WebServiceBindingDefinition wsBinding,
                                  ServiceContract contract,
                                  ServiceContract<?> bindingServiceContract,
                                  WorkContext workContext) {
-        super(theName, parent);
+        super(uri, uri); // TODO: what should these be
         this.bindingServiceContract = bindingServiceContract;
         this.workContext = workContext;
         try {
@@ -99,9 +100,9 @@
                 // other end
                 Operation callbackOperation = findCallbackOperation();
                 Axis2CallbackInvocationHandler invocationHandler =
-                    new Axis2CallbackInvocationHandler(inboundWire);
+                    new Axis2CallbackInvocationHandler(wire);
                 Axis2ReferenceCallbackTargetInvoker callbackInvoker =
-                    new Axis2ReferenceCallbackTargetInvoker(callbackOperation, inboundWire, invocationHandler);
+                    new Axis2ReferenceCallbackTargetInvoker(callbackOperation, wire, invocationHandler);
                 asyncInvoker.setCallbackTargetInvoker(callbackInvoker);
 
                 invoker = asyncInvoker;
@@ -116,7 +117,7 @@
     }
 
     private Operation findCallbackOperation() {
-        ServiceContract contract = inboundWire.getServiceContract();
+        ServiceContract contract = wire.getTargetContract(); // TODO: which end?
         Operation callbackOperation = null;
         Collection callbackOperations = contract.getCallbackOperations().values();
         if (callbackOperations.size() != 1) {
@@ -184,6 +185,16 @@
         }
 
         return invoker;
+    }
+
+    public TargetInvoker createTargetInvoker(String targetName, Operation operation) throws TargetInvokerCreationException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation) throws TargetInvokerCreationException {
+        // TODO Auto-generated method stub
+        return null;
     }
 
 }

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java Wed Mar 14 03:15:19 2007
@@ -19,27 +19,28 @@
 package org.apache.tuscany.binding.axis2;
 
 import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
 import java.util.LinkedList;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.InvocationRuntimeException;
 import org.apache.tuscany.spi.wire.Message;
 import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
 
 public class Axis2ReferenceCallbackTargetInvoker implements TargetInvoker {
 
     private Operation operation;
-    private InboundWire inboundWire;
-    private LinkedList<Object> callbackRoutingChain;
+    private Wire inboundWire;
+    private LinkedList<URI> callbackRoutingChain;
     private boolean cacheable;
     Axis2CallbackInvocationHandler invocationHandler;
     private CountDownLatch signal;
     private Object returnPayload;
 
     public Axis2ReferenceCallbackTargetInvoker(Operation operation,
-                                               InboundWire inboundWire,
+                                               Wire inboundWire,
                                                Axis2CallbackInvocationHandler invocationHandler) {
 
         this.operation = operation;
@@ -100,7 +101,7 @@
         return invoker;
     }
 
-    public void setCallbackRoutingChain(LinkedList<Object> callbackRoutingChain) {
+    public void setCallbackRoutingChain(LinkedList<URI> callbackRoutingChain) {
         this.callbackRoutingChain = callbackRoutingChain;
     }
     

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceBinding.java Wed Mar 14 03:15:19 2007
@@ -18,8 +18,11 @@
  */
 package org.apache.tuscany.binding.axis2;
 
+import static org.osoa.sca.Constants.SCA_NS;
+
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.net.URI;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -27,29 +30,12 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
+
 import javax.wsdl.Definition;
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
 import javax.xml.namespace.QName;
 
-import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
-import org.osoa.sca.annotations.Destroy;
-
-import org.apache.tuscany.spi.builder.BuilderConfigException;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.TargetInvokerCreationException;
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.extension.ServiceBindingExtension;
-import org.apache.tuscany.spi.host.ServletHost;
-import org.apache.tuscany.spi.model.InteractionScope;
-import org.apache.tuscany.spi.model.Scope;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.Interceptor;
-import org.apache.tuscany.spi.wire.InvocationChain;
-import org.apache.tuscany.spi.wire.Message;
-import org.apache.tuscany.spi.wire.MessageImpl;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
@@ -64,6 +50,20 @@
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants;
 import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ServiceBindingExtension;
+import org.apache.tuscany.spi.host.ServletHost;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.osoa.sca.annotations.Destroy;
 
 // org.apache.tuscany.spi.model
 /**
@@ -72,7 +72,7 @@
  * @version $Rev$ $Date$
  */
 public class Axis2ServiceBinding extends ServiceBindingExtension {
-    private static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws");
+    private static final QName BINDING_WS = new QName(SCA_NS, "binding.ws");
 
     private ServiceContract<?> serviceContract;
 
@@ -88,27 +88,24 @@
 
     private WorkContext workContext;
 
-    private Boolean conversational = null;
-
     private Set<String> seenConversations = Collections.synchronizedSet(new HashSet<String>());
 
-    public Axis2ServiceBinding(String theName,
+    public Axis2ServiceBinding(URI uri,
                                ServiceContract<?> serviceContract,
                                ServiceContract<?> serviceBindingContract,
-                               CompositeComponent parent,
                                WebServiceBindingDefinition binding,
                                ServletHost servletHost,
                                ConfigurationContext configContext,
                                WorkContext workContext) {
 
-        super(theName, parent);
+        super(uri);
 
         this.serviceContract = serviceContract;
         this.bindingServiceContract = serviceBindingContract;
         this.binding = binding;
         this.servletHost = servletHost;
         this.configContext = configContext;
-        this.serviceName = theName;
+        this.serviceName = uri.toString(); // TODO: whats this for, better name
         this.workContext = workContext;
     }
 
@@ -123,15 +120,15 @@
 
         Axis2ServiceServlet servlet = new Axis2ServiceServlet();
         servlet.init(configContext);
-        configContext.setContextRoot(getName());
-        servletHost.registerMapping("/services/" + getName(), servlet);
+        configContext.setContextRoot(getUri().toString());
+        servletHost.registerMapping("/services/" + getUri().toString(), servlet);
     }
 
     @Destroy
     public void stop() {
-        servletHost.unregisterMapping("/services/" + getName());
+        servletHost.unregisterMapping("/services/" + getUri().toString());
         try {
-            configContext.getAxisConfiguration().removeService(getName());
+            configContext.getAxisConfiguration().removeService(getUri().toString());
         } catch (AxisFault e) {
             throw new Axis2BindingRunTimeException(e);
         }
@@ -150,9 +147,8 @@
         builder.setServerSide(true);
         AxisService axisService = builder.populateService();
 
-        axisService.setName(this.getName());
-        axisService.setServiceDescription("Tuscany configured AxisService for service: '" + this.getName()
-            + "'");
+        axisService.setName(getUri().toString());
+        axisService.setServiceDescription("Tuscany configured AxisService for service: " + getUri().toString());
 
         // Use the existing WSDL
         Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null);
@@ -194,7 +190,7 @@
     public Object invokeTarget(org.apache.tuscany.spi.model.Operation<?> op, Object[] args, Object messageId,
                                String conversationID)
         throws InvocationTargetException {
-        InvocationChain chain = inboundWire.getInvocationChains().get(op);
+        InvocationChain chain = wire.getInvocationChains().get(op);
         Interceptor headInterceptor = chain.getHeadInterceptor();
         String oldConversationID = (String) workContext.getIdentifier(Scope.CONVERSATION);
         if (isConversational() && conversationID != null) {
@@ -214,7 +210,7 @@
 
                 Message msg = new MessageImpl();
                 msg.setTargetInvoker(chain.getTargetInvoker());
-                msg.pushFromAddress(getFromAddress());
+//                msg.pushFromAddress(getFromAddress()); // TODO : method gone in the TRUNK???
                 if (messageId != null) {
                     msg.setMessageId(messageId);
                 }
@@ -367,10 +363,16 @@
     }
 
     boolean isConversational() {
-        if (conversational == null) {
-            conversational = serviceContract.getInteractionScope() == InteractionScope.CONVERSATIONAL;
+        return serviceContract.isConversational();
+    }
 
-        }
-        return conversational;
+    public TargetInvoker createTargetInvoker(String targetName, org.apache.tuscany.spi.model.Operation operation) throws TargetInvokerCreationException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public TargetInvoker createTargetInvoker(String targetName, PhysicalOperationDefinition operation) throws TargetInvokerCreationException {
+        // TODO Auto-generated method stub
+        return null;
     }
 }

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java Wed Mar 14 03:15:19 2007
@@ -20,10 +20,6 @@
 
 import java.lang.reflect.InvocationTargetException;
 
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
-import org.apache.tuscany.spi.wire.Message;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
@@ -32,6 +28,9 @@
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.util.Utils;
 import org.apache.tuscany.binding.axis2.Axis2ServiceBinding.InvocationContext;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
 
 public class Axis2ServiceCallbackTargetInvoker implements TargetInvoker {
 

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java Wed Mar 14 03:15:19 2007
@@ -19,13 +19,8 @@
 package org.apache.tuscany.binding.axis2;
 
 import java.lang.reflect.InvocationTargetException;
-import javax.xml.namespace.QName;
 
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.model.Scope;
-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.soap.SOAPBody;
@@ -40,6 +35,11 @@
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Scope;
+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

Added: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java?view=auto&rev=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java (added)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java Wed Mar 14 03:15:19 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.binding.axis2;
+
+import java.net.URI;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.RequestURIBasedDispatcher;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ */
+public class TuscanyDispatcher extends RequestURIBasedDispatcher {
+
+    public static final String NAME = "TuscanyDispatcher";
+    private static final Log log = LogFactory.getLog(RequestURIBasedDispatcher.class);
+    private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
+     */
+    public AxisService findService(MessageContext messageContext) throws AxisFault {
+        EndpointReference toEPR = messageContext.getTo();
+
+        if (toEPR != null) {
+            if(isDebugEnabled){
+                log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
+            }
+
+            String path = URI.create(toEPR.getAddress()).getPath();
+            
+            // remove the leading slash
+            if (path != null && path.length() > 1 && path.startsWith("/")) {
+                path = path.substring(1);
+            }
+            
+            ConfigurationContext configurationContext = messageContext.getConfigurationContext();
+            AxisConfiguration registry = configurationContext.getAxisConfiguration();
+
+            return registry.getService(path);
+
+        } else {
+            if(isDebugEnabled){
+                log.debug("Attempted to check for Service using null target endpoint URI");
+            }
+            return null;
+        }
+    }
+
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+}

Propchange: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/TuscanyDispatcher.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java Wed Mar 14 03:15:19 2007
@@ -19,13 +19,20 @@
 package org.apache.tuscany.binding.axis2;
 
 
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
 import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.xml.namespace.QName;
 
 import org.apache.tuscany.spi.model.BindingDefinition;
-import org.osoa.sca.Version;
+import org.osoa.sca.Constants;
 
 /**
  * Represents a Celtix binding configuration in an assembly
@@ -33,25 +40,78 @@
  * @version $Rev$ $Date$
  */
 public class WebServiceBindingDefinition extends BindingDefinition {
-    public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Version.XML_NAMESPACE_1_0,"conversationID");
+    public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA_NS,"conversationID");
     private Definition definition;
     private Port port;
     private Service service;
-    //private String portURI;
     private String uri;
+    private String namespace;
+    private String serviceName;
+    private String portName;
+    private String bindingName;
+    private Binding binding;
+    private boolean spec10Compliant; // hack just to allow any existing WS scdl to still work for now
+    private URI actualURI;
+
+    /**
+     * @deprecated pre 1.0 binding.ws spec
+     */
+    @Deprecated
     public WebServiceBindingDefinition(Definition definition, Port port, String uri, String portURI, Service service) {
         this.definition = definition;
         this.port = port;
         this.uri = uri;
-        //this.portURI = portURI;
         this.service = service;
     }
 
+    public WebServiceBindingDefinition(String ns, Definition definition, String serviceName, String portName, String bindingName, String uri) {
+        this.namespace = ns;
+        this.definition = definition;
+        this.serviceName = serviceName;
+        this.portName = portName;
+        this.bindingName = bindingName;
+        this.uri = uri;
+        this.spec10Compliant = true;
+    }
+
     public Port getWSDLPort() {
+        if (port == null) {
+            Service service = getWSDLService();
+            if (portName == null) {
+                Map ports = service.getPorts();
+                if (ports.size() != 1) {
+                    throw new IllegalStateException("when portName is null WSDL service must have exactly one WSDL port");
+                }
+                port = (Port)ports.values().iterator().next();
+            } else {
+                port = service.getPort(portName);
+            }
+        }
         return port;
     }
 
     public Service getWSDLService() {
+        if (service == null) {
+            if (definition == null) {
+                throw new IllegalStateException("WSDL definition is null");
+            }
+            Map services = definition.getServices();
+            if (serviceName != null) {
+                QName serviceQN = new QName(namespace, serviceName);
+                for (Object o : services.values()) {
+                    Service s = (Service) o;
+                    if (s.getQName().equals(serviceQN)) {
+                        service = s;
+                        break;
+                    }
+                }
+                if (service == null) {
+                    throw new IllegalStateException("no service: " + serviceQN);
+                }
+            } else {
+                service = (Service)services.values().iterator().next();
+            }
+        }
         return service;
     }
 
@@ -67,15 +127,72 @@
         definition = def;
     }
 
-    //    public void setPortURI(String uri) {
-    //        portURI = uri;
-    //    }
-
     public String getURI() {
         return uri;
     }
 
+    public URI getPortURI() {
+        URI portURI = null;
+        if (definition != null) {
+            Port port = getWSDLPort();
+            final List wsdlPortExtensions = port.getExtensibilityElements();
+            for (final Object extension : wsdlPortExtensions) {
+                if (extension instanceof SOAPAddress) {
+                    try {
+                        portURI = new URI(((SOAPAddress) extension).getLocationURI());
+                    } catch (URISyntaxException e) {
+                        throw new RuntimeException(e);
+                    }
+                    break;
+                }
+            }
+        }
+        return portURI;
+    }
+
     public void setURI(String theUri) {
         this.uri = theUri;
+    }
+    
+    public Binding getBinding() {
+        if (binding == null) {
+            if (definition == null) {
+                throw new IllegalStateException("WSDL definition is null");
+            }
+            QName bindingQN = new QName(namespace, bindingName);
+            this.binding = definition.getBinding(bindingQN);
+            if (binding == null) {
+                throw new IllegalStateException("no binding: " + bindingQN);
+            }
+        }
+        return binding;
+    }
+
+    public String getWSDLNamepace() {
+        return namespace;
+    }
+
+    public String getPortName() {
+        return portName;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public String getBindingName() {
+        return bindingName;
+    }
+
+    public boolean isSpec10Compliant() {
+        return spec10Compliant;
+    }
+
+    public URI getActualURI() {
+        return actualURI;
+    }
+
+    public void setActualURI(URI actualURI) {
+        this.actualURI = actualURI;
     }
 }

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java Wed Mar 14 03:15:19 2007
@@ -18,7 +18,7 @@
  */
 package org.apache.tuscany.binding.axis2;
 
-import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+import static org.osoa.sca.Constants.SCA_NS;
 
 import java.io.IOException;
 import java.util.Collection;
@@ -32,33 +32,33 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.extension.LoaderExtension;
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.loader.LoaderRegistry;
 import org.apache.tuscany.spi.loader.LoaderUtil;
 import org.apache.tuscany.spi.model.ModelObject;
-
 import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
 import org.osoa.sca.annotations.Scope;
 
 /**
  * Parses a <code>WebServiceBindingDefinition</code> entry in an assembly XML file
  * 
+ * TODO: TUSCANY-1153 support <wsa:EndpointReference>
+ * 
  * @version $Rev$ $Date$
  */
 @Scope("COMPOSITE")
 @SuppressWarnings("deprecation")
 public class WebServiceBindingLoader extends LoaderExtension<WebServiceBindingDefinition> {
-    public static final QName BINDING_WS = new QName(XML_NAMESPACE_1_0, "binding.ws");
+    public static final QName BINDING_WS = new QName(SCA_NS, "binding.ws");
 
     private WSDLDefinitionRegistry wsdlDefinitionRegistry;
 
     @Constructor( { "loaderRegistry", "wsdlDefinitionRegistry" })
-    public WebServiceBindingLoader(@Autowire LoaderRegistry loaderRegistry, 
-            @Autowire WSDLDefinitionRegistry wsdlDefinitionRegistry) {
+    public WebServiceBindingLoader(@Reference LoaderRegistry loaderRegistry, 
+                                   @Reference WSDLDefinitionRegistry wsdlDefinitionRegistry) {
         super(loaderRegistry);
         this.wsdlDefinitionRegistry = wsdlDefinitionRegistry;
     }
@@ -67,27 +67,123 @@
         return BINDING_WS;
     }
 
-    public WebServiceBindingDefinition load(CompositeComponent parent, ModelObject object, XMLStreamReader reader,
+    public WebServiceBindingDefinition load(ModelObject object, XMLStreamReader reader,
                                   DeploymentContext deploymentContext)
         throws XMLStreamException, LoaderException {
-        // not sure what uri was here ? String uri = reader.getAttributeValue(null, "uri");
-        String uri = null;
+
+        String uri = reader.getAttributeValue(null, "uri");
+        String wsdlElement = reader.getAttributeValue(null, "wsdlElement");
+        String wsdliLocation = reader.getAttributeValue(null, "wsdlLocation");
+
+        // TODO: keep these old attributes for now for backward compatability
         String endpoint = reader.getAttributeValue(null, "endpoint");
         String wsdlLocation = reader.getAttributeValue(null, "location");
+
+        // TODO: support wsa:endpointreference
+        
         LoaderUtil.skipToEndElement(reader);
-        try {
-            return createBinding(uri, endpoint, wsdlLocation, deploymentContext);
-        } catch (Exception e) {
-            throw new LoaderException(e);
+
+        WebServiceBindingDefinition wsBinding;
+        if (endpoint != null && endpoint.length() > 0) {
+            // TODO: support these old attributes for now for backward compatability
+            try {
+                wsBinding = createBindingOld(uri, endpoint, wsdlLocation, deploymentContext);
+            } catch (Exception e) {
+                throw new LoaderException(e);
+            }
+        } else {
+            wsBinding = createWSBinding(wsdlElement, wsdliLocation, uri, deploymentContext);
+        }
+        
+        return wsBinding;
+    }
+
+    protected WebServiceBindingDefinition createWSBinding(String wsdlElement, String wsdliLocation, String uri, DeploymentContext deploymentContext) throws LoaderException {
+        String ns = null;
+        String serviceName = null;
+        String portName = null;
+        String bindingName = null;
+
+        if (wsdlElement != null && wsdlElement.length() > 0) {
+
+            ns = getWSDLNamespace(wsdlElement);
+
+            String uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.service");
+            if (uriValue != null) {
+                serviceName = uriValue;
+            } else {
+                uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.port");
+                if (uriValue != null) {
+                    int i = uriValue.lastIndexOf('/');
+                    if (i == -1) {
+                        throw new IllegalArgumentException("Missing '/' seperator between service and port in wsdl.port() in wsdlElement attribute");
+                    } 
+                    serviceName = uriValue.substring(0, i);
+                    portName = uriValue.substring(i+1);
+                } else {
+                    uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.endpoint");
+                    if (uriValue != null) {
+                        throw new IllegalArgumentException("WSDL 2.0 not supported for '#wsdl.endpoint' in wsdlElement attribute");
+                    } 
+                    uriValue = getWSDLElementURIValue(wsdlElement, "wsdl.binding");
+                    if (uriValue == null) {
+                        throw new IllegalArgumentException("missing '#wsdl.service' or '#wsdl.port' or '#wsdl.endpoint'or '#wsdl.binding' in wsdlElement attribute");
+                    }
+                    bindingName = uriValue;
+                }
+            }
+        }
+
+        Definition definition = null;
+        if (wsdliLocation != null && wsdliLocation.length() > 0) {
+            try {
+                definition = wsdlDefinitionRegistry.loadDefinition(wsdliLocation, deploymentContext.getClassLoader());
+            } catch (Exception e) {
+                throw new LoaderException("Exception loading WSDL", e);
+            }
+        } else if (ns != null ){
+            definition = wsdlDefinitionRegistry.getDefinition(ns);
+        }
+        
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(ns, definition, serviceName, portName, bindingName, uri);
+
+        return wsBinding;
+    }
+    
+    protected String getWSDLElementURIValue(String wsdlElement, String type) { 
+        String value = null;
+        String fullType = "#" + type + "(";
+        int i = wsdlElement.indexOf(fullType);
+        if (i > -1) {
+            int j = wsdlElement.indexOf(')',i);
+            if (j < 0) {
+                throw new IllegalArgumentException("missing closing bracket ')' on " + fullType + " in wsdlElement attribute");
+            }
+            value = wsdlElement.substring(i + fullType.length(), j);
         }
+        return value;
+    }
 
+    protected String getWSDLNamespace(String wsdlElement) {
+        String ns = null;
+        if (wsdlElement != null && wsdlElement.length() > 0) {
+            int i = wsdlElement.indexOf('#');
+            if (i < 0) {
+                throw new IllegalArgumentException("missing '#' namespace delimiter in wsdlElement attribute");
+            }
+            if (i == 0) {
+                throw new IllegalArgumentException("no namespace in wsdlElement attribute");
+            }
+            ns = wsdlElement.substring(0, i);
+        }
+        return ns;
     }
 
     @SuppressWarnings("unchecked")
-    private WebServiceBindingDefinition createBinding(String uri, String endpoint, String wsdlLocation, DeploymentContext deploymentContext)
+    private WebServiceBindingDefinition createBindingOld(String uri, String endpoint, String wsdlLocation, DeploymentContext deploymentContext)
         throws WSDLException, IOException, LoaderException {
         // Get the WSDL port namespace and name
-        if (uri == null && endpoint != null) {
+        if (endpoint != null) {
             int h = endpoint.indexOf('#');
             String serviceName;
             String portName;

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java Wed Mar 14 03:15:19 2007
@@ -18,9 +18,13 @@
  */
 package org.apache.tuscany.binding.axis2;
 
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+
 import java.lang.reflect.Type;
+import java.net.URI;
 import java.net.URL;
 import java.util.HashMap;
+
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
 import javax.wsdl.Service;
@@ -28,20 +32,16 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
-import org.xml.sax.InputSource;
+import junit.framework.TestCase;
 
-import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
 import org.apache.tuscany.spi.idl.java.JavaServiceContract;
 import org.apache.tuscany.spi.model.Operation;
-import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
 import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireService;
-
-import junit.framework.TestCase;
-import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
+import org.apache.tuscany.spi.wire.Wire;
 import org.easymock.EasyMock;
+import org.xml.sax.InputSource;
 
 public class Axis2ReferenceTestCase extends TestCase {
 
@@ -57,7 +57,7 @@
     public void testAsyncTargetInvoker() throws Exception {
         Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
         //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class
-        InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
+        Wire inboundWire = EasyMock.createNiceMock(Wire.class);
         JavaServiceContract contract = new JavaServiceContract(Greeter.class);
         contract.setCallbackName("");
         contract.setCallbackClass(GreetingCallback.class);
@@ -66,10 +66,10 @@
         HashMap<String, Operation<Type>> callbackOps = new HashMap<String, Operation<Type>>();
         callbackOps.put("sayHiCallback", callbackOp);
         contract.setCallbackOperations(callbackOps);
-        EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes();
+        EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes();
         EasyMock.replay(inboundWire);
 
-        axis2Reference.setInboundWire(inboundWire);
+        axis2Reference.setWire(inboundWire);
         Operation operation = new Operation<Type>("sayHi", null, null, null, true, null, NO_CONVERSATION);
         TargetInvoker asyncTargetInvoker = axis2Reference.createTargetInvoker(contract, operation);
         assertNotNull(asyncTargetInvoker);
@@ -94,14 +94,10 @@
         WebServiceBindingDefinition wsBinding =
             new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService);
         //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance.
-        WireService wireService = EasyMock.createNiceMock(WireService.class);
-        EasyMock.replay(wireService);
-        CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
         // TODO figure out what to do with the service contract
         ServiceContract<?> contract = new WSDLServiceContract();
         contract.setInterfaceClass(Greeter.class);
-        return new Axis2ReferenceBinding(serviceName,
-            parent,
+        return new Axis2ReferenceBinding(URI.create(serviceName),
             wsBinding,
             contract,
             null,

Modified: incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java (original)
+++ incubator/tuscany/java/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java Wed Mar 14 03:15:19 2007
@@ -20,9 +20,11 @@
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
+import java.net.URI;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
+
 import javax.servlet.Servlet;
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
@@ -31,21 +33,17 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
-import org.xml.sax.InputSource;
+import junit.framework.TestCase;
 
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
 import org.apache.tuscany.spi.host.ServletHost;
 import org.apache.tuscany.spi.idl.java.JavaServiceContract;
 import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundInvocationChain;
-import org.apache.tuscany.spi.wire.OutboundWire;
-import org.apache.tuscany.spi.wire.WireService;
-
-import junit.framework.TestCase;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
-import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
 import org.easymock.EasyMock;
+import org.xml.sax.InputSource;
 
 public class Axis2ServiceTestCase extends TestCase {
 
@@ -89,42 +87,41 @@
         WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService);
 
         //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance.
-        WireService wireService = EasyMock.createNiceMock(WireService.class);
-        wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(InboundWire.class));
-        EasyMock.expectLastCall().andReturn(null);
-        EasyMock.replay(wireService);
+//        WireService wireService = EasyMock.createNiceMock(WireService.class);
+//        wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(Wire.class));
+//        EasyMock.expectLastCall().andReturn(null);
+//        EasyMock.replay(wireService);
 
         //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class
-        InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
+        Wire inboundWire = EasyMock.createNiceMock(Wire.class);
         JavaServiceContract contract = new JavaServiceContract(Greeter.class);
         Map<String, Operation<Type>> opMap = new HashMap<String, Operation<Type>>();
         for (Method m : Greeter.class.getMethods()) {
             opMap.put(m.getName(), new Operation<Type>(m.getName(), null, null, null));
         }
         contract.setOperations(opMap);
-        EasyMock.expect(inboundWire.getServiceContract()).andReturn(contract).anyTimes();
+        EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes();
         if (callback) {
             contract.setCallbackName("");
         }
         EasyMock.replay(inboundWire);
 
-        OutboundWire outboundWire = EasyMock.createNiceMock(OutboundWire.class);
-        Map<Operation<?>, OutboundInvocationChain> map = new HashMap<Operation<?>, OutboundInvocationChain>();
+        Wire outboundWire = EasyMock.createNiceMock(Wire.class);
+        Map<Operation<?>, InvocationChain> map = new HashMap<Operation<?>, InvocationChain>();
         EasyMock.expect(outboundWire.getInvocationChains()).andReturn(map).once();
         EasyMock.replay(outboundWire);
 
         TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
         ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();
         Axis2ServiceBinding axis2Service =
-            new Axis2ServiceBinding(serviceName,
+            new Axis2ServiceBinding(URI.create(serviceName),
                 contract,
                 null,
-                null,
                 wsBinding,
                 tomcatHost,
-                configurationContext, new WorkContextImpl());
-        axis2Service.setInboundWire(inboundWire);
-        axis2Service.setOutboundWire(outboundWire);
+                configurationContext, null);
+        axis2Service.setWire(inboundWire);
+//        axis2Service.setOutboundWire(outboundWire);
 
         return axis2Service;
     }

Modified: incubator/tuscany/java/sca/extensions/axis2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/extensions/axis2/pom.xml?view=diff&rev=518088&r1=518087&r2=518088
==============================================================================
--- incubator/tuscany/java/sca/extensions/axis2/pom.xml (original)
+++ incubator/tuscany/java/sca/extensions/axis2/pom.xml Wed Mar 14 03:15:19 2007
@@ -20,14 +20,15 @@
 <project>
 
     <parent>
-        <groupId>org.apache.tuscany.sca.extensions</groupId>
-        <artifactId>parent</artifactId>
-        <version>1.0-incubator-SNAPSHOT</version>
+        <groupId>org.apache.tuscany</groupId>
+        <artifactId>sca</artifactId>
+        <version>1.0-incubating</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+    <groupId>org.apache.tuscany.sca.axis2</groupId>
     <artifactId>parent</artifactId>
+    <version>2.0-alpha2-incubating-SNAPSHOT</version>
     <packaging>pom</packaging>
     <name>Tuscany SCA Extensions for Axis2</name>
 
@@ -38,6 +39,28 @@
             <url>http://ws.zones.apache.org/repository/</url>
             <layout>legacy</layout>
         </repository>
+        <repository>
+            <id>apache.snapshots</id>
+            <name>Apache Snapshot Repository</name>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+        <repository>
+            <id>apache.incubator</id>
+            <name>Apache Incubator Repository</name>
+            <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
     </repositories>
 
     <modules>
@@ -50,6 +73,12 @@
 
     <dependencyManagement>
         <dependencies>
+
+            <dependency>
+               <groupId>org.apache.tuscany.sca.kernel</groupId>
+               <artifactId>tuscany-spi</artifactId>
+               <version>2.0-alpha2-incubating-SNAPSHOT</version>
+            </dependency>
 
             <dependency>
                 <groupId>org.apache.axis2</groupId>



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