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/10/02 23:49:11 UTC

svn commit: r452233 [1/2] - in /incubator/tuscany/java: samples/sca/helloworldwsclient/src/main/java/helloworld/ samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/ samples/sca/helloworldwsclient/src/main/resources/wsdl/ samples/sca/hellowo...

Author: rfeng
Date: Mon Oct  2 14:49:09 2006
New Revision: 452233

URL: http://svn.apache.org/viewvc?view=rev&rev=452233
Log:
Bring up the async with callback for Axis2

Some changes are made in the core:
1) Move WirePostProcessor a bit later so that callback chains are created by ConnectorImpl
2) Add contract class to java interface prossor
3) Fix the callback wiring (operation)

Added:
    incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldCallback.java   (with props)
    incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldLocal.java   (with props)
    incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/helloworldws.scdl
    incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java   (with props)
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java   (with props)
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java   (with props)
    incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java   (with props)
Modified:
    incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
    incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java
    incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java
    incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java
    incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
    incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
    incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java
    incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java
    incubator/tuscany/java/sca/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java

Added: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldCallback.java?view=auto&rev=452233
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldCallback.java (added)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldCallback.java Mon Oct  2 14:49:09 2006
@@ -0,0 +1,27 @@
+/*
+ * 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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldCallback {
+
+    public void getGreetingsCallback(String getGreetingsReturn);
+}

Propchange: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldCallback.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldCallback.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldLocal.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldLocal.java?view=auto&rev=452233
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldLocal.java (added)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldLocal.java Mon Oct  2 14:49:09 2006
@@ -0,0 +1,33 @@
+/*
+ * 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 helloworld;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Service;
+
+import commonj.sdo.DataObject;
+
+@Service
+public interface HelloWorldLocal {
+
+    public String getGreetings(String name);
+    @DataType(name="commonj.sdo.DataObject")
+    public String getGreetings1(DataObject name);
+
+}

Propchange: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldLocal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldLocal.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java Mon Oct  2 14:49:09 2006
@@ -19,6 +19,7 @@
 package helloworld;
 
 import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Callback;
 import org.osoa.sca.annotations.Remotable;
 import org.osoa.sca.annotations.Service;
 
@@ -26,10 +27,12 @@
 
 @Remotable
 @Service
+@Callback(HelloWorldCallback.class)
 public interface HelloWorldService {
 
     public String getGreetings(String name);
     @DataType(name="commonj.sdo.DataObject")
     public String getGreetings1(DataObject name);
 
+    public void getGreetingsWithCallback(String name);
 }

Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java Mon Oct  2 14:49:09 2006
@@ -30,7 +30,7 @@
 
 
 @Scope("MODULE")
-public class HelloWorldServiceComponent implements HelloWorldService {
+public class HelloWorldServiceComponent implements HelloWorldLocal {
    
     HelloWorldService helloWorldService;
 
@@ -50,4 +50,10 @@
     public String getGreetings1(DataObject name) {
         return helloWorldService.getGreetings1(name);
     }
-}
\ No newline at end of file
+    
+    public void getGreetingsCallback(String getGreetingsReturn) {
+        System.out.println("Callback: " + getGreetingsReturn);
+    }
+
+    
+}

Added: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/helloworldws.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/helloworldws.scdl?view=auto&rev=452233
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/helloworldws.scdl (added)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/sca/helloworldws.scdl Mon Oct  2 14:49:09 2006
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+           name="helloworldwsclient">
+    
+    <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" location="wsdl/helloworld.wsdl"/>
+    
+    <component name="HelloWorldServiceComponent">
+      <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+      <reference name="helloWorldService">HelloWorldService</reference>
+    </component>
+
+    <reference name="HelloWorldService">
+        <!--  
+        <interface.java interface="helloworld.HelloWorldService"
+                        callbackInterface="helloworld.HelloWorldCallback"/>
+        -->
+
+        <interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" 
+            interface="http://helloworld#wsdl.interface(HelloWorld)" 
+            callbackInterface="http://helloworld#wsdl.interface(HelloWorldCallback)"
+            wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+
+        <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+			location="wsdl/helloworld.wsdl" />
+    </reference>
+
+</composite>

Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl Mon Oct  2 14:49:09 2006
@@ -39,6 +39,14 @@
                 </complexType>
             </element>
             
+            <element name="getGreetingsCallback">
+                <complexType>
+                    <sequence>
+                        <element name="getGreetingsReturn" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>            
+            
             <element name="getGreetings1">
                 <complexType>
                     <sequence>
@@ -74,6 +82,10 @@
         <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
     </wsdl:message>
 
+    <wsdl:message name="getGreetingsCallback">
+        <wsdl:part element="tns:getGreetingsCallback" name="parameters"/>
+    </wsdl:message>
+
     <wsdl:message name="getGreetings1Request">
         <wsdl:part element="tns:getGreetings1" name="parameters"/>
     </wsdl:message>
@@ -91,6 +103,15 @@
             <wsdl:input message="tns:getGreetings1Request" name="getGreetings1Request"/>
             <wsdl:output message="tns:getGreetings1Response" name="getGreetings1Response"/>
         </wsdl:operation>
+        <wsdl:operation name="getGreetingsWithCallback">
+            <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:portType name="HelloWorldCallback">
+        <wsdl:operation name="getGreetingsCallback">
+            <wsdl:input message="tns:getGreetingsCallback" name="getGreetingsCallback"/>
+        </wsdl:operation>
     </wsdl:portType>
 
     <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
@@ -112,6 +133,12 @@
             <wsdl:output name="getGreetings1Response">
                 <wsdlsoap:body use="literal"/>
             </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="getGreetingsWithCallback">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="getGreetingsRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
         </wsdl:operation>
 
     </wsdl:binding>

Added: incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java?view=auto&rev=452233
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java (added)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java Mon Oct  2 14:49:09 2006
@@ -0,0 +1,46 @@
+package helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldWSAsyncClient extends SCATestCase {
+
+    private HelloWorldLocal helloWorldLocal;
+
+    @Override
+    protected void setUp() throws Exception {
+        try {
+            ClassLoader classLoader = getClass().getClassLoader();
+            addExtension("test.extensions", classLoader.getResource("META-INF/tuscany/test-extensions.scdl"));
+            setApplicationSCDL("META-INF/sca/helloworldws.scdl");
+
+            super.setUp();
+            CompositeContext compositeContext = CurrentCompositeContext.getContext();
+            helloWorldLocal =
+                compositeContext.locateService(HelloWorldLocal.class, "HelloWorldServiceComponent");
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+
+    public void testWSClient() throws Exception {
+        try {
+            String msg = helloWorldLocal.getGreetings("John");
+            Assert.assertNull(msg);
+
+            // Sleep for 5 seconds to wait the callback to happen
+            Thread.sleep(5000);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+
+}

Propchange: incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSAsyncClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java Mon Oct  2 14:49:09 2006
@@ -42,6 +42,7 @@
 import org.apache.tuscany.spi.services.work.WorkScheduler;
 import org.apache.tuscany.spi.wire.InboundInvocationChain;
 import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
 import org.apache.tuscany.spi.wire.Interceptor;
 import org.apache.tuscany.spi.wire.OutboundInvocationChain;
 import org.apache.tuscany.spi.wire.OutboundWire;
@@ -165,14 +166,14 @@
 
     public void connect(InboundWire sourceWire, OutboundWire targetWire, boolean optimizable)
         throws BuilderConfigException {
-        if (postProcessorRegistry != null) {
-            // run wire post-processors
-            postProcessorRegistry.process(sourceWire, targetWire);
-        }
         Map<Operation<?>, OutboundInvocationChain> targetChains = targetWire.getInvocationChains();
         // perform optimization, if possible
         if (optimizable && sourceWire.getInvocationChains().isEmpty() && targetChains.isEmpty()) {
             sourceWire.setTargetWire(targetWire);
+            if (postProcessorRegistry != null) {
+                // run wire post-processors
+                postProcessorRegistry.process(sourceWire, targetWire);
+            }
             return;
         }
         for (InboundInvocationChain inboundChain : sourceWire.getInvocationChains().values()) {
@@ -185,6 +186,10 @@
             }
             connect(inboundChain, outboundChain);
         }
+        if (postProcessorRegistry != null) {
+            // run wire post-processors
+            postProcessorRegistry.process(sourceWire, targetWire);
+        }
     }
 
     /**
@@ -198,16 +203,16 @@
         SCAObject source = sourceWire.getContainer();
         SCAObject target = targetWire.getContainer();
         ServiceContract contract = sourceWire.getServiceContract();
-        if (postProcessorRegistry != null) {
-            // run wire post-processors
-            postProcessorRegistry.process(sourceWire, targetWire);
-        }
         Map<Operation<?>, InboundInvocationChain> targetChains = targetWire.getInvocationChains();
         // perform optimization, if possible
         // REVIEW: (kentaminator@gmail.com) shouldn't this check whether the interceptors in the
         // source & target chains are marked as optimizable?  (and if so, optimize them away?)
         if (optimizable && sourceWire.getInvocationChains().isEmpty() && targetChains.isEmpty()) {
             sourceWire.setTargetWire(targetWire);
+            if (postProcessorRegistry != null) {
+                // run wire post-processors
+                postProcessorRegistry.process(sourceWire, targetWire);
+            }
             return;
         }
         // match outbound to inbound chains
@@ -283,8 +288,10 @@
                 e.setIdentifier(sourceWire.getReferenceName());
                 throw e;
             }
-            OutboundInvocationChain outboundChain = wireService.createOutboundChain(operation);
-            targetWire.addSourceCallbackInvocationChain(source.getName(), operation, outboundChain);
+            
+            Operation targetOp = (Operation) targetWire.getServiceContract().getCallbackOperations().get(operation.getName());
+            OutboundInvocationChain outboundChain = wireService.createOutboundChain(targetOp);
+            targetWire.addSourceCallbackInvocationChain(source.getName(), targetOp, outboundChain);
             if (source instanceof Component) {
                 Component component = (Component) source;
                 TargetInvoker invoker = component.createTargetInvoker(null, operation);
@@ -301,6 +308,10 @@
                 connect(outboundChain, inboundChain, invoker, false);
             }
         }
+        if (postProcessorRegistry != null) {
+            // run wire post-processors
+            postProcessorRegistry.process(sourceWire, targetWire);
+        }
     }
 
     /**
@@ -427,8 +438,13 @@
             if (!sourceInterface.isAssignableFrom(targetInterface)) {
                 throw new BuilderConfigException("Incompatible source and target interfaces");
             }
-        } else if (!wireService.isWireable(sourceWire.getServiceContract(), targetWire.getServiceContract())) {
-            throw new BuilderConfigException("Incompatible source and target interfaces");
+        } else {
+            try {
+                wireService.checkCompatibility(sourceWire.getServiceContract(), targetWire
+                    .getServiceContract(), false);
+            } catch (IncompatibleServiceContractException e) {
+                throw new BuilderConfigException("Incompatible source and target interfaces", e);
+            }
         }
     }
 

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java Mon Oct  2 14:49:09 2006
@@ -26,6 +26,7 @@
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 import javax.xml.datatype.Duration;
@@ -51,7 +52,18 @@
 
     private final static Set<Class> simpleTypeSet = new HashSet<Class>(Arrays.asList(simpleTypes));
 
-    public void visitInterface(Class<?> clazz, JavaServiceContract contract) throws InvalidServiceContractException {
+    public void visitInterface(Class<?> clazz, Class<?> callbackClass, JavaServiceContract contract)
+        throws InvalidServiceContractException {
+        Map<String, Operation<Type>> operations = contract.getOperations();
+        processInterface(clazz, contract, operations);
+        if (callbackClass != null) {
+            Map<String, Operation<Type>> callbackOperations = contract.getCallbackOperations();
+            processInterface(callbackClass, contract, callbackOperations);
+        }
+    }
+
+
+    private void processInterface(Class<?> clazz, JavaServiceContract contract, Map<String, Operation<Type>> operations) {
         DataType interfaceDataType = clazz.getAnnotation(DataType.class);
         if (interfaceDataType != null) {
             contract.setDataBinding(interfaceDataType.name());
@@ -61,7 +73,7 @@
             }
         }
         for (Method method : clazz.getMethods()) {
-            Operation<?> operation = contract.getOperations().get(method.getName());
+            Operation<?> operation = operations.get(method.getName());
             DataType operationDataType = method.getAnnotation(DataType.class);
 
             if (operationDataType != null) {

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java Mon Oct  2 14:49:09 2006
@@ -33,6 +33,7 @@
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.InboundInvocationChain;
 import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Interceptor;
 import org.apache.tuscany.spi.wire.OutboundInvocationChain;
 import org.apache.tuscany.spi.wire.OutboundWire;
 
@@ -71,6 +72,29 @@
                 entry.getValue().addInterceptor(0, interceptor);
             }
         }
+        
+        // Check if there's a callback
+        Map callbackOperations = source.getServiceContract().getCallbackOperations();
+        if (callbackOperations == null || callbackOperations.isEmpty()) {
+            return;
+        }
+        Object targetAddress = source.getContainer().getName();
+        Map<Operation<?>, OutboundInvocationChain> callbackChains = target.getSourceCallbackInvocationChains(targetAddress);
+        for (Map.Entry<Operation<?>, OutboundInvocationChain> entry : callbackChains.entrySet()) {
+            Operation<?> sourceOperation = entry.getKey();
+            Operation<?> targetOperation =
+                getTargetOperation(source.getTargetCallbackInvocationChains().keySet(), sourceOperation.getName());
+            String sourceDataBinding = getDataBinding(sourceOperation);
+            String targetDataBinding = getDataBinding(targetOperation);
+            if (sourceDataBinding == null || targetDataBinding == null || !sourceDataBinding.equals(targetDataBinding)) {
+                // Add the interceptor to the source side because multiple references can be wired
+                // to the same service
+                DataBindingInteceptor interceptor =
+                        new DataBindingInteceptor(source, sourceOperation, target, targetOperation);
+                interceptor.setMediator(mediator);
+                entry.getValue().addInterceptor(0, interceptor);
+            }
+        }        
     }
 
     /**
@@ -95,7 +119,13 @@
                         new DataBindingInteceptor(source, sourceOperation, target, targetOperation);
                 interceptor.setMediator(mediator);
                 if (isReference) {
+                    // FIXME: We need a better way to position the interceptors
                     target.getInvocationChains().get(targetOperation).addInterceptor(0, interceptor);
+                    Interceptor tail = entry.getValue().getTailInterceptor();
+                    if (tail != null) {
+                        // HACK to relink the bridging interceptor
+                        tail.setNext(interceptor);
+                    }
                 } else {
                     entry.getValue().addInterceptor(0, interceptor);
                 }

Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java?view=auto&rev=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java Mon Oct  2 14:49:09 2006
@@ -0,0 +1,33 @@
+/*
+ * 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.core.databinding.xml;
+
+import org.apache.tuscany.spi.databinding.extension.DataBindingExtension;
+
+/**
+ * A DataBinding for the XML string
+ */
+public class XMLStringDataBinding extends DataBindingExtension {
+    public final static String NAME = String.class.getName();
+    
+    public XMLStringDataBinding() {
+        super(NAME, String.class);
+    }
+}

Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/XMLStringDataBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImpl.java Mon Oct  2 14:49:09 2006
@@ -103,7 +103,7 @@
             }
         }
         for (JavaInterfaceProcessor processor : processors) {
-            processor.visitInterface(type, contract);
+            processor.visitInterface(type, callback, contract);
         }
         return contract;
     }

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java Mon Oct  2 14:49:09 2006
@@ -52,6 +52,7 @@
 import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
 import org.apache.tuscany.spi.wire.InboundInvocationChain;
 import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
 import org.apache.tuscany.spi.wire.OutboundInvocationChain;
 import org.apache.tuscany.spi.wire.OutboundWire;
 import org.apache.tuscany.spi.wire.ProxyCreationException;
@@ -325,48 +326,78 @@
     }
 
     /**
-     * Compares two operations for wiring compatibility as defined by the SCA assembly specification, namely:
-     * <p/>
-     * <ol> <li>compatibility for the individual method is defined as compatibility of the signature, that is method
-     * name, input types, and output types MUST BE the same. <li>the order of the input and output types also MUST BE
-     * the same. <li>the set of Faults and Exceptions expected by the source MUST BE the same or be a superset of those
-     * specified by the service. </ol>
-     *
+     * Compares two operations for wiring compatibility as defined by the SCA
+     * assembly specification, namely: <p/>
+     * <ol>
+     * <li>compatibility for the individual method is defined as compatibility
+     * of the signature, that is method name, input types, and output types MUST
+     * BE the same.
+     * <li>the order of the input and output types also MUST BE the same.
+     * <li>the set of Faults and Exceptions expected by the source MUST BE the
+     * same or be a superset of those specified by the service.
+     * </ol>
+     * 
      * @param source the source contract to compare
      * @param target the target contract to compare
+     * @IncompatibleServiceContractException Thrown if the two contracts don't
+     *                                       match
      */
-    public boolean isWireable(ServiceContract<?> source, ServiceContract<?> target) {
+    public void checkCompatibility(ServiceContract<?> source, ServiceContract<?> target, boolean ignoreCallback)
+        throws IncompatibleServiceContractException {
         if (source == target) {
             // Shortcut for performance
-            return true;
+            return;
         }
         if (source.isRemotable() != target.isRemotable()) {
-            return false;
+            IncompatibleServiceContractException ex =
+                new IncompatibleServiceContractException("The remotable settings don't match");
+            ex.addContextName("source.remotable: " + source.isRemotable());
+            ex.addContextName("target.remotable: " + target.isRemotable());
+            throw ex;
         }
         if (source.getInteractionScope() != target.getInteractionScope()) {
-            return false;
+            IncompatibleServiceContractException ex =
+                new IncompatibleServiceContractException("The interaction scopes don't match");
+            ex.addContextName("source.interactionScope: " + source.getInteractionScope());
+            ex.addContextName("target.interactionScope: " + target.getInteractionScope());
+            throw ex;
         }
 
         for (Operation<?> operation : source.getOperations().values()) {
             Operation<?> targetOperation = target.getOperations().get(operation.getName());
             if (targetOperation == null) {
-                return false;
+                IncompatibleServiceContractException ex =
+                    new IncompatibleServiceContractException("A operation is not in the target");
+                ex.addContextName("operation: " + operation.getName());
+                throw ex;
             }
             if (!operation.equals(targetOperation)) {
-                return false;
+                IncompatibleServiceContractException ex =
+                    new IncompatibleServiceContractException("A target operation is not compatible");
+                ex.addContextName("operation: " + operation.getName());
+                throw ex;
             }
         }
 
+        if (ignoreCallback) {
+            return;
+        }
+        
         for (Operation<?> operation : source.getCallbackOperations().values()) {
             Operation<?> targetOperation = target.getCallbackOperations().get(operation.getName());
             if (targetOperation == null) {
-                return false;
+                IncompatibleServiceContractException ex =
+                    new IncompatibleServiceContractException("A callback operation is not in the target");
+                ex.addContextName("operation: " + operation.getName());
+                throw ex;
             }
             if (!operation.equals(targetOperation)) {
-                return false;
+                IncompatibleServiceContractException ex =
+                    new IncompatibleServiceContractException("A target callback operation is not compatible");
+                ex.addContextName("operation: " + operation.getName());
+                throw ex;
             }
         }
-        return true;
     }
 
     private Map<Method, InboundInvocationChain> createInboundMapping(InboundWire wire, Method[] methods)

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/ConnectorPostProcessTestCase.java Mon Oct  2 14:49:09 2006
@@ -36,6 +36,7 @@
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 
@@ -55,8 +56,9 @@
         registry.process(EasyMock.eq(iwire), EasyMock.eq(owire));
         replay(registry);
         WireService wireService = createMock(WireService.class);
-        expect(wireService.isWireable((ServiceContract<?>) EasyMock.anyObject(),
-            (ServiceContract<?>) EasyMock.anyObject())).andReturn(true).anyTimes();
+        wireService.checkCompatibility((ServiceContract<?>) EasyMock.anyObject(),
+            (ServiceContract<?>) EasyMock.anyObject(), EasyMock.eq(false));
+        expectLastCall().anyTimes();    
         replay(wireService);
         ConnectorImpl connector = new ConnectorImpl(wireService, registry, null, null);
         connector.connect(iwire, owire, false);
@@ -83,8 +85,9 @@
         registry.process(EasyMock.eq(owire), EasyMock.eq(iwire));
         replay(registry);
         WireService wireService = createMock(WireService.class);
-        expect(wireService.isWireable((ServiceContract<?>) EasyMock.anyObject(),
-            (ServiceContract<?>) EasyMock.anyObject())).andReturn(true).anyTimes();
+        wireService.checkCompatibility((ServiceContract<?>) EasyMock.anyObject(),
+            (ServiceContract<?>) EasyMock.anyObject(), EasyMock.eq(false));
+        expectLastCall().anyTimes();
         replay(wireService);
         ConnectorImpl connector = new ConnectorImpl(wireService, registry, null, null);
 

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessorTestCase.java Mon Oct  2 14:49:09 2006
@@ -60,7 +60,7 @@
         operations.put("call", operation);
         operations.put("call1", operation1);
         contract.setOperations(operations);
-        processor.visitInterface(MockInterface.class, contract);
+        processor.visitInterface(MockInterface.class, null, contract);
         Assert.assertEquals("org.w3c.dom.Node", contract.getDataBinding());
         Assert.assertEquals("element", (String) contract.getMetaData().get("nodeType"));
         Assert.assertEquals("org.w3c.dom.Node", contract.getOperations().get("call").getDataBinding());

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessorTestCase.java Mon Oct  2 14:49:09 2006
@@ -19,8 +19,12 @@
 
 package org.apache.tuscany.core.databinding.impl;
 
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+
 import java.lang.reflect.Type;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -60,17 +64,17 @@
     }
 
     public void testProcess1() {
-        InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
-        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+        InboundWire inboundWire = createMock(InboundWire.class);
+        OutboundWire outboundWire = createMock(OutboundWire.class);
 
-        Component component = EasyMock.createMock(Component.class);
-        CompositeComponent composite = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(component.getParent()).andReturn(composite);
-        EasyMock.expect(inboundWire.getContainer()).andReturn(component);
-        EasyMock.expect(outboundWire.getContainer()).andReturn(component);
+        Component component = createMock(Component.class);
+        CompositeComponent composite = createMock(CompositeComponent.class);
+        expect(component.getParent()).andReturn(composite);
+        expect(inboundWire.getContainer()).andReturn(component);
+        expect(outboundWire.getContainer()).andReturn(component);
 
         Map<Operation<?>, OutboundInvocationChain> outboundChains =
-                new HashMap<Operation<?>, OutboundInvocationChain>();
+            new HashMap<Operation<?>, OutboundInvocationChain>();
         DataType<Type> type1 = new DataType<Type>(String.class, String.class);
         List<DataType<Type>> types = new ArrayList<DataType<Type>>();
         types.add(type1);
@@ -81,43 +85,50 @@
         outboundContract.setDataBinding(String.class.getName());
         op1.setServiceContract(outboundContract);
 
-        OutboundInvocationChain outboundChain = EasyMock.createMock(OutboundInvocationChain.class);
+        OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
         outboundChains.put(op1, outboundChain);
-        EasyMock.expect(outboundWire.getInvocationChains()).andReturn(outboundChains);
-        outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor) EasyMock.anyObject());
+        expect(outboundWire.getInvocationChains()).andReturn(outboundChains);
+        outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor)EasyMock.anyObject());
 
-        Map<Operation<?>, InboundInvocationChain> inboundChains = new HashMap<Operation<?>, InboundInvocationChain>();
+        Map<Operation<?>, InboundInvocationChain> inboundChains =
+            new HashMap<Operation<?>, InboundInvocationChain>();
         DataType<Type> type2 = new DataType<Type>(Node.class, Node.class);
         List<DataType<Type>> types2 = new ArrayList<DataType<Type>>();
         types2.add(type2);
-        DataType<List<DataType<Type>>> inputType2 = new DataType<List<DataType<Type>>>(Object[].class, types2);
+        DataType<List<DataType<Type>>> inputType2 =
+            new DataType<List<DataType<Type>>>(Object[].class, types2);
         DataType<Type> outputType2 = new DataType<Type>(String.class, String.class);
         Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
         ServiceContract<Type> inboundContract = new JavaServiceContract(null);
         inboundContract.setDataBinding(Node.class.getName());
         op2.setServiceContract(inboundContract);
 
-        InboundInvocationChain inboundChain = EasyMock.createMock(InboundInvocationChain.class);
+        InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
         inboundChains.put(op2, inboundChain);
-        EasyMock.expect(inboundWire.getInvocationChains()).andReturn(inboundChains);
-  
+        expect(inboundWire.getInvocationChains()).andReturn(inboundChains);
+
+        ServiceContract<Type> contract = new JavaServiceContract();
+        Map<String, Operation<Type>> operations = Collections.emptyMap();
+        contract.setCallbackOperations(operations);
+        expect(outboundWire.getServiceContract()).andReturn(contract);
+
         EasyMock.replay(composite, component, inboundWire, outboundWire, inboundChain, outboundChain);
 
         processor.process(outboundWire, inboundWire);
     }
 
     public void testProcess2() {
-        InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
-        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+        InboundWire inboundWire = createMock(InboundWire.class);
+        OutboundWire outboundWire = createMock(OutboundWire.class);
 
-        Reference reference = EasyMock.createMock(Reference.class);
-        CompositeComponent composite = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(reference.getParent()).andReturn(composite);
-        EasyMock.expect(inboundWire.getContainer()).andReturn(reference).anyTimes();
-        EasyMock.expect(outboundWire.getContainer()).andReturn(reference).anyTimes();
+        Reference reference = createMock(Reference.class);
+        CompositeComponent composite = createMock(CompositeComponent.class);
+        expect(reference.getParent()).andReturn(composite);
+        expect(inboundWire.getContainer()).andReturn(reference).anyTimes();
+        expect(outboundWire.getContainer()).andReturn(reference).anyTimes();
 
         Map<Operation<?>, OutboundInvocationChain> outboundChains =
-                new HashMap<Operation<?>, OutboundInvocationChain>();
+            new HashMap<Operation<?>, OutboundInvocationChain>();
         DataType<Type> type1 = new DataType<Type>(String.class, String.class);
         List<DataType<Type>> types = new ArrayList<DataType<Type>>();
         types.add(type1);
@@ -128,26 +139,33 @@
         outboundContract.setDataBinding(String.class.getName());
         op1.setServiceContract(outboundContract);
 
-        OutboundInvocationChain outboundChain = EasyMock.createMock(OutboundInvocationChain.class);
+        OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
         outboundChains.put(op1, outboundChain);
-        EasyMock.expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
-        outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor) EasyMock.anyObject());
+        expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
+        outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor)EasyMock.anyObject());
 
-        Map<Operation<?>, InboundInvocationChain> inboundChains = new HashMap<Operation<?>, InboundInvocationChain>();
+        Map<Operation<?>, InboundInvocationChain> inboundChains =
+            new HashMap<Operation<?>, InboundInvocationChain>();
         DataType<Type> type2 = new DataType<Type>(Node.class, Node.class);
         List<DataType<Type>> types2 = new ArrayList<DataType<Type>>();
         types2.add(type2);
-        DataType<List<DataType<Type>>> inputType2 = new DataType<List<DataType<Type>>>(Object[].class, types2);
+        DataType<List<DataType<Type>>> inputType2 =
+            new DataType<List<DataType<Type>>>(Object[].class, types2);
         DataType<Type> outputType2 = new DataType<Type>(String.class, String.class);
         Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
         ServiceContract<Type> inboundContract = new JavaServiceContract(null);
         inboundContract.setDataBinding(Node.class.getName());
         op2.setServiceContract(inboundContract);
 
-        InboundInvocationChain inboundChain = EasyMock.createMock(InboundInvocationChain.class);
+        InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
         inboundChains.put(op2, inboundChain);
-        EasyMock.expect(inboundWire.getInvocationChains()).andReturn(inboundChains).anyTimes();
-        // inboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor) EasyMock.anyObject());
+        expect(inboundWire.getInvocationChains()).andReturn(inboundChains).anyTimes();
+
+        ServiceContract<Type> contract = new JavaServiceContract();
+        Map<String, Operation<Type>> operations = Collections.emptyMap();
+        contract.setCallbackOperations(operations);
+        expect(inboundWire.getServiceContract()).andReturn(contract);
+        expect(inboundChain.getTailInterceptor()).andReturn(null);
 
         EasyMock.replay(composite, reference, inboundWire, outboundWire, inboundChain, outboundChain);
 
@@ -155,17 +173,17 @@
     }
 
     public void testProcess3() {
-        InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
-        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
+        InboundWire inboundWire = createMock(InboundWire.class);
+        OutboundWire outboundWire = createMock(OutboundWire.class);
 
-        Service service = EasyMock.createMock(Service.class);
-        CompositeComponent composite = EasyMock.createMock(CompositeComponent.class);
-        EasyMock.expect(service.getParent()).andReturn(composite);
-        EasyMock.expect(inboundWire.getContainer()).andReturn(service).anyTimes();
-        EasyMock.expect(outboundWire.getContainer()).andReturn(service).anyTimes();
+        Service service = createMock(Service.class);
+        CompositeComponent composite = createMock(CompositeComponent.class);
+        expect(service.getParent()).andReturn(composite);
+        expect(inboundWire.getContainer()).andReturn(service).anyTimes();
+        expect(outboundWire.getContainer()).andReturn(service).anyTimes();
 
         Map<Operation<?>, OutboundInvocationChain> outboundChains =
-                new HashMap<Operation<?>, OutboundInvocationChain>();
+            new HashMap<Operation<?>, OutboundInvocationChain>();
         DataType<Type> type1 = new DataType<Type>(String.class, String.class);
         List<DataType<Type>> types = new ArrayList<DataType<Type>>();
         types.add(type1);
@@ -176,26 +194,34 @@
         outboundContract.setDataBinding(String.class.getName());
         op1.setServiceContract(outboundContract);
 
-        OutboundInvocationChain outboundChain = EasyMock.createMock(OutboundInvocationChain.class);
+        OutboundInvocationChain outboundChain = createMock(OutboundInvocationChain.class);
         outboundChains.put(op1, outboundChain);
-        EasyMock.expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
-        // outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor) EasyMock.anyObject());
+        expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
+        // outboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor)
+        // EasyMock.anyObject());
 
-        Map<Operation<?>, InboundInvocationChain> inboundChains = new HashMap<Operation<?>, InboundInvocationChain>();
+        Map<Operation<?>, InboundInvocationChain> inboundChains =
+            new HashMap<Operation<?>, InboundInvocationChain>();
         DataType<Type> type2 = new DataType<Type>(Node.class, Node.class);
         List<DataType<Type>> types2 = new ArrayList<DataType<Type>>();
         types2.add(type2);
-        DataType<List<DataType<Type>>> inputType2 = new DataType<List<DataType<Type>>>(Object[].class, types2);
+        DataType<List<DataType<Type>>> inputType2 =
+            new DataType<List<DataType<Type>>>(Object[].class, types2);
         DataType<Type> outputType2 = new DataType<Type>(String.class, String.class);
         Operation<Type> op2 = new Operation<Type>("test", inputType2, outputType2, null);
         ServiceContract<Type> inboundContract = new JavaServiceContract(null);
         inboundContract.setDataBinding(Node.class.getName());
         op2.setServiceContract(inboundContract);
 
-        InboundInvocationChain inboundChain = EasyMock.createMock(InboundInvocationChain.class);
+        InboundInvocationChain inboundChain = createMock(InboundInvocationChain.class);
         inboundChains.put(op2, inboundChain);
-        EasyMock.expect(inboundWire.getInvocationChains()).andReturn(inboundChains).anyTimes();
-        inboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor) EasyMock.anyObject());
+        expect(inboundWire.getInvocationChains()).andReturn(inboundChains).anyTimes();
+        inboundChain.addInterceptor(EasyMock.anyInt(), (Interceptor)EasyMock.anyObject());
+
+        ServiceContract<Type> contract = new JavaServiceContract();
+        Map<String, Operation<Type>> operations = Collections.emptyMap();
+        contract.setCallbackOperations(operations);
+        expect(inboundWire.getServiceContract()).andReturn(contract);
 
         EasyMock.replay(composite, service, inboundWire, outboundWire, inboundChain, outboundChain);
 

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DOM2StAXTestCase.java Mon Oct  2 14:49:09 2006
@@ -30,19 +30,34 @@
 
 public class DOM2StAXTestCase extends TestCase {
     private static final String IPO_XML =
-            "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
-                    + "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
-                    + "  xmlns:ipo=\"http://www.example.com/IPO\""
-                    + "  xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\"" + "  orderDate=\"1999-12-01\">"
-                    + "  <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">" + "    <name>Helen Zoe</name>"
-                    + "    <street>47 Eden Street</street>" + "    <city>Cambridge</city>"
-                    + "    <postcode>CB1 1JR</postcode>" + "  </shipTo>" + "  <billTo xsi:type=\"ipo:USAddress\">"
-                    + "    <name>Robert Smith</name>" + "    <street>8 Oak Avenue</street>"
-                    + "    <city>Old Town</city>" + "    <state>PA</state>" + "    <zip>95819</zip>" + "  </billTo>"
-                    + "  <items>" + "    <item partNum=\"833-AA\">" + "      <productName>Lapis necklace</productName>"
-                    + "      <quantity>1</quantity>" + "      <USPrice>99.95</USPrice>"
-                    + "      <ipo:comment>Want this for the holidays</ipo:comment>"
-                    + "      <shipDate>1999-12-05</shipDate>" + "    </item>" + "  </items>" + "</ipo:purchaseOrder>";
+        "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+            + "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+            + "  xmlns:ipo=\"http://www.example.com/IPO\""
+            + "  xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+            + "  orderDate=\"1999-12-01\">"
+            + "  <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+            + "    <name>Helen Zoe</name>"
+            + "    <street>47 Eden Street</street>"
+            + "    <city>Cambridge</city>"
+            + "    <postcode>CB1 1JR</postcode>"
+            + "  </shipTo>"
+            + "  <billTo xsi:type=\"ipo:USAddress\">"
+            + "    <name>Robert Smith</name>"
+            + "    <street>8 Oak Avenue</street>"
+            + "    <city>Old Town</city>"
+            + "    <state>PA</state>"
+            + "    <zip>95819</zip>"
+            + "  </billTo>"
+            + "  <items>"
+            + "    <item partNum=\"833-AA\">"
+            + "      <productName>Lapis necklace</productName>"
+            + "      <quantity>1</quantity>"
+            + "      <USPrice>99.95</USPrice>"
+            + "      <ipo:comment>Want this for the holidays</ipo:comment>"
+            + "      <shipDate>1999-12-05</shipDate>"
+            + "    </item>"
+            + "  </items>"
+            + "</ipo:purchaseOrder>";
 
     /**
      * @see junit.framework.TestCase#setUp()

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/DataPipeTestCase.java Mon Oct  2 14:49:09 2006
@@ -43,7 +43,7 @@
 public class DataPipeTestCase extends TestCase {
 
     public final void testStreamPipe() throws IOException {
-        byte[] bytes = new byte[] { 1, 2, 3 };
+        byte[] bytes = new byte[] {1, 2, 3};
         StreamDataPipe pipe = new StreamDataPipe();
         Assert.assertSame(OutputStream.class, pipe.getSourceType());
         Assert.assertSame(InputStream.class, pipe.getTargetType());
@@ -75,7 +75,7 @@
         Node2Writer node2Writer = new Node2Writer();
         Writer2ReaderDataPipe pipe = new Writer2ReaderDataPipe();
         PipedTransformer<Node, Writer, Reader> transformer =
-                new PipedTransformer<Node, Writer, Reader>(node2Writer, pipe);
+            new PipedTransformer<Node, Writer, Reader>(node2Writer, pipe);
         Document document = DOMHelper.newDocument();
         Element element = document.createElementNS("http://ns1", "root");
         document.appendChild(element);

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/databinding/xml/PushTransformationTestCase.java Mon Oct  2 14:49:09 2006
@@ -33,19 +33,34 @@
 
 public class PushTransformationTestCase extends TestCase {
     private static final String IPO_XML =
-            "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
-                    + "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
-                    + "  xmlns:ipo=\"http://www.example.com/IPO\""
-                    + "  xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\"" + "  orderDate=\"1999-12-01\">"
-                    + "  <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">" + "    <name>Helen Zoe</name>"
-                    + "    <street>47 Eden Street</street>" + "    <city>Cambridge</city>"
-                    + "    <postcode>CB1 1JR</postcode>" + "  </shipTo>" + "  <billTo xsi:type=\"ipo:USAddress\">"
-                    + "    <name>Robert Smith</name>" + "    <street>8 Oak Avenue</street>"
-                    + "    <city>Old Town</city>" + "    <state>PA</state>" + "    <zip>95819</zip>" + "  </billTo>"
-                    + "  <items>" + "    <item partNum=\"833-AA\">" + "      <productName>Lapis necklace</productName>"
-                    + "      <quantity>1</quantity>" + "      <USPrice>99.95</USPrice>"
-                    + "      <ipo:comment>Want this for the holidays</ipo:comment>"
-                    + "      <shipDate>1999-12-05</shipDate>" + "    </item>" + "  </items>" + "</ipo:purchaseOrder>";
+        "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+            + "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+            + "  xmlns:ipo=\"http://www.example.com/IPO\""
+            + "  xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+            + "  orderDate=\"1999-12-01\">"
+            + "  <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+            + "    <name>Helen Zoe</name>"
+            + "    <street>47 Eden Street</street>"
+            + "    <city>Cambridge</city>"
+            + "    <postcode>CB1 1JR</postcode>"
+            + "  </shipTo>"
+            + "  <billTo xsi:type=\"ipo:USAddress\">"
+            + "    <name>Robert Smith</name>"
+            + "    <street>8 Oak Avenue</street>"
+            + "    <city>Old Town</city>"
+            + "    <state>PA</state>"
+            + "    <zip>95819</zip>"
+            + "  </billTo>"
+            + "  <items>"
+            + "    <item partNum=\"833-AA\">"
+            + "      <productName>Lapis necklace</productName>"
+            + "      <quantity>1</quantity>"
+            + "      <USPrice>99.95</USPrice>"
+            + "      <ipo:comment>Want this for the holidays</ipo:comment>"
+            + "      <shipDate>1999-12-05</shipDate>"
+            + "    </item>"
+            + "  </items>"
+            + "</ipo:purchaseOrder>";
 
     /**
      * @see junit.framework.TestCase#setUp()
@@ -59,7 +74,7 @@
         XMLStreamReader reader = t1.transform(IPO_XML, null);
         XMLStreamReader2SAX t2 = new XMLStreamReader2SAX();
         PipedTransformer<XMLStreamReader, ContentHandler, Node> t3 =
-                new PipedTransformer<XMLStreamReader, ContentHandler, Node>(t2, new SAX2DOMPipe());
+            new PipedTransformer<XMLStreamReader, ContentHandler, Node>(t2, new SAX2DOMPipe());
         Node node = t3.transform(reader, null);
         Assert.assertNotNull(node);
         Node2String t4 = new Node2String();

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/idl/java/JavaInterfaceProcessorRegistryImplTestCase.java Mon Oct  2 14:49:09 2006
@@ -30,6 +30,8 @@
 
 import junit.framework.TestCase;
 import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+import org.easymock.EasyMock;
+
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expectLastCall;
@@ -72,7 +74,7 @@
 
     public void testUnregister() throws Exception {
         JavaInterfaceProcessor processor = createMock(JavaInterfaceProcessor.class);
-        processor.visitInterface(eq(Base.class), isA(JavaServiceContract.class));
+        processor.visitInterface(eq(Base.class), EasyMock.same((Class)null), isA(JavaServiceContract.class));
         expectLastCall().once();
         replay(processor);
         impl.registerProcessor(processor);

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaInterfaceProcessor.java Mon Oct  2 14:49:09 2006
@@ -21,12 +21,14 @@
 import org.apache.tuscany.spi.idl.InvalidServiceContractException;
 
 /**
- * Implementations introspect metadata on a Java interface, populating the corresponding {@link JavaServiceContract}
- *
+ * Implementations introspect metadata on a Java interface, populating the
+ * corresponding {@link JavaServiceContract}
+ * 
  * @version $Rev$ $Date$
  */
 public interface JavaInterfaceProcessor {
 
-    void visitInterface(Class<?> clazz, JavaServiceContract contract) throws InvalidServiceContractException;
+    void visitInterface(Class<?> clazz, Class<?> callbackClass, JavaServiceContract contract)
+        throws InvalidServiceContractException;
 
 }

Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java?view=auto&rev=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java Mon Oct  2 14:49:09 2006
@@ -0,0 +1,54 @@
+/*
+ * 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.spi.wire;
+
+/**
+ * Denotes imcompatible service contracts for a wire
+ */
+public class IncompatibleServiceContractException extends WireException {
+
+    private static final long serialVersionUID = 5127478601823295587L;
+
+    public IncompatibleServiceContractException() {
+    }
+
+    /**
+     * @param message
+     */
+    public IncompatibleServiceContractException(String message) {
+        super(message);
+    }
+
+    /**
+     * @param message
+     * @param cause
+     */
+    public IncompatibleServiceContractException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * @param cause
+     */
+    public IncompatibleServiceContractException(Throwable cause) {
+        super(cause);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/IncompatibleServiceContractException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java Mon Oct  2 14:49:09 2006
@@ -141,12 +141,13 @@
      * superset of those specified by the service. <li>other specified attributes of the two interfaces MUST match,
      * including Scope and Callback interface </ol>
      * <p/>
-     * <p>Please note this test is not symetric: isWireable(A, B) does NOT imply that isWireable(B, A)
+     * <p>Please note this test is not symetric: the success of checkCompatibility(A, B) does NOT imply that checkCompatibility(B, A)
      *
      * @param source The source service contract
      * @param target The target service contract
-     * @return true if the contracts are wireable
+     * @param ignoreCallback Indicate the callback should be checked
+     * @throws IncompatibleServiceContractException If the source service contract is not compatible with the target one
      */
-    boolean isWireable(ServiceContract<?> source, ServiceContract<?> target);
+    void checkCompatibility(ServiceContract<?> source, ServiceContract<?> target, boolean ignoreCallback) throws IncompatibleServiceContractException;
 
 }

Modified: incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java Mon Oct  2 14:49:09 2006
@@ -19,6 +19,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.OperationClient;
@@ -27,42 +28,41 @@
 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;
 
 public class Axis2AsyncTargetInvoker extends Axis2TargetInvoker {
 
-    protected static final Message RESPONSE = new ImmutableMessage();
+    protected static final OMElement RESPONSE = null;
 
     private InboundWire wire;
     private Object messageId;
     private Axis2ReferenceCallbackTargetInvoker callbackInvoker;
 
     public Axis2AsyncTargetInvoker(ServiceClient serviceClient,
-            QName wsdlOperationName,
-            Options options,
-            SOAPFactory soapFactory,
-            InboundWire wire) {
+                                   QName wsdlOperationName,
+                                   Options options,
+                                   SOAPFactory soapFactory,
+                                   InboundWire wire) {
         super(serviceClient, wsdlOperationName, options, soapFactory);
         this.wire = wire;
     }
 
     public Object invokeTarget(final Object payload) throws InvocationTargetException {
         try {
-            Object[] args = (Object[]) payload;
+            Object[] args = (Object[])payload;
             OperationClient operationClient = createOperationClient(args);
             callbackInvoker.setCorrelationId(messageId);
-            Axis2ReferenceCallback callback =
-                    new Axis2ReferenceCallback(callbackInvoker);
+            Axis2ReferenceCallback callback = new Axis2ReferenceCallback(callbackInvoker);
             operationClient.setCallback(callback);
 
             operationClient.execute(false);
 
+            // REVIEW it seems ok to return null
             return RESPONSE;
         } catch (AxisFault e) {
             throw new InvocationTargetException(e);
         }
     }
-    
+
     public Message invoke(Message msg) throws InvocationRuntimeException {
         try {
             wire.addMapping(msg.getMessageId(), msg.getFromAddress());
@@ -74,67 +74,8 @@
         }
         return msg;
     }
-    
+
     public void setCallbackTargetInvoker(Axis2ReferenceCallbackTargetInvoker callbackInvoker) {
         this.callbackInvoker = callbackInvoker;
-    }
-
-    /**
-     * A dummy message passed back on an invocation
-     */
-    private static class ImmutableMessage implements Message {
-
-        public Object getBody() {
-            return null;
-        }
-
-        public void setBody(Object body) {
-            throw new UnsupportedOperationException();
-        }
-
-        public void setTargetInvoker(TargetInvoker invoker) {
-            throw new UnsupportedOperationException();
-        }
-
-        public TargetInvoker getTargetInvoker() {
-            return null;
-        }
-
-        public Message getRelatedCallbackMessage() {
-            return null;
-        }
-
-        public Object getFromAddress() {
-            return null;
-        }
-
-        public void setFromAddress(Object fromAddress) {
-            throw new UnsupportedOperationException();
-        }
-
-        public Object getMessageId() {
-            return null;
-        }
-
-        public void setMessageId(Object messageId) {
-            throw new UnsupportedOperationException();
-        }
-
-        public Object getCorrelationId() {
-            return null;
-        }
-
-        public void setCorrelationId(Object correlationId) {
-            throw new UnsupportedOperationException();
-        }
-        
-        public boolean isFault() {
-            return false;
-        }
-
-        public void setBodyWithFault(Object fault) {
-            throw new UnsupportedOperationException();
-        }
-        
     }
 }

Modified: incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?view=diff&rev=452233&r1=452232&r2=452233
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java (original)
+++ incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java Mon Oct  2 14:49:09 2006
@@ -40,6 +40,7 @@
 import org.apache.tuscany.spi.model.BoundReferenceDefinition;
 import org.apache.tuscany.spi.model.BoundServiceDefinition;
 import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.IncompatibleServiceContractException;
 
 /**
  * Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.Reference} configured
@@ -114,8 +115,10 @@
             inboundContract.setInterfaceClass(serviceDefinition.getServiceContract().getInterfaceClass());
             inboundContract.setDataBinding(OM_DATA_BINDING);
 
-            if (!wireService.isWireable(inboundContract, outboundContract)) {
-                throw new Axis2BindingBuilderRuntimeException("Incompatible interface");
+            try {
+                wireService.checkCompatibility(inboundContract, outboundContract, true);
+            } catch (IncompatibleServiceContractException e) {
+                throw new Axis2BindingBuilderRuntimeException(e);
             }
             
             Service service = new Axis2Service(serviceDefinition.getName(), inboundContract, parent, wireService, wsBinding,
@@ -159,8 +162,10 @@
             // Set the default databinding
             outboundContract.setDataBinding(OM_DATA_BINDING);
             
-            if (!wireService.isWireable(inboundContract, outboundContract)) {
-                throw new Axis2BindingBuilderRuntimeException("Incompatible interface");
+            try {
+                wireService.checkCompatibility(inboundContract, outboundContract, true);
+            } catch (IncompatibleServiceContractException e) {
+                throw new Axis2BindingBuilderRuntimeException(e);
             }
             
             Reference reference = new Axis2Reference(boundReferenceDefinition.getName(), parent, wireService, wsBinding,

Added: incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java?view=auto&rev=452233
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java (added)
+++ incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2CallbackInvocationHandler.java Mon Oct  2 14:49:09 2006
@@ -0,0 +1,75 @@
+/*
+ * 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.util.Map;
+
+import org.apache.tuscany.core.wire.AbstractOutboundInvocationHandler;
+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.TargetInvoker;
+
+public class Axis2CallbackInvocationHandler extends AbstractOutboundInvocationHandler {
+
+    private InboundWire inboundWire;
+    private Object messageId;
+    private Object correlationId;
+
+    public Axis2CallbackInvocationHandler(InboundWire inboundWire) {
+        this.inboundWire = inboundWire;
+    }
+
+    public Object invoke(Operation operation, Object[] args) throws Throwable {
+        Object targetAddress = inboundWire.retrieveMapping(correlationId);
+        if (targetAddress == null) {
+            throw new AssertionError("No from address associated with message id [" + correlationId + "]");
+        }
+        //TODO optimize as this is slow in local invocations
+        Map<Operation<?>, OutboundInvocationChain> sourceCallbackInvocationChains =
+            inboundWire.getSourceCallbackInvocationChains(targetAddress);
+        OutboundInvocationChain chain = sourceCallbackInvocationChains.get(operation);
+        TargetInvoker invoker = chain.getTargetInvoker();
+        // System.out.println("Axis2CallbackInvocationHandler.invoke invoking super: " + args[0]);
+        return invoke(chain, invoker, args);
+    }
+
+    // This must be called before invoke
+    public void setMessageId(Object messageId) {
+        this.messageId = messageId;
+    }
+    
+    // This must be called before invoke
+    public void setCorrelationId(Object correlationId) {
+        this.correlationId = correlationId;
+    }
+
+    protected Object getFromAddress() {
+        return (inboundWire.getContainer() == null) ? null : inboundWire.getContainer().getName();
+    }
+    
+    protected Object getMessageId() {
+        return messageId;
+    }
+    
+    protected Object getCorrelationId() {
+        return correlationId;
+    }
+
+}

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

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



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