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 2007/04/12 08:26:32 UTC

svn commit: r527788 [1/2] - in /incubator/tuscany/java/sca/modules: core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/ core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/ core-databinding/src/main...

Author: rfeng
Date: Wed Apr 11 23:26:30 2007
New Revision: 527788

URL: http://svn.apache.org/viewvc?view=rev&rev=527788
Log:
Add source and target operation to InvocationChain

Modified:
    incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
    incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.java
    incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java
    incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessor.java
    incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java
    incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingInterceptorTestCase.java
    incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorOptimizationTestCase.java
    incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorTestCase.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerTestCase.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerThrowableTestCase.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/binding/local/LocalTargetInvokerTestCase.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/wire/WireObjectFactoryTestCase.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/wire/WireOptimizationTestCase.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/wire/WireUtilsTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/proxy/JDKCallbackInvocationHandler.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/proxy/JDKInvocationHandler.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/implementation/java/proxy/JDKInvocationHandlerProxyTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/implementation/java/proxy/JDKInvocationHandlerSerializationTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/implementation/java/proxy/JDKInvocationHandlerTestCase.java
    incubator/tuscany/java/sca/modules/interface/src/main/java/org/apache/tuscany/interfacedef/impl/OperationImpl.java

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.java Wed Apr 11 23:26:30 2007
@@ -36,7 +36,7 @@
 import javax.xml.datatype.Duration;
 import javax.xml.datatype.XMLGregorianCalendar;
 
-import org.apache.tuscany.databinding.DataType;
+import org.apache.tuscany.interfacedef.DataType;
 import org.apache.tuscany.interfacedef.InvalidInterfaceException;
 import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.interfacedef.java.JavaInterface;
@@ -52,57 +52,59 @@
 public class DataBindingJavaInterfaceProcessor implements JavaInterfaceIntrospectorExtension {
     private DataBindingRegistry dataBindingRegistry;
 
-    public DataBindingJavaInterfaceProcessor(@Reference DataBindingRegistry dataBindingRegistry) {
+    public DataBindingJavaInterfaceProcessor(@Reference
+    DataBindingRegistry dataBindingRegistry) {
         super();
         this.dataBindingRegistry = dataBindingRegistry;
     }
 
-    public void visitInterface(JavaInterface javaInterface)
-        throws InvalidInterfaceException {
+    public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
         if (!javaInterface.isRemotable()) {
             return;
         }
         List<Operation> operations = javaInterface.getOperations();
         processInterface(javaInterface, operations);
     }
-    
+
+    private void introspectWrapperStyle(Operation operation) {
+        if (operation.isWrapperStyle()) {
+            return;
+        }
+        DataType outputType = operation.getOutputType();
+        DataType<List<DataType>> inputType = operation.getInputType();
+        if (outputType != null || inputType == null) {
+            return;
+        }
+        if (inputType.getLogical().size() != 1) {
+            return;
+        }
+        DataType wrapperType = inputType.getLogical().get(0);
+        if (outputType.getDataBinding().equals(wrapperType.getDataBinding())) {
+            operation.setWrapperStyle(true);
+        }
+    }
+
     private void processInterface(JavaInterface javaInterface, List<Operation> operations) {
         Class<?> clazz = javaInterface.getJavaClass();
-        // IDLMapping interfaceMapping = clazz.getAnnotation(IDLMapping.class);
-        DataType interfaceDataType = clazz.getAnnotation(DataType.class);
-        if (interfaceDataType != null) {
-            javaInterface.setDataBinding(interfaceDataType.name());
-        }
         Map<String, Operation> opMap = new HashMap<String, Operation>();
-        for(Operation op: javaInterface.getOperations()) {
+        for (Operation op : javaInterface.getOperations()) {
             opMap.put(op.getName(), op);
         }
         for (Method method : clazz.getMethods()) {
             Operation operation = opMap.get(method.getName());
-            DataType operationDataType = method.getAnnotation(DataType.class);
-            if (operationDataType == null) {
-                operationDataType = interfaceDataType;
-            }
 
-            if (operationDataType != null) {
-                operation.setDataBinding(operationDataType.name());
-                // FIXME: [rfeng] Keep data context as metadata?
-            }
-
-            Annotation[] annotations = null;
-            if (operationDataType != null) {
-                annotations = new Annotation[] {operationDataType};
-            }
             // FIXME: We need a better way to identify simple java types
             for (org.apache.tuscany.interfacedef.DataType<?> d : operation.getInputType().getLogical()) {
-                dataBindingRegistry.introspectType(d, annotations);
+                dataBindingRegistry.introspectType(d, method.getAnnotations());
             }
             if (operation.getOutputType() != null) {
-                dataBindingRegistry.introspectType(operation.getOutputType(), annotations);
+                dataBindingRegistry.introspectType(operation.getOutputType(), method.getAnnotations());
             }
             for (org.apache.tuscany.interfacedef.DataType<?> d : operation.getFaultTypes()) {
-                dataBindingRegistry.introspectType(d, annotations);
+                dataBindingRegistry.introspectType(d, method.getAnnotations());
             }
+            
+            introspectWrapperStyle(operation);
         }
     }
 }

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.java Wed Apr 11 23:26:30 2007
@@ -23,6 +23,7 @@
 
 import org.apache.tuscany.interfacedef.DataType;
 import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.impl.DataTypeImpl;
 import org.apache.tuscany.interfacedef.util.ElementInfo;
 import org.apache.tuscany.interfacedef.util.WrapperInfo;
 import org.apache.tuscany.interfacedef.util.XMLType;
@@ -99,16 +100,19 @@
         boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
 
         WrapperHandler sourceWrapperHandler = null;
+        String sourceDataBinding = getDataBinding(sourceOp);
         if (sourceWrapped) {
-            sourceWrapperHandler = getWrapperHandler(sourceOp.getDataBinding(), true);
+            sourceWrapperHandler = getWrapperHandler(sourceDataBinding, true);
         }
 
         DataType<List<DataType>> targetType = context.getTargetDataType();
         Operation targetOp = (Operation)context.getTargetOperation();
         boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle();
         WrapperHandler targetWrapperHandler = null;
+        String targetDataBinding = null;
         if (targetWrapped) {
-            targetWrapperHandler = getWrapperHandler(targetOp.getDataBinding(), true);
+            targetDataBinding = getDataBinding(targetOp);
+            targetWrapperHandler = getWrapperHandler(targetDataBinding, true);
         }
 
         if ((!sourceWrapped) && targetWrapped) {
@@ -134,41 +138,36 @@
                 ElementInfo argElement = wrapper.getInputChildElements().get(i);
                 DataType<XMLType> argType = argTypes.get(i);
                 Object child = source[i];
-                child =
-                    mediator.mediate(source[i], sourceType.getLogical().get(i), argType, context
-                        .getMetadata());
+                child = mediator.mediate(source[i], sourceType.getLogical().get(i), argType, context.getMetadata());
                 targetWrapperHandler.setChild(targetWrapper, i, argElement, child);
             }
             return new Object[] {targetWrapper};
         } else if (sourceWrapped && (!targetWrapped)) {
             // Wrapped to Unwrapped
             Object sourceWrapper = source[0];
-            // List<ElementInfo> childElements = sourceOp.getWrapper().getInputChildElements();
+            // List<ElementInfo> childElements =
+            // sourceOp.getWrapper().getInputChildElements();
             Object[] target = null;
 
-            targetWrapperHandler = getWrapperHandler(targetOp.getDataBinding(), false);
+            targetWrapperHandler = getWrapperHandler(targetDataBinding, false);
             if (targetWrapperHandler != null) {
                 ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
                 // Object targetWrapper =
                 // targetWrapperHandler.create(wrapperElement, context);
-                DataType<XMLType> targetWrapperType =
-                    new DataType<XMLType>(targetOp.getDataBinding(), Object.class,
-                                        new XMLType(wrapperElement));
-                Object targetWrapper =
-                    mediator.mediate(sourceWrapper,
-                                     sourceType.getLogical().get(0),
-                                     targetWrapperType,
-                                     context.getMetadata());
+                DataType<XMLType> targetWrapperType = new DataTypeImpl<XMLType>(targetDataBinding, Object.class,
+                                                                                new XMLType(wrapperElement));
+                Object targetWrapper = mediator.mediate(sourceWrapper,
+                                                        sourceType.getLogical().get(0),
+                                                        targetWrapperType,
+                                                        context.getMetadata());
                 target = targetWrapperHandler.getChildren(targetWrapper).toArray();
             } else {
                 Object[] sourceChildren = sourceWrapperHandler.getChildren(sourceWrapper).toArray();
                 target = new Object[sourceChildren.length];
                 for (int i = 0; i < sourceChildren.length; i++) {
-                    DataType<XMLType> childType =
-                        sourceOp.getWrapper().getUnwrappedInputType().getLogical().get(i);
-                    target[i] =
-                        mediator.mediate(sourceChildren[i], childType, targetType.getLogical().get(i), context
-                            .getMetadata());
+                    DataType<XMLType> childType = sourceOp.getWrapper().getUnwrappedInputType().getLogical().get(i);
+                    target[i] = mediator.mediate(sourceChildren[i], childType, targetType.getLogical().get(i), context
+                        .getMetadata());
                 }
             }
             return target;
@@ -177,9 +176,8 @@
             // well
             Object[] newArgs = new Object[source.length];
             for (int i = 0; i < source.length; i++) {
-                Object child =
-                    mediator.mediate(source[i], sourceType.getLogical().get(i), targetType.getLogical()
-                        .get(i), context.getMetadata());
+                Object child = mediator.mediate(source[i], sourceType.getLogical().get(i), targetType.getLogical()
+                    .get(i), context.getMetadata());
                 newArgs[i] = child;
             }
             return newArgs;
@@ -187,13 +185,29 @@
     }
 
     private WrapperHandler getWrapperHandler(String dataBindingId, boolean required) {
-        DataBinding dataBinding = mediator.getDataBindingRegistry().getDataBinding(dataBindingId);
-        WrapperHandler wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
+        WrapperHandler wrapperHandler = null;
+        if (dataBindingId != null) {
+            DataBinding dataBinding = mediator.getDataBindingRegistry().getDataBinding(dataBindingId);
+            wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
+        }
         if (wrapperHandler == null && required) {
-            throw new TransformationException(
-                                              "No wrapper handler is provided for databinding: " + dataBindingId);
+            throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
         }
         return wrapperHandler;
+    }
+
+    private String getDataBinding(Operation operation) {
+        String dataBindingId = null;
+        if (operation.getOutputType() != null) {
+            // For wrapper style, the output type is not null
+            dataBindingId = operation.getOutputType().getDataBinding();
+        } else {
+            List<DataType> argTypes = operation.getInputType().getLogical();
+            if (!argTypes.isEmpty()) {
+                dataBindingId = argTypes.get(0).getDataBinding();
+            }
+        }
+        return dataBindingId;
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java Wed Apr 11 23:26:30 2007
@@ -96,21 +96,29 @@
         return 10;
     }
 
-    private WrapperHandler getWrapperHandler(Operation operation) {
-        String dataBindingId;
-        dataBindingId = operation.getDataBinding();
-        DataBinding dataBinding = mediator.getDataBindingRegistry().getDataBinding(dataBindingId);
-        WrapperHandler wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
-        if (wrapperHandler == null) {
-            throw new TransformationException(
-                                              "No wrapper handler is provided for databinding: " + dataBindingId);
+    private String getDataBinding(Operation operation) {
+        String dataBindingId = null;
+        if (operation.getOutputType() != null) {
+            dataBindingId = operation.getOutputType().getDataBinding();
+        } else {
+            List<DataType> argTypes = operation.getInputType().getLogical();
+            if (!argTypes.isEmpty()) {
+                dataBindingId = argTypes.get(0).getDataBinding();
+            }
         }
-        return wrapperHandler;
+        return dataBindingId;
     }
 
-    private WrapperHandler getWrapperHandler(String dataBindingId) {
-        DataBinding dataBinding = mediator.getDataBindingRegistry().getDataBinding(dataBindingId);
-        return dataBinding == null ? null : dataBinding.getWrapperHandler();
+    private WrapperHandler getWrapperHandler(String dataBindingId, boolean required) {
+        WrapperHandler wrapperHandler = null;
+        if (dataBindingId != null) {
+            DataBinding dataBinding = mediator.getDataBindingRegistry().getDataBinding(dataBindingId);
+            wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
+        }
+        if (wrapperHandler == null && required) {
+            throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
+        }
+        return wrapperHandler;
     }
 
     @SuppressWarnings("unchecked")
@@ -121,7 +129,7 @@
             boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
             WrapperHandler sourceWrapperHandler = null;
             if (sourceWrapped) {
-                sourceWrapperHandler = getWrapperHandler(sourceOp);
+                sourceWrapperHandler = getWrapperHandler(getDataBinding(sourceOp), true);
             }
 
             DataType<DataType> targetType = context.getTargetDataType();
@@ -129,14 +137,13 @@
             boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle();
             WrapperHandler targetWrapperHandler = null;
             if (targetWrapped) {
-                targetWrapperHandler = getWrapperHandler(targetOp);
+                targetWrapperHandler = getWrapperHandler(getDataBinding(targetOp), true);
             }
 
             if ((!sourceWrapped) && targetWrapped) {
                 // Unwrapped --> Wrapped
                 WrapperInfo wrapper = targetOp.getWrapper();
-                Object targetWrapper =
-                    targetWrapperHandler.create(wrapper.getOutputWrapperElement(), context);
+                Object targetWrapper = targetWrapperHandler.create(wrapper.getOutputWrapperElement(), context);
 
                 List<ElementInfo> childElements = wrapper.getOutputChildElements();
                 if (childElements.isEmpty()) {
@@ -157,17 +164,17 @@
                     // The void output
                     return null;
                 }
-                targetWrapperHandler = getWrapperHandler(targetType.getLogical().getDataBinding());
+                targetWrapperHandler = getWrapperHandler(getDataBinding(targetOp), false);
                 if (targetWrapperHandler != null) {
                     ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
                     // Object targetWrapper =
                     // targetWrapperHandler.create(wrapperElement, context);
-                    DataType<XMLType> targetWrapperType =
-                        new DataTypeImpl<XMLType>(targetType.getLogical().getDataBinding(), Object.class,
-                                            new XMLType(wrapperElement));
-                    Object targetWrapper =
-                        mediator.mediate(sourceWrapper, sourceType.getLogical(), targetWrapperType, context
-                            .getMetadata());
+                    DataType<XMLType> targetWrapperType = new DataTypeImpl<XMLType>(targetType.getLogical()
+                        .getDataBinding(), Object.class, new XMLType(wrapperElement));
+                    Object targetWrapper = mediator.mediate(sourceWrapper,
+                                                            sourceType.getLogical(),
+                                                            targetWrapperType,
+                                                            context.getMetadata());
                     return targetWrapperHandler.getChildren(targetWrapper).get(0);
                 } else {
                     Object child = sourceWrapperHandler.getChildren(sourceWrapper).get(0);

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessor.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessor.java Wed Apr 11 23:26:30 2007
@@ -19,8 +19,10 @@
 
 package org.apache.tuscany.core.databinding.wire;
 
+import java.util.List;
 import java.util.Map;
 
+import org.apache.tuscany.interfacedef.DataType;
 import org.apache.tuscany.interfacedef.InterfaceContract;
 import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.spi.component.ComponentManager;
@@ -41,14 +43,63 @@
     private Mediator mediator;
     private ComponentManager componentManager;
 
-    @Constructor({"componentManager", "mediator"})
-    public DataBindingWirePostProcessor(@Reference ComponentManager componentManager, 
-                                        @Reference Mediator mediator) {
+    @Constructor( {"componentManager", "mediator"})
+    public DataBindingWirePostProcessor(@Reference
+    ComponentManager componentManager, @Reference
+    Mediator mediator) {
         super();
         this.componentManager = componentManager;
         this.mediator = mediator;
     }
 
+    public boolean isTransformationRequired(DataType source, DataType target) {
+        if (source == target) {
+            return false;
+        }
+        return !source.getDataBinding().equals(target.getDataBinding());
+    }
+
+    public boolean isTransformationRequired(Operation source, Operation target) {
+        if (source == target) {
+            return false;
+        }
+
+        // Check output type
+        DataType sourceOutputType = source.getOutputType();
+        DataType targetOutputType = target.getOutputType();
+
+        // Note the target output type is now the source for checking
+        // compatibility
+        if (isTransformationRequired(targetOutputType, sourceOutputType)) {
+            return true;
+        }
+
+        List<DataType> sourceInputType = source.getInputType().getLogical();
+        List<DataType> targetInputType = target.getInputType().getLogical();
+
+        int size = sourceInputType.size();
+        for (int i = 0; i < size; i++) {
+            if (isTransformationRequired(sourceInputType.get(i), targetInputType.get(i))) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private boolean isTransformationRequired(InterfaceContract sourceContract,
+                                             Operation sourceOperation,
+                                             InterfaceContract targetContract,
+                                             Operation targetOperation) {
+        if (targetContract == null) {
+            targetContract = sourceContract;
+        }
+        if (sourceContract == targetContract) {
+            return false;
+        }
+        return true;
+    }
+
     public void process(Wire wire) {
         InterfaceContract sourceContract = wire.getSourceContract();
         InterfaceContract targetContract = wire.getTargetContract();
@@ -63,18 +114,13 @@
             String opName = entry.getKey().getName();
             Operation sourceOperation = sourceContract.getInterface().getOperation(opName);
             Operation targetOperation = targetContract.getInterface().getOperation(opName);
-            String sourceDataBinding = sourceOperation.getDataBinding();
-            String targetDataBinding = targetOperation.getDataBinding();
-            if (sourceDataBinding == null && targetDataBinding == null) {
-                continue;
-            }
-            if (sourceDataBinding == null || targetDataBinding == null 
-                || !sourceDataBinding.equals(targetDataBinding)) {
+
+            if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
                 // Add the interceptor to the source side because multiple
                 // references can be wired
                 // to the same service
-                DataBindingInteceptor interceptor =
-                    new DataBindingInteceptor(componentManager, wire, sourceOperation, targetOperation);
+                DataBindingInteceptor interceptor = new DataBindingInteceptor(componentManager, wire, sourceOperation,
+                                                                              targetOperation);
                 interceptor.setMediator(mediator);
                 entry.getValue().addInterceptor(0, interceptor);
             }
@@ -89,19 +135,15 @@
 
         for (Map.Entry<Operation, InvocationChain> entry : callbackChains.entrySet()) {
             String opName = entry.getKey().getName();
-            Operation sourceOperation = sourceContract.getCallbackInterface().getCallbackOperations().get(opName);
-            Operation targetOperation = targetContract.getCallbackOperations().get(opName);
-            String sourceDataBinding = sourceOperation.getDataBinding();
-            String targetDataBinding = targetOperation.getDataBinding();
-            if (sourceDataBinding == null && targetDataBinding == null) {
-                continue;
-            }
-            if (sourceDataBinding == null || targetDataBinding == null || !sourceDataBinding.equals(targetDataBinding)) {
+            Operation sourceOperation = sourceContract.getCallbackInterface().getOperations().get(opName);
+            Operation targetOperation = targetContract.getCallbackInterface().getOperations().get(opName);
+            if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
+
                 // Add the interceptor to the source side because multiple
                 // references can be wired
                 // to the same service
-                DataBindingInteceptor interceptor =
-                    new DataBindingInteceptor(componentManager, wire, sourceOperation, targetOperation);
+                DataBindingInteceptor interceptor = new DataBindingInteceptor(componentManager, wire, sourceOperation,
+                                                                              targetOperation);
                 interceptor.setMediator(mediator);
                 entry.getValue().addInterceptor(0, interceptor);
             }

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java Wed Apr 11 23:26:30 2007
@@ -38,6 +38,9 @@
 import org.apache.tuscany.databinding.xml.Node2String;
 import org.apache.tuscany.databinding.xml.String2Node;
 import org.apache.tuscany.interfacedef.DataType;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.interfacedef.impl.OperationImpl;
 import org.apache.tuscany.interfacedef.util.ElementInfo;
 import org.apache.tuscany.interfacedef.util.TypeInfo;
 import org.apache.tuscany.interfacedef.util.WrapperInfo;
@@ -50,35 +53,34 @@
 import org.w3c.dom.Element;
 
 public class IDLTransformerTestCase extends TestCase {
-    private static final String IPO_XML =
-        "<?xml version=\"1.0\"?>" + "<order1"
-            + "  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>"
-            + "</order1>";
+    private static final String IPO_XML = "<?xml version=\"1.0\"?>" + "<order1"
+                                          + "  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>"
+                                          + "</order1>";
 
     private static final String URI_ORDER_XSD = "http://example.com/order.xsd";
 
@@ -90,46 +92,52 @@
     }
 
     public void testTransform() throws Exception {
-        List<DataType<XMLType>> types0 = new ArrayList<DataType<XMLType>>();
-        DataType<XMLType> wrapperType =
-            new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "checkOrderStatus"), null));
+        List<DataType> types0 = new ArrayList<DataType>();
+        DataType<XMLType> wrapperType = new DataTypeImpl<XMLType>(null, Object.class,
+                                                                  new XMLType(new QName(URI_ORDER_XSD,
+                                                                                        "checkOrderStatus"), null));
         types0.add(wrapperType);
-        DataType<List<DataType<XMLType>>> inputType0 =
-            new DataType<List<DataType<XMLType>>>(IDL_INPUT, Object[].class, types0);
+        DataType<List<DataType>> inputType0 = new DataTypeImpl<List<DataType>>(IDL_INPUT,
+                                                                                                 Object[].class, types0);
 
-        List<DataType<XMLType>> types1 = new ArrayList<DataType<XMLType>>();
-        DataType<XMLType> customerIdType =
-            new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "customerId"), null));
-        DataType<XMLType> orderType =
-            new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "order"), null));
-        DataType<XMLType> flagType =
-            new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "flag"), null));
+        List<DataType> types1 = new ArrayList<DataType>();
+        DataType<XMLType> customerIdType = new DataTypeImpl<XMLType>(
+                                                                     null,
+                                                                     Object.class,
+                                                                     new XMLType(
+                                                                                 new QName(URI_ORDER_XSD, "customerId"),
+                                                                                 null));
+        DataType<XMLType> orderType = new DataTypeImpl<XMLType>(null, Object.class,
+                                                                new XMLType(new QName(URI_ORDER_XSD, "order"), null));
+        DataType<XMLType> flagType = new DataTypeImpl<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD,
+                                                                                                         "flag"), null));
         types1.add(customerIdType);
         types1.add(orderType);
         types1.add(flagType);
 
-        DataType<XMLType> statusType =
-            new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "status"), null));
-        DataType<XMLType> responseType =
-            new DataType<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD, "checkOrderStatusResponse"),
-                                                                  null));
-
-        org.apache.tuscany.spi.model.Operation<XMLType> op =
-            new org.apache.tuscany.spi.model.Operation<XMLType>("checkOrderStatus", inputType0, responseType, null);
+        DataType<XMLType> statusType = new DataTypeImpl<XMLType>(null, Object.class,
+                                                                 new XMLType(new QName(URI_ORDER_XSD, "status"), null));
+        DataType<XMLType> responseType = new DataTypeImpl<XMLType>(null, Object.class,
+                                                                   new XMLType(new QName(URI_ORDER_XSD,
+                                                                                         "checkOrderStatusResponse"),
+                                                                               null));
+
+        Operation op = new OperationImpl("checkOrderStatus");
+        op.setInputType(inputType0);
+        op.setOutputType(responseType);
         op.setDataBinding(DOMDataBinding.NAME);
 
         inputType0.setOperation(op);
         op.setWrapperStyle(true);
-        ElementInfo inputElement =
-            new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatus"), new TypeInfo(null, false, null));
+        ElementInfo inputElement = new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatus"), new TypeInfo(null,
+                                                                                                              false,
+                                                                                                              null));
         wrapperType.setMetadata(ElementInfo.class.getName(), inputElement);
 
-        ElementInfo customerId =
-            new ElementInfo(new QName("", "customerId"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("string"));
-        ElementInfo order =
-            new ElementInfo(new QName("", "order"), new TypeInfo(new QName(URI_ORDER_XSD), false, null));
-        ElementInfo flag =
-            new ElementInfo(new QName("", "flag"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("int"));
+        ElementInfo customerId = new ElementInfo(new QName("", "customerId"),
+                                                 SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("string"));
+        ElementInfo order = new ElementInfo(new QName("", "order"), new TypeInfo(new QName(URI_ORDER_XSD), false, null));
+        ElementInfo flag = new ElementInfo(new QName("", "flag"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("int"));
 
         customerIdType.setMetadata(ElementInfo.class.getName(), customerId);
         orderType.setMetadata(ElementInfo.class.getName(), order);
@@ -144,8 +152,8 @@
         inputElements.add(order);
         inputElements.add(flag);
 
-        ElementInfo statusElement =
-            new ElementInfo(new QName("", "status"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("string"));
+        ElementInfo statusElement = new ElementInfo(new QName("", "status"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES
+            .get("string"));
 
         statusType.setMetadata(ElementInfo.class.getName(), statusElement);
         statusType.setOperation(op);
@@ -153,14 +161,14 @@
         List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
         outputElements.add(statusElement);
 
-        ElementInfo outputElement =
-            new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatusResponse"), new TypeInfo(null, false, null));
+        ElementInfo outputElement = new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatusResponse"),
+                                                    new TypeInfo(null, false, null));
 
         responseType.setMetadata(ElementInfo.class.getName(), inputElement);
         responseType.setOperation(op);
 
-        WrapperInfo wrapperInfo =
-            new WrapperInfo(DOMDataBinding.NAME, inputElement, outputElement, inputElements, outputElements);
+        WrapperInfo wrapperInfo = new WrapperInfo(DOMDataBinding.NAME, inputElement, outputElement, inputElements,
+                                                  outputElements);
         op.setWrapper(wrapperInfo);
         op.setDataBinding(DOMDataBinding.NAME);
 
@@ -180,12 +188,13 @@
         t.setMediator(m);
 
         TransformationContext context = new TransformationContextImpl();
+        context.setSourceOperation(op);
         List<DataType<Class>> types = new ArrayList<DataType<Class>>();
-        types.add(new DataType<Class>(Object.class.getName(), String.class, String.class));
-        types.add(new DataType<Class>("java.lang.String", String.class, String.class));
-        types.add(new DataType<Class>(Object.class.getName(), int.class, int.class));
-        DataType<List<DataType<Class>>> inputType1 =
-            new DataType<List<DataType<Class>>>(IDL_INPUT, Object[].class, types);
+        types.add(new DataTypeImpl<Class>(Object.class.getName(), String.class, String.class));
+        types.add(new DataTypeImpl<Class>("java.lang.String", String.class, String.class));
+        types.add(new DataTypeImpl<Class>(Object.class.getName(), int.class, int.class));
+        DataType<List<DataType<Class>>> inputType1 = new DataTypeImpl<List<DataType<Class>>>(IDL_INPUT, Object[].class,
+                                                                                             types);
         context.setSourceDataType(inputType1);
         context.setTargetDataType(op.getInputType());
         Object[] results = t.transform(source, context);
@@ -196,18 +205,17 @@
         assertEquals("checkOrderStatus", element.getLocalName());
 
         TransformationContext context1 = new TransformationContextImpl();
-        DataType<DataType> sourceType = new DataType<DataType>(IDL_OUTPUT, Object.class, op.getOutputType());
-        sourceType.setOperation(op.getOutputType().getOperation());
+        DataType<DataType> sourceType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class, op.getOutputType());
 
         context1.setSourceDataType(sourceType);
-        DataType<DataType> targetType =
-            new DataType<DataType>(IDL_OUTPUT, Object.class, new DataType<Class>("java.lang.Object", String.class,
-                                                                                 String.class));
+        DataType<DataType> targetType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class,
+                                                                   new DataTypeImpl<Class>("java.lang.Object",
+                                                                                           String.class, String.class));
         context1.setTargetDataType(targetType);
 
         Document factory = DOMHelper.newDocument();
-        Element responseElement =
-            factory.createElementNS("http://example.com/order.wsdl", "p:checkOrderStatusResponse");
+        Element responseElement = factory
+            .createElementNS("http://example.com/order.wsdl", "p:checkOrderStatusResponse");
         Element status = factory.createElement("status");
         responseElement.appendChild(status);
         status.appendChild(factory.createTextNode("shipped"));

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingInterceptorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingInterceptorTestCase.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingInterceptorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingInterceptorTestCase.java Wed Apr 11 23:26:30 2007
@@ -19,7 +19,6 @@
 
 package org.apache.tuscany.core.databinding.wire;
 
-import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
@@ -33,13 +32,14 @@
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.tuscany.core.databinding.wire.DataBindingInteceptor;
+import org.apache.tuscany.interfacedef.DataType;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.interfacedef.impl.OperationImpl;
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.component.ComponentManager;
 import org.apache.tuscany.spi.databinding.DataBinding;
 import org.apache.tuscany.spi.databinding.Mediator;
-import org.apache.tuscany.spi.model.DataType;
-import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.wire.Interceptor;
 import org.apache.tuscany.spi.wire.Message;
 import org.apache.tuscany.spi.wire.Wire;
@@ -52,26 +52,23 @@
 
     @SuppressWarnings("unchecked")
     public final void testInvoke() {
-        DataType<Class> type1 = new DataType<Class>("xml:string", String.class, String.class);
-        List<DataType<Class>> types1 = new ArrayList<DataType<Class>>();
+        DataType<Class> type1 = new DataTypeImpl<Class>("xml:string", String.class, String.class);
+        List<DataType> types1 = new ArrayList<DataType>();
         types1.add(type1);
-        DataType<List<DataType<Class>>> inputType1 =
-            new DataType<List<DataType<Class>>>("xml:string", Object[].class, types1);
+        DataType<List<DataType>> inputType1 = new DataTypeImpl<List<DataType>>("xml:string", Object[].class, types1);
 
-        DataType<Class> type2 = new DataType<Class>("foo", Foo.class, Foo.class);
-        List<DataType<Class>> types2 = new ArrayList<DataType<Class>>();
+        DataType<Class> type2 = new DataTypeImpl<Class>("foo", Foo.class, Foo.class);
+        List<DataType> types2 = new ArrayList<DataType>();
         types2.add(type2);
-        DataType<List<DataType<Class>>> inputType2 = new DataType<List<DataType<Class>>>("foo", Object[].class, types2);
+        DataType<List<DataType>> inputType2 = new DataTypeImpl<List<DataType>>("foo", Object[].class, types2);
 
-        Operation<Class> operation1 =
-            new Operation<Class>("call", inputType1, type1, null, false, "xml:string", NO_CONVERSATION);
-        Operation<Class> operation2 =
-            new Operation<Class>("call", inputType2, type2, null, false, "org.w3c.dom.Node", NO_CONVERSATION);
-
-        DataType<DataType> outputType1 =
-            new DataType<DataType>(DataBinding.IDL_OUTPUT, Object.class, operation1.getOutputType());
-        DataType<DataType> outputType2 =
-            new DataType<DataType>(DataBinding.IDL_OUTPUT, Object.class, operation2.getOutputType());
+        Operation operation1 = new OperationImpl("call", inputType1, type1, null);
+        Operation operation2 = new OperationImpl("call", inputType2, type2, null);
+
+        DataType<DataType> outputType1 = new DataTypeImpl<DataType>(DataBinding.IDL_OUTPUT, Object.class, operation1
+            .getOutputType());
+        DataType<DataType> outputType2 = new DataTypeImpl<DataType>(DataBinding.IDL_OUTPUT, Object.class, operation2
+            .getOutputType());
 
         Component component = EasyMock.createMock(Component.class);
         ComponentManager componentManager = createMock(ComponentManager.class);

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorOptimizationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorOptimizationTestCase.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorOptimizationTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorOptimizationTestCase.java Wed Apr 11 23:26:30 2007
@@ -22,30 +22,30 @@
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 
-import java.lang.reflect.Type;
 import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.core.databinding.wire.DataBindingWirePostProcessor;
 import org.apache.tuscany.databinding.impl.MediatorImpl;
+import org.apache.tuscany.interfacedef.InterfaceContract;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.interfacedef.java.impl.JavaInterfaceContractImpl;
+import org.apache.tuscany.interfacedef.java.impl.JavaInterfaceImpl;
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.component.ComponentManager;
 import org.apache.tuscany.spi.databinding.Mediator;
-import org.apache.tuscany.spi.idl.java.JavaServiceContract;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.util.UriHelper;
 import org.apache.tuscany.spi.wire.InvocationChain;
 import org.apache.tuscany.spi.wire.Wire;
 import org.easymock.EasyMock;
 
 /**
- * Verifies that data binding interceptor is not added to invocation chains when the data binding types are not set on
- * service contracts
- *
+ * Verifies that data binding interceptor is not added to invocation chains when
+ * the data binding types are not set on service contracts
+ * 
  * @version $Rev$ $Date$
  */
 public class DataBindingWirePostProcessorOptimizationTestCase extends TestCase {
@@ -61,7 +61,7 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        
+
         URI sourceUri = URI.create("/componentA/#ref1");
         URI targetUri = URI.create("/componentB/#svc1");
 
@@ -71,21 +71,20 @@
         Component component = createMock(Component.class);
         expect(componentManager.getComponent(UriHelper.getDefragmentedName(sourceUri))).andReturn(component);
         expect(componentManager.getComponent(UriHelper.getDefragmentedName(targetUri))).andReturn(component);
-        
+
         replay(component, componentManager);
         processor = new DataBindingWirePostProcessor(componentManager, mediator);
 
-        ServiceContract<Type> contract = new JavaServiceContract(null);
-        Operation<Type> operation = new Operation<Type>("test", null, null, null);
-        operation.setServiceContract(contract);
-        Map<String, Operation<Type>> operations = new HashMap<String, Operation<Type>>();
-        operations.put("test", operation);
-        contract.setOperations(operations);
-        contract.setCallbackOperations(operations);
+        InterfaceContract contract = new JavaInterfaceContractImpl();
+        contract.setInterface(new JavaInterfaceImpl());
+        contract.setCallbackInterface(new JavaInterfaceImpl());
+        Operation operation = new OperationImpl("test", null, null, null);
+        contract.getInterface().getOperations().add(operation);
+        contract.getCallbackInterface().getOperations().add(operation);
 
         chain = createMock(InvocationChain.class);
         replay(chain);
-        Map<Operation<?>, InvocationChain> chains = new HashMap<Operation<?>, InvocationChain>();
+        Map<Operation, InvocationChain> chains = new HashMap<Operation, InvocationChain>();
         chains.put(operation, chain);
 
         wire = EasyMock.createMock(Wire.class);

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorTestCase.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/wire/DataBindingWirePostProcessorTestCase.java Wed Apr 11 23:26:30 2007
@@ -33,17 +33,18 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.core.databinding.processor.DataBindingJavaInterfaceIntrospector;
-import org.apache.tuscany.core.databinding.wire.DataBindingWirePostProcessor;
 import org.apache.tuscany.databinding.xml.DOMDataBinding;
 import org.apache.tuscany.databinding.xml.StAXDataBinding;
+import org.apache.tuscany.interfacedef.InterfaceContract;
+import org.apache.tuscany.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.java.JavaInterface;
+import org.apache.tuscany.interfacedef.java.impl.JavaInterfaceContractImpl;
+import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.component.ComponentManager;
 import org.apache.tuscany.spi.component.ReferenceBinding;
 import org.apache.tuscany.spi.databinding.Mediator;
-import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.util.UriHelper;
 import org.apache.tuscany.spi.wire.Interceptor;
 import org.apache.tuscany.spi.wire.InvocationChain;
@@ -138,20 +139,25 @@
         processor.process(wire);
     }
 
-    private Wire createWire(URI sourceUri, URI targetUri, QName bindingType) throws InvalidServiceContractException {
-        ServiceContract<?> contract1 = new DataBindingJavaInterfaceIntrospector().introspect(TestInterface1.class);
+    private Wire createWire(URI sourceUri, URI targetUri, QName bindingType) throws InvalidInterfaceException {
+        DefaultJavaInterfaceIntrospector introspector = new DefaultJavaInterfaceIntrospector();
+        JavaInterface interface1 = introspector.introspect(TestInterface1.class);
+        InterfaceContract contract1 = new JavaInterfaceContractImpl();
+        contract1.setInterface(interface1);
         contract1.setDataBinding(DOMDataBinding.NAME);
-        ServiceContract<?> contract2 = new DataBindingJavaInterfaceIntrospector().introspect(TestInterface2.class);
+        JavaInterface interface2 = introspector.introspect(TestInterface2.class);
+        InterfaceContract contract2 = new JavaInterfaceContractImpl();
+        contract2.setInterface(interface2);
         contract2.setDataBinding(StAXDataBinding.NAME);
-        Map<Operation<?>, InvocationChain> chains = new HashMap<Operation<?>, InvocationChain>();
-        for (Operation<?> op : contract1.getOperations().values()) {
+        Map<Operation, InvocationChain> chains = new HashMap<Operation, InvocationChain>();
+        for (Operation op : interface1.getOperations()) {
             InvocationChain chain = createMock(InvocationChain.class);
             chain.addInterceptor(EasyMock.anyInt(), EasyMock.isA(Interceptor.class));
             replay(chain);
             chains.put(op, chain);
         }        
-        Map<Operation<?>, InvocationChain> callbackChains = new HashMap<Operation<?>, InvocationChain>();
-        for (Operation<?> op : contract1.getCallbackOperations().values()) {
+        Map<Operation, InvocationChain> callbackChains = new HashMap<Operation, InvocationChain>();
+        for (Operation op : interface1.getOperations()) {
             InvocationChain chain = createMock(InvocationChain.class);
             chain.addInterceptor(EasyMock.anyInt(), EasyMock.isA(Interceptor.class));
             replay(chain);

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/extension/TargetInvokerExtension.java Wed Apr 11 23:26:30 2007
@@ -21,15 +21,18 @@
 import java.lang.reflect.InvocationTargetException;
 import java.net.URI;
 import java.util.LinkedList;
+import java.util.List;
 
+import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.wire.InvocationChain;
 import org.apache.tuscany.spi.wire.InvocationRuntimeException;
 import org.apache.tuscany.spi.wire.Message;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 
 /**
  * The default implementation of a TargetInvoker
- *
+ * 
  * @version $Rev$ $Date$
  */
 public abstract class TargetInvokerExtension implements TargetInvoker {
@@ -70,9 +73,19 @@
         try {
             return super.clone();
         } catch (CloneNotSupportedException e) {
-            // TargetInvoker extends Cloneable so this should not have been thrown
+            // TargetInvoker extends Cloneable so this should not have been
+            // thrown
             throw new AssertionError(e);
         }
+    }
+
+    protected InvocationChain getInvocationChain(List<InvocationChain> chains, Operation targetOperation) {
+        for (InvocationChain chain : chains) {
+            if (chain.getTargetOperation() == targetOperation) {
+                return chain;
+            }
+        }
+        return null;
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/AbstractInvocationHandler.java Wed Apr 11 23:26:30 2007
@@ -56,7 +56,7 @@
                 // short-circuit the dispatch and invoke the target directly
                 TargetInvoker targetInvoker = chain.getTargetInvoker();
                 if (targetInvoker == null) {
-                    String name = chain.getOperation().getName();
+                    String name = chain.getTargetOperation().getName();
                     throw new AssertionError("No target invoker [" + name + "]");
                 }
                 return targetInvoker.invokeTarget(args, TargetInvoker.NONE, workContext);
@@ -70,10 +70,10 @@
             msg.setTargetInvoker(invoker);
             msg.setCorrelationId(workContext.getCorrelationId());
             msg.setCallbackUris(workContext.getCallbackUris());
-            Operation operation = chain.getOperation();
+            Operation operation = chain.getTargetOperation();
             Interface contract = operation.getInterface();
             if (contract != null && contract.isConversational()) {
-                Operation.ConversationSequence sequence = chain.getOperation().getConversationSequence();
+                Operation.ConversationSequence sequence = chain.getTargetOperation().getConversationSequence();
                 if (sequence == Operation.ConversationSequence.CONVERSATION_END) {
                     msg.setConversationSequence(TargetInvoker.END);
                     conversationStarted = false;
@@ -111,7 +111,7 @@
         if (callbackWires != null) {
             msg.setCallbackWires(callbackWires);
         }
-        Operation operation = chain.getOperation();
+        Operation operation = chain.getTargetOperation();
         if (conversational) {
             Operation.ConversationSequence sequence = operation.getConversationSequence();
             if (sequence == Operation.ConversationSequence.CONVERSATION_END) {

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java Wed Apr 11 23:26:30 2007
@@ -43,7 +43,14 @@
      *
      * @return the target operation for this invocation chain
      */
-    Operation getOperation();
+    Operation getTargetOperation();
+    
+    /**
+     * Returns the source operation for this invocation chain.
+     *
+     * @return the source operation for this invocation chain
+     */    
+    Operation getSourceOperation();
 
     /**
      * Sets the target invoker to pass down the chain

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java Wed Apr 11 23:26:30 2007
@@ -19,154 +19,148 @@
 package org.apache.tuscany.spi.wire;
 
 import java.net.URI;
-import java.util.Map;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 
 import org.apache.tuscany.interfacedef.InterfaceContract;
-import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.TargetResolutionException;
 
 /**
  * The base wire type used to connect references and serviceBindings
- *
- * @version $$Rev$$ $$Date$$
+ * 
+ * @version $$Rev$$ $$Date: 2007-04-11 16:50:20 -0700 (Wed, 11 Apr
+ *          2007) $$
  */
 public interface Wire {
     QName LOCAL_BINDING = new QName("http://tuscany.apache.org/xmlns/sca/binding/1.0", "binding.local");
 
     /**
      * Returns the URI of the wire source
-     *
+     * 
      * @return the wire source URI
      */
     URI getSourceUri();
 
     /**
      * Sets the URI of the wire source
-     *
+     * 
      * @param uri the source uri
      */
     void setSourceUri(URI uri);
 
     /**
      * Returns the URI of the wire target
-     *
+     * 
      * @return the URI of the wire target
      */
     URI getTargetUri();
 
     /**
      * Sets the URI of the wire target
-     *
+     * 
      * @param uri the URI of the wire target
      */
     void setTargetUri(URI uri);
 
     /**
      * Returns the wire binding type
-     *
+     * 
      * @return the wire binding type
      */
     QName getBindingType();
 
     /**
-     * Returns the service contract associated with the the source side of the wire
-     *
+     * Returns the service contract associated with the the source side of the
+     * wire
+     * 
      * @return the service contract associated with the wire
-     * @Deprecated
      */
     InterfaceContract getSourceContract();
 
     /**
      * Sets the contract associated with the source side of the wire
-     *
+     * 
      * @param contract the contract associated with the wire
-     * @Deprecated
      */
     void setSourceContract(InterfaceContract contract);
 
     /**
-     * Returns the service contract associated with the the target side of the wire
-     *
+     * Returns the service contract associated with the the target side of the
+     * wire
+     * 
      * @return the service contract associated with the wire
-     * @Deprecated
      */
     InterfaceContract getTargetContract();
 
     /**
      * Sets the contract associated with the the target side of the wire
-     *
+     * 
      * @param contract the contract associated with the wire
-     * @Deprecated
      */
     void setTargetContract(InterfaceContract contract);
 
     /**
-     * Returns true if the wire is optimizable and its invocation chains may be bypassed
-     *
-     * @return true if the wire is optimizable and its invocation chains may be bypassed
-     * @Deprecated
+     * Returns true if the wire is optimizable and its invocation chains may be
+     * bypassed
+     * 
+     * @return true if the wire is optimizable and its invocation chains may be
+     *         bypassed
      */
     boolean isOptimizable();
 
     /**
      * Determines if the wire may be optimized
-     *
+     * 
      * @param optimizable true if the wire is optimizable
-     * @Deprecated
      */
     void setOptimizable(boolean optimizable);
 
     /**
      * Returns the non-proxied target instance for this wire
-     *
+     * 
      * @return the non-proxied target instance for this wire
-     * @Deprecated
      */
     Object getTargetInstance() throws TargetResolutionException;
 
     /**
      * Sets the target for the wire for optimizations
-     *
+     * 
      * @param target the target for the wire
-     * @Deprecated
      */
     void setTarget(AtomicComponent target);
 
     /**
-     * Returns the invocation chains for service operations associated with the wire
-     *
-     * @return the invocation chains for service operations associated with the wire
-     * @Deprecated
+     * Returns the invocation chains for service operations associated with the
+     * wire
+     * 
+     * @return the invocation chains for service operations associated with the
+     *         wire
      */
-    Map<Operation, InvocationChain> getInvocationChains();
+    List<InvocationChain> getInvocationChains();
 
     /**
      * Adds the invocation chain associated with the given operation
-     *
-     * @param operation the service operation
-     * @param chain     the invocation chain
-     * @Deprecated
+     * 
+     * @param chain the invocation chain
      */
-    void addInvocationChain(Operation operation, InvocationChain chain);
+    void addInvocationChain(InvocationChain chain);
 
     /**
-     * Returns the invocation chains for callback service operations associated with the wire
-     *
-     * @return the invocation chains for callback service operations associated with the wire
-     * @Deprecated
+     * Returns the invocation chains for callback service operations associated
+     * with the wire
+     * 
+     * @return the invocation chains for callback service operations associated
+     *         with the wire
      */
-    Map<Operation, InvocationChain> getCallbackInvocationChains();
+    List<InvocationChain> getCallbackInvocationChains();
 
     /**
      * Adds the callback invocation chain associated with the given operation
-     *
-     * @param operation the service operation
-     * @param chain     the invocation chain
-     * @Deprecated
+     * 
+     * @param chain the invocation chain
      */
-    void addCallbackInvocationChain(Operation operation, InvocationChain chain);
+    void addCallbackInvocationChain(InvocationChain chain);
 
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/AbstractLocalTargetInvoker.java Wed Apr 11 23:26:30 2007
@@ -26,13 +26,14 @@
 import org.apache.tuscany.spi.wire.Message;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.TargetInvokerExtension;
 
 /**
  * Base class for dispatching to a composite reference using the local binding
  *
  * @version $Rev$ $Date$
  */
-public abstract class AbstractLocalTargetInvoker implements TargetInvoker {
+public abstract class AbstractLocalTargetInvoker extends TargetInvokerExtension implements TargetInvoker {
     protected boolean cacheable;
 
     public boolean isCacheable() {
@@ -57,7 +58,7 @@
             try {
                 // short-circuit the dispatch and invoke the target directly
                 if (invoker == null) {
-                    String name = chain.getOperation().getName();
+                    String name = chain.getTargetOperation().getName();
                     throw new AssertionError("No target invoker [" + name + "]");
                 }
                 return invoker.invoke(msg);

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvoker.java Wed Apr 11 23:26:30 2007
@@ -18,7 +18,7 @@
  */
 package org.apache.tuscany.core.binding.local;
 
-import java.util.Map;
+import java.util.List;
 
 import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.spi.wire.InvocationChain;
@@ -30,7 +30,7 @@
 
 /**
  * Dispatches a callback invocation to the callback instance
- *
+ * 
  * @version $Rev$ $Date$
  */
 public class LocalCallbackTargetInvoker extends AbstractLocalTargetInvoker {
@@ -54,16 +54,16 @@
     }
 
     private Message invoke(Operation operation, Message msg) throws Throwable {
-        //TODO optimize as this is slow in local invocations
-        Map<Operation, InvocationChain> chains = wire.getCallbackInvocationChains();
-        InvocationChain chain = chains.get(operation);
+        // TODO optimize as this is slow in local invocations
+        List<InvocationChain> chains = wire.getCallbackInvocationChains();
+        InvocationChain chain = getInvocationChain(chains, operation);
         TargetInvoker invoker = chain.getTargetInvoker();
         return invoke(chain, invoker, msg);
     }
 
     @Override
     public LocalCallbackTargetInvoker clone() throws CloneNotSupportedException {
-        return (LocalCallbackTargetInvoker) super.clone();
+        return (LocalCallbackTargetInvoker)super.clone();
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/binding/local/LocalTargetInvoker.java Wed Apr 11 23:26:30 2007
@@ -30,8 +30,9 @@
 import org.apache.tuscany.spi.wire.Wire;
 
 /**
- * Dispatches an invocation through a composite service or reference using the local binding
- *
+ * Dispatches an invocation through a composite service or reference using the
+ * local binding
+ * 
  * @version $Rev$ $Date$
  */
 public class LocalTargetInvoker extends AbstractLocalTargetInvoker {
@@ -41,7 +42,7 @@
 
     public LocalTargetInvoker(Operation operation, Wire wire) {
         assert operation != null;
-        chain = wire.getInvocationChains().get(operation);
+        chain = getInvocationChain(wire.getInvocationChains(), operation);
         assert chain != null;
         if (wire.getSourceUri() != null) {
             fromAddress = URI.create(UriHelper.getBaseName(wire.getSourceUri()));
@@ -51,16 +52,17 @@
 
     @Override
     public LocalTargetInvoker clone() throws CloneNotSupportedException {
-        return (LocalTargetInvoker) super.clone();
+        return (LocalTargetInvoker)super.clone();
     }
 
     public Message invoke(Message msg) throws InvocationRuntimeException {
         try {
             TargetInvoker invoker = chain.getTargetInvoker();
             assert invoker != null;
-            // Pushing the from address only needs to happen in the outbound (forward) direction for callbacks
+            // Pushing the from address only needs to happen in the outbound
+            // (forward) direction for callbacks
             if (contractHasCallback) {
-                //JFM do we need this?
+                // JFM do we need this?
                 msg.pushCallbackUri(fromAddress);
             }
 
@@ -71,7 +73,6 @@
             return faultMsg;
         }
     }
-
 
     public boolean isOptimizable() {
         return true;

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java Wed Apr 11 23:26:30 2007
@@ -181,7 +181,8 @@
                     throw new ComponentNotFoundException("Target not found", targetUri);
                 }
                 URI sourceURI = URI.create(source.getUri() + "#" + refName);
-                Wire wire = createWire(sourceURI, targetUri, refDefinition.getInterfaceContract(), Wire.LOCAL_BINDING);
+                Wire wire = createWire(sourceURI, targetUri, refDefinition.getInterfaceContract(), service
+                    .getInterfaceContract(), Wire.LOCAL_BINDING);
                 try {
                     attachInvokers(refName, wire, source, target);
                 } catch (TargetInvokerCreationException e) {
@@ -218,31 +219,35 @@
         return source;
     }
 
-    protected Wire createWire(URI sourceURI, URI targetUri, InterfaceContract contract, QName bindingType) {
+    protected Wire createWire(URI sourceURI,
+                              URI targetUri,
+                              InterfaceContract sourceContract,
+                              InterfaceContract targetContract,
+                              QName bindingType) {
         Wire wire = new WireImpl(bindingType);
-        wire.setSourceContract(contract);
-        wire.setTargetContract(contract);
+        wire.setSourceContract(sourceContract);
+        wire.setTargetContract(targetContract);
         wire.setSourceUri(sourceURI);
         wire.setTargetUri(targetUri);
-        for (Operation operation : contract.getInterface().getOperations()) {
+        for (Operation operation : sourceContract.getInterface().getOperations()) {
             InvocationChain chain = new InvocationChainImpl(operation);
             /*
              * if (operation.isNonBlocking()) { chain.addInterceptor(new
              * NonBlockingInterceptor(scheduler, workContext)); }
              */
             chain.addInterceptor(new InvokerInterceptor());
-            wire.addInvocationChain(operation, chain);
+            wire.addInvocationChain(chain);
 
         }
-        if (contract.getCallbackInterface() != null) {
-            for (Operation operation : contract.getCallbackInterface().getOperations()) {
+        if (sourceContract.getCallbackInterface() != null) {
+            for (Operation operation : sourceContract.getCallbackInterface().getOperations()) {
                 InvocationChain chain = new InvocationChainImpl(operation);
                 /*
                  * if (operation.isNonBlocking()) { chain.addInterceptor(new
                  * NonBlockingInterceptor(scheduler, workContext)); }
                  */
                 chain.addInterceptor(new InvokerInterceptor());
-                wire.addCallbackInvocationChain(operation, chain);
+                wire.addCallbackInvocationChain(chain);
             }
         }
         return wire;
@@ -252,11 +257,11 @@
         throws TargetInvokerCreationException {
         // TODO section will deleted be replaced when we cut-over to the
         // physical marshallers
-        for (InvocationChain chain : wire.getInvocationChains().values()) {
-            chain.setTargetInvoker(target.createTargetInvoker(name, chain.getOperation(), false));
+        for (InvocationChain chain : wire.getInvocationChains()) {
+            chain.setTargetInvoker(target.createTargetInvoker(name, chain.getTargetOperation(), false));
         }
-        for (InvocationChain chain : wire.getCallbackInvocationChains().values()) {
-            chain.setTargetInvoker(source.createTargetInvoker(null, chain.getOperation(), true));
+        for (InvocationChain chain : wire.getCallbackInvocationChains()) {
+            chain.setTargetInvoker(source.createTargetInvoker(null, chain.getTargetOperation(), true));
         }
     }
 

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java Wed Apr 11 23:26:30 2007
@@ -25,22 +25,31 @@
 
 /**
  * Default implementation of an invocation chain
- *
+ * 
  * @version $Rev$ $Date$
  */
 public class InvocationChainImpl implements InvocationChain {
-    protected Operation operation;
+    protected Operation sourceOperation;
+    protected Operation targetOperation;
     protected TargetInvoker targetInvoker;
     protected Interceptor interceptorChainHead;
     protected Interceptor interceptorChainTail;
 
     public InvocationChainImpl(Operation operation) {
         assert operation != null;
-        this.operation = operation;
+        this.targetOperation = operation;
+        this.sourceOperation = operation;
     }
 
-    public Operation getOperation() {
-        return operation;
+    public InvocationChainImpl(Operation sourceOperation, Operation targetOperation) {
+        assert sourceOperation != null;
+        assert targetOperation != null;
+        this.targetOperation = targetOperation;
+        this.sourceOperation = sourceOperation;
+    }
+
+    public Operation getTargetOperation() {
+        return targetOperation;
     }
 
     public void setTargetInvoker(TargetInvoker invoker) {
@@ -90,6 +99,20 @@
 
     public Interceptor getTailInterceptor() {
         return interceptorChainTail;
+    }
+
+    /**
+     * @return the sourceOperation
+     */
+    public Operation getSourceOperation() {
+        return sourceOperation;
+    }
+
+    /**
+     * @param sourceOperation the sourceOperation to set
+     */
+    public void setSourceOperation(Operation sourceOperation) {
+        this.sourceOperation = sourceOperation;
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireImpl.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireImpl.java Wed Apr 11 23:26:30 2007
@@ -19,8 +19,10 @@
 package org.apache.tuscany.core.wire;
 
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
@@ -44,8 +46,8 @@
     private InterfaceContract sourceContract;
     private InterfaceContract targetContract;
     private boolean optimizable;
-    private Map<Operation, InvocationChain> chains = new HashMap<Operation, InvocationChain>();
-    private Map<Operation, InvocationChain> callbackChains = new HashMap<Operation, InvocationChain>();
+    private List<InvocationChain> chains = new ArrayList<InvocationChain>();
+    private List<InvocationChain> callbackChains = new ArrayList<InvocationChain>();
     private AtomicComponent target;
 
     /**
@@ -120,20 +122,20 @@
         this.target = target;
     }
 
-    public Map<Operation, InvocationChain> getInvocationChains() {
-        return Collections.unmodifiableMap(chains);
+    public List<InvocationChain> getInvocationChains() {
+        return Collections.unmodifiableList(chains);
     }
 
-    public void addInvocationChain(Operation operation, InvocationChain chain) {
-        chains.put(operation, chain);
+    public void addInvocationChain(InvocationChain chain) {
+        chains.add(chain);
     }
 
-    public Map<Operation, InvocationChain> getCallbackInvocationChains() {
-        return Collections.unmodifiableMap(callbackChains);
+    public List<InvocationChain> getCallbackInvocationChains() {
+        return Collections.unmodifiableList(callbackChains);
     }
 
-    public void addCallbackInvocationChain(Operation operation, InvocationChain chain) {
-        callbackChains.put(operation, chain);
+    public void addCallbackInvocationChain(InvocationChain chain) {
+        callbackChains.add(chain);
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/wire/WireUtils.java Wed Apr 11 23:26:30 2007
@@ -20,6 +20,7 @@
 
 import java.lang.reflect.Method;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.tuscany.interfacedef.Operation;
@@ -51,14 +52,14 @@
      */
     public static Map<Method, ChainHolder> createInterfaceToWireMapping(Class<?> interfaze, Wire wire)
         throws NoMethodForOperationException {
-        Map<Operation, InvocationChain> invocationChains = wire.getInvocationChains();
+        List<InvocationChain> invocationChains = wire.getInvocationChains();
 
         Map<Method, ChainHolder> chains = new HashMap<Method, ChainHolder>(invocationChains.size());
-        for (Map.Entry<Operation, InvocationChain> entry : invocationChains.entrySet()) {
-            Operation operation = entry.getKey();
+        for (InvocationChain chain : invocationChains) {
+            Operation operation = chain.getTargetOperation();
             try {
                 Method method = JavaInterfaceUtil.findMethod(interfaze, operation);
-                chains.put(method, new ChainHolder(entry.getValue()));
+                chains.put(method, new ChainHolder(chain));
             } catch (NoSuchMethodException e) {
                 throw new NoMethodForOperationException(operation.getName());
             }
@@ -74,7 +75,7 @@
      * @return true if the wire is optimizable
      */
     public static boolean isOptimizable(Wire wire) {
-        for (InvocationChain chain : wire.getInvocationChains().values()) {
+        for (InvocationChain chain : wire.getInvocationChains()) {
             if (chain.getHeadInterceptor() != null) {
                 Interceptor current = chain.getHeadInterceptor();
                 if (current == null) {

Modified: incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java?view=diff&rev=527788&r1=527787&r2=527788
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/binding/local/LocalCallbackTargetInvokerInvocationExceptionTestCase.java Wed Apr 11 23:26:30 2007
@@ -46,7 +46,7 @@
         InvocationChain chain = new InvocationChainImpl(operation);
         chain.addInterceptor(head);
         Wire wire = new WireImpl();
-        wire.addCallbackInvocationChain(operation, chain);
+        wire.addCallbackInvocationChain(chain);
         LocalCallbackTargetInvoker invoker = new LocalCallbackTargetInvoker(operation, wire);
         Message msg = new MessageImpl();
         msg.setBody("foo");



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