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/09/08 23:37:45 UTC

svn commit: r441661 [2/2] - in /incubator/tuscany/java/sca: databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/ databinding/databinding-axiom/src/main/resources/ databinding/databinding-axiom/src/main/resources/META-INF/ d...

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/InvocationChainImpl.java Fri Sep  8 14:37:43 2006
@@ -28,26 +28,34 @@
 import org.apache.tuscany.spi.wire.MessageHandler;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 
-
 /**
  * Contains functionality common to source- and target- side invocation chains
- *
+ * 
  * @version $Rev$ $Date$
  */
 public abstract class InvocationChainImpl implements InvocationChain {
     protected Operation operation;
+
     protected TargetInvoker targetInvoker;
+
     protected Interceptor interceptorChainHead;
+
     protected Interceptor interceptorChainTail;
+
     protected List<MessageHandler> requestHandlers;
+
     protected List<MessageHandler> responseHandlers;
+
     protected MessageChannel requestChannel;
+
     protected MessageChannel responseChannel;
 
     // the pointer to a bridged target request channel, or null if the target has an interceptor
     protected MessageChannel targetRequestChannel;
+
     // the pointer to a bridged target response channel, or null if the target has an interceptor
     protected MessageChannel targetResponseChannel;
+
     // the pointer to a bridged target head interceptor or null if the target has no interceptors
     protected Interceptor targetInterceptorChainHead;
 
@@ -85,6 +93,30 @@
         interceptorChainTail = interceptor;
     }
 
+    public void addInterceptor(int index, Interceptor interceptor) {
+        int i = 0;
+        Interceptor next = interceptorChainHead;
+        Interceptor prev = null;
+        while (next != null && i < index) {
+            prev = next;
+            next = next.getNext();
+            i++;
+        }
+        if (i == index) {
+            if (prev != null) {
+                prev.setNext(interceptor);
+            } else {
+                interceptorChainHead = interceptor;
+            }
+            interceptor.setNext(next);
+            if (next == null) {
+                interceptorChainTail = interceptor;
+            }
+        } else {
+            throw new ArrayIndexOutOfBoundsException(index);
+        }
+    }
+
     public Interceptor getHeadInterceptor() {
         return interceptorChainHead;
     }
@@ -140,6 +172,5 @@
     public Interceptor getTargetInterceptor() {
         return targetInterceptorChainHead;
     }
-
 
 }

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=441661&r1=441660&r2=441661
==============================================================================
--- 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 Fri Sep  8 14:37:43 2006
@@ -231,7 +231,7 @@
         Class<?> callbackInterface = contract.getCallbackClass();
         if (callbackInterface != null) {
             wire.setCallbackInterface(callbackInterface);
-            for (Operation<?> operation : contract.getCallbacksOperations().values()) {
+            for (Operation<?> operation : contract.getCallbackOperations().values()) {
                 InboundInvocationChain callbackTargetChain = createInboundChain(operation);
                 // TODO handle policy
                 //TODO statement below could be cleaner
@@ -278,5 +278,58 @@
         service.setInboundWire(inboundWire);
         service.setOutboundWire(outboundWire);
     }
+
+    public boolean isWireable(ServiceContract<?> source, ServiceContract<?> target) {
+        if (source == target) {
+            // Shortcut for performance
+            return true;
+        }
+        if (source.isRemotable() != target.isRemotable()) {
+            return false;
+        }
+        if (source.getInteractionScope() != target.getInteractionScope()) {
+            return false;
+        }
+
+        for (Operation<?> operation : source.getOperations().values()) {
+            Operation<?> targetOperation = target.getOperations().get(operation.getName());
+            if (targetOperation == null) {
+                return false;
+            }
+            if (!isCompatibleWith(operation, targetOperation)) {
+                return false;
+            }
+        }
+
+        for (Operation<?> operation : source.getCallbackOperations().values()) {
+            Operation<?> targetOperation = target.getCallbackOperations().get(operation.getName());
+            if (targetOperation == null) {
+                return false;
+            }
+            if (!isCompatibleWith(operation, targetOperation)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * The following algorithm is defined the SCA spec:
+     * <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 operation
+     * @return
+     */
+    public boolean isCompatibleWith(Operation<?> source, Operation<?> target) {
+        // FIXME:
+        return source.equals(target);
+    }
+    
 
 }

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=441661&r1=441660&r2=441661
==============================================================================
--- 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 Fri Sep  8 14:37:43 2006
@@ -18,21 +18,23 @@
  */
 package org.apache.tuscany.core.builder;
 
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 
 import java.util.Collections;
 
+import junit.framework.TestCase;
+
 import org.apache.tuscany.spi.builder.WirePostProcessorRegistry;
 import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.OutboundWire;
-
-import junit.framework.TestCase;
+import org.apache.tuscany.spi.wire.WireService;
 import org.easymock.EasyMock;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 
 /**
  * @version $Rev$ $Date$
@@ -49,7 +51,11 @@
         WirePostProcessorRegistry registry = createMock(WirePostProcessorRegistry.class);
         registry.process(EasyMock.eq(iwire), EasyMock.eq(owire));
         replay(registry);
-        ConnectorImpl connector = new ConnectorImpl(registry);
+        WireService wireService = createMock(WireService.class);
+        expect(wireService.isWireable((ServiceContract<?>)EasyMock.anyObject(), 
+                (ServiceContract<?>)EasyMock.anyObject())).andReturn(true).anyTimes();
+        replay(wireService);
+        ConnectorImpl connector = new ConnectorImpl(wireService, registry);
         connector.connect(iwire, owire, false);
         verify(registry);
     }
@@ -66,10 +72,14 @@
         WirePostProcessorRegistry registry = createMock(WirePostProcessorRegistry.class);
         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();
+        replay(wireService);        
+        ConnectorImpl connector = new ConnectorImpl(wireService, registry);
         Component source = createNiceMock(Component.class);
         expect(source.getName()).andReturn("Component");
         replay(source);
-        ConnectorImpl connector = new ConnectorImpl(registry);
         connector.connect(source, null, owire, iwire, false);
         verify(registry);
     }

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=441661&r1=441660&r2=441661
==============================================================================
--- 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 Fri Sep  8 14:37:43 2006
@@ -53,11 +53,11 @@
         Operation<Type> baseInt = operations.get("baseInt");
         assertNotNull(baseInt);
 
-        DataType<Type> returnType = baseInt.getReturnType();
+        DataType<Type> returnType = baseInt.getOutputType();
         assertEquals(Integer.TYPE, returnType.getPhysical());
         assertEquals(Integer.TYPE, returnType.getLogical());
 
-        List<DataType<Type>> parameterTypes = baseInt.getParameterTypes();
+        List<DataType<Type>> parameterTypes = baseInt.getInputType().getLogical();
         assertEquals(1, parameterTypes.size());
         DataType<Type> arg0 = parameterTypes.get(0);
         assertEquals(Integer.TYPE, arg0.getPhysical());

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/idl/java/JavaIDLUtils.java Fri Sep  8 14:37:43 2006
@@ -73,14 +73,16 @@
      *
      * @return true if the operation matches, false if does not
      */
+    @SuppressWarnings("unchecked")
     private static boolean match(Operation<?> operation, Method method) {
         Class<?>[] params = method.getParameterTypes();
-        List<? extends DataType<?>> types = operation.getParameterTypes();
+        DataType inputType = operation.getInputType();
+        List<DataType<?>> types = (List<DataType<?>>) inputType.getLogical();
         boolean found = true;
         if (types.size() == params.length && method.getName().equals(operation.getName())) {
             for (int i = 0; i < params.length; i++) {
                 Class<?> clazz = params[i];
-                if (!clazz.equals(operation.getParameterTypes().get(i).getPhysical())) {
+                if (!clazz.equals(operation.getInputType().getLogical().get(i).getPhysical())) {
                     found = false;
                 }
             }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java Fri Sep  8 14:37:43 2006
@@ -123,6 +123,13 @@
         return dataBinding;
     }
 
+    /**
+     * @param dataBinding the dataBinding to set
+     */
+    public void setDataBinding(String dataBinding) {
+        this.dataBinding = dataBinding;
+    }
+
     public int hashCode() {
         int result;
         result = dataBinding != null ? dataBinding.hashCode() : 0;
@@ -149,7 +156,12 @@
             return false;
         }
         return !(physical != null ? !physical.equals(dataType.physical) : dataType.physical != null);
-
     }
-
+    
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        sb.append(physical).append(" ").append(dataBinding).append(" ").append(logical);
+        return sb.toString();
+    }
+    
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java Fri Sep  8 14:37:43 2006
@@ -23,68 +23,90 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.tuscany.spi.model.DataType;
+
 /**
  * Represents an operation that is part of a service contract. The type paramter of this operation identifies the
  * logical type system for all data types.
- *
+ * 
  * @version $Rev$ $Date$
  */
 public class Operation<T> {
     protected Map<String, Object> metaData;
+
     private final String name;
-    private final DataType<T> returnType;
-    private final List<DataType<T>> parameterTypes;
+
+    private final DataType<T> outputType;
+
+    private final DataType<List<DataType<T>>> inputType;
+
     private final List<DataType<T>> faultTypes;
-    private final boolean nonBlocking;
-    private ServiceContract<?> contract;
+
+    private boolean nonBlocking;
+
+    private ServiceContract<T> contract;
+
     private boolean callback;
+
     private String dataBinding;
 
     /**
      * Construct an operation specifying all characteristics.
-     *
-     * @param name           the name of the operation
-     * @param returnType     the data type returned by the operation
-     * @param parameterTypes the data types of parameters passed to the operation
-     * @param faultTypes     the data type of faults raised by the operation
-     * @param nonBlocking    true if the operation is non-blocking
-     * @param dataBinding    the data binding type for the operation
-     */
-    public Operation(String name,
-                     DataType<T> returnType,
-                     List<DataType<T>> parameterTypes,
-                     List<DataType<T>> faultTypes,
-                     boolean nonBlocking,
-                     String dataBinding) {
+     * 
+     * @param name the name of the operation
+     * @param outputType the data type returned by the operation
+     * @param inputType the data types of parameters passed to the operation
+     * @param faultTypes the data type of faults raised by the operation
+     * @param nonBlocking true if the operation is non-blocking
+     * @param dataBinding the data binding type for the operation
+     */
+    public Operation(String name, DataType<List<DataType<T>>> inputType, DataType<T> outputType,
+            List<DataType<T>> faultTypes) {
+        this(name, inputType, outputType, faultTypes, true, null);
+    }
+
+    /**
+     * @param name
+     * @param inputType
+     * @param outputType
+     * @param faultTypes
+     * @param nonBlocking
+     * @param dataBinding
+     */
+    public Operation(final String name, final DataType<List<DataType<T>>> inputType, final DataType<T> outputType,
+            final List<DataType<T>> faultTypes, boolean nonBlocking, String dataBinding) {
+        super();
         this.name = name;
-        this.returnType = returnType;
-        this.parameterTypes = parameterTypes;
+        List<DataType<T>> types = Collections.emptyList();
+        this.inputType = (inputType != null) ? inputType : new DataType<List<DataType<T>>>(Object[].class, types);
+        this.outputType = (outputType != null) ? outputType : new DataType<T>(void.class, null);
         this.faultTypes = faultTypes;
         this.nonBlocking = nonBlocking;
         this.dataBinding = dataBinding;
+
     }
 
     /**
      * Returns the service contract the operation is part of.
-     *
+     * 
      * @return the service contract the operation is part of.
      */
-    public ServiceContract<?> getServiceContract() {
+    public ServiceContract<T> getServiceContract() {
         return contract;
     }
 
     /**
      * Sets the service contract the operation is part of.
-     *
+     * 
      * @param contract the service contract the operation is part of.
      */
-    public void setServiceContract(ServiceContract<?> contract) {
+    public void setServiceContract(ServiceContract<T> contract) {
         this.contract = contract;
     }
 
     /**
      * Returns true if the operation is part of the callback contract.
-     *
+     * 
      * @return true if the operation is part of the callback contract.
      */
     public boolean isCallback() {
@@ -93,7 +115,7 @@
 
     /**
      * Sets whether the operation is part of the callback contract.
-     *
+     * 
      * @param callback whether the operation is part of the callback contract.
      */
     public void setCallback(boolean callback) {
@@ -102,7 +124,7 @@
 
     /**
      * Returns the name of the operation.
-     *
+     * 
      * @return the name of the operation
      */
     public String getName() {
@@ -111,28 +133,27 @@
 
     /**
      * Returns the data type returned by the operation.
-     *
+     * 
      * @return the data type returned by the operation
      */
-    public DataType<T> getReturnType() {
-        return returnType;
+    public DataType<T> getOutputType() {
+        return outputType;
     }
 
     /**
      * Returns the data types of the parameters passed to the operation.
-     *
+     * 
+     * The inputType's logical type is a list of DataTypes which describes the parameter types
+     * 
      * @return the data types of the parameters passed to the operation
      */
-    public List<DataType<T>> getParameterTypes() {
-        if (parameterTypes == null) {
-            return Collections.emptyList();
-        }
-        return parameterTypes;
+    public DataType<List<DataType<T>>> getInputType() {
+        return inputType;
     }
 
     /**
      * Returns the data types of the faults raised by the operation.
-     *
+     * 
      * @return the data types of the faults raised by the operation
      */
     public List<DataType<T>> getFaultTypes() {
@@ -145,7 +166,7 @@
     /**
      * Returns true if the operation is non-blocking. A non-blocking operation may not have completed execution at the
      * time an invocation of the operation returns.
-     *
+     * 
      * @return true if the operation is non-blocking
      */
     public boolean isNonBlocking() {
@@ -154,26 +175,25 @@
 
     /**
      * Returns the data binding type specified for the operation or null.
-     *
+     * 
      * @return the data binding type specified for the operation or null.
      */
     public String getDataBinding() {
         return dataBinding;
     }
-    
+
     /**
      * Set the databinding for this operation
-     *  
+     * 
      * @param dataBinding The databinding
      */
     public void setDataBinding(String dataBinding) {
         this.dataBinding = dataBinding;
     }
-    
 
     /**
      * Returns a map of metadata key to value mappings for the operation.
-     *
+     * 
      * @return a map of metadata key to value mappings for the operation.
      */
     public Map<String, Object> getMetaData() {
@@ -185,7 +205,7 @@
 
     /**
      * Adds metadata associated with the operation.
-     *
+     * 
      * @param key the metadata key
      * @param val the metadata value
      */
@@ -206,26 +226,55 @@
 
         final Operation operation = (Operation) o;
 
+        if (name != null ? !name.equals(operation.name) : operation.name != null) {
+            return false;
+        }
+
+        // HACK: If the operation is mappable, then the equality test is relaxed
+        if (isMappable()) {
+            return true;
+        }
+
         if (faultTypes != null ? !faultTypes.equals(operation.faultTypes) : operation.faultTypes != null) {
             return false;
         }
-        if (name != null ? !name.equals(operation.name) : operation.name != null) {
+
+        if (inputType != null ? !inputType.equals(operation.inputType) : operation.inputType != null) {
             return false;
         }
-        if (parameterTypes != null ? !parameterTypes.equals(operation.parameterTypes)
-            : operation.parameterTypes != null) {
+        return !(outputType != null ? !outputType.equals(operation.outputType) : operation.outputType != null);
+    }
+
+    private boolean isMappable() {
+        if (contract != null) {
+            return contract.isRemotable();
+        } else {
             return false;
         }
-        return !(returnType != null ? !returnType.equals(operation.returnType) : operation.returnType != null);
     }
 
     public int hashCode() {
         int result;
         result = name != null ? name.hashCode() : 0;
-        result = 29 * result + (returnType != null ? returnType.hashCode() : 0);
-        result = 29 * result + (parameterTypes != null ? parameterTypes.hashCode() : 0);
+        // HACK:
+        if (isMappable()) {
+            return result;
+        }
+        result = 29 * result + (outputType != null ? outputType.hashCode() : 0);
+        result = 29 * result + (inputType != null ? inputType.hashCode() : 0);
         result = 29 * result + (faultTypes != null ? faultTypes.hashCode() : 0);
         return result;
+    }
+
+    /**
+     * @param nonBlocking the nonBlocking to set
+     */
+    public void setNonBlocking(boolean nonBlocking) {
+        this.nonBlocking = nonBlocking;
+    }
+    
+    public String toString() {
+        return name;
     }
 
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java Fri Sep  8 14:37:43 2006
@@ -22,20 +22,33 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.tuscany.spi.model.InteractionScope;
+import org.apache.tuscany.spi.model.ModelObject;
+
 /**
  * Base class representing service contract information
- *
+ * 
  * @version $Rev$ $Date$
  */
 public abstract class ServiceContract<T> extends ModelObject {
     protected InteractionScope interactionScope;
+
+    protected boolean remotable;
+
     protected Class<?> interfaceClass;
+
     protected String interfaceName;
+
     protected String callbackName;
+
     protected Class<?> callbackClass;
+
     protected Map<String, Operation<T>> operations;
-    protected Map<String, Operation<T>> callbacksOperations;
+
+    protected Map<String, Operation<T>> callbackOperations;
+
     protected String dataBinding;
+
     protected Map<String, Object> metaData;
 
     protected ServiceContract() {
@@ -51,7 +64,7 @@
 
     /**
      * Returns the interface name for the contract
-     *
+     * 
      * @return the interface name for the contract
      */
     public String getInterfaceName() {
@@ -132,19 +145,19 @@
         this.operations = operations;
     }
 
-    public Map<String, Operation<T>> getCallbacksOperations() {
-        if (callbacksOperations == null) {
+    public Map<String, Operation<T>> getCallbackOperations() {
+        if (callbackOperations == null) {
             return Collections.emptyMap();
         }
-        return Collections.unmodifiableMap(callbacksOperations);
+        return Collections.unmodifiableMap(callbackOperations);
     }
 
-    public void setCallbacksOperations(Map<String, Operation<T>> callbacksOperations) {
+    public void setCallbackOperations(Map<String, Operation<T>> callbacksOperations) {
         for (Operation<T> operation : callbacksOperations.values()) {
             operation.setServiceContract(this);
             operation.setCallback(true);
         }
-        this.callbacksOperations = callbacksOperations;
+        this.callbackOperations = callbacksOperations;
     }
 
     public String getDataBinding() {
@@ -157,7 +170,7 @@
 
     /**
      * Returns a map of metadata key to value mappings for the operation.
-     *
+     * 
      * @return a map of metadata key to value mappings for the operation.
      */
     public Map<String, Object> getMetaData() {
@@ -169,7 +182,7 @@
 
     /**
      * Adds metadata associated with the operation.
-     *
+     * 
      * @param key the metadata key
      * @param val the metadata value
      */
@@ -193,8 +206,8 @@
         if (callbackName != null ? !callbackName.equals(that.callbackName) : that.callbackName != null) {
             return false;
         }
-        if (callbacksOperations != null ? !callbacksOperations.equals(that.callbacksOperations)
-            : that.callbacksOperations != null) {
+        if (callbackOperations != null ? !callbackOperations.equals(that.callbackOperations)
+                : that.callbackOperations != null) {
             return false;
         }
         if (interfaceClass != null ? !interfaceClass.equals(that.interfaceClass) : that.interfaceClass != null) {
@@ -213,7 +226,21 @@
         result = 29 * result + (interfaceName != null ? interfaceName.hashCode() : 0);
         result = 29 * result + (callbackName != null ? callbackName.hashCode() : 0);
         result = 29 * result + (operations != null ? operations.hashCode() : 0);
-        result = 29 * result + (callbacksOperations != null ? callbacksOperations.hashCode() : 0);
+        result = 29 * result + (callbackOperations != null ? callbackOperations.hashCode() : 0);
         return result;
+    }
+
+    /**
+     * @return the remotable
+     */
+    public boolean isRemotable() {
+        return remotable;
+    }
+
+    /**
+     * @param remotable the remotable to set
+     */
+    public void setRemotable(boolean remotable) {
+        this.remotable = remotable;
     }
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InvocationChain.java Fri Sep  8 14:37:43 2006
@@ -95,6 +95,7 @@
      * Adds an interceptor to the chain
      */
     void addInterceptor(Interceptor interceptor);
+    void addInterceptor(int index, Interceptor interceptor);
 
     /**
      * Returns the first interceptor in the chain

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=441661&r1=441660&r2=441661
==============================================================================
--- 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 Fri Sep  8 14:37:43 2006
@@ -136,5 +136,30 @@
      * @param def     the model artifact representing the service
      */
     void createWires(Service<?> service, BindlessServiceDefinition def);
+    
+    /**
+     * Check the compatiblity of the source and the target service contracts.<p>
+     * A wire may only connect a source to a target if the target implements an interface that is compatible with the
+     * interface required by the source. The source and the target are compatible if:
+     * <p>
+     * <ol>
+     * <li>the source interface and the target interface MUST either both be remotable or they are both local
+     * <li>the methods on the target interface MUST be the same as or be a superset of the methods in the interface
+     * specified on the source
+     * <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.
+     * <li>other specified attributes of the two interfaces MUST match, including Scope and Callback interface
+     * </ol>
+     * 
+     * <p>Please note this test is not symetric: isWireable(A, B) does NOT imply that isWireable(B, A)
+     * 
+     * @param source The source service contract
+     * @param target The target service contract
+     * @return
+     */
+    boolean isWireable(ServiceContract<?> source, ServiceContract<?> target); 
 
 }

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/idl/java/JavaIDLUtilsTestCase.java Fri Sep  8 14:37:43 2006
@@ -38,7 +38,9 @@
     private List<Operation<?>> operations;
 
     public void testNoParamsFindMethod() {
-        Operation<Type> operation = new Operation<Type>("foo", null, null, null, false, null);
+        List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+        DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null);
         Method method = findMethod(operation, methods);
         assertEquals("foo", method.getName());
         assertEquals(0, method.getParameterTypes().length);
@@ -55,7 +57,8 @@
         List<DataType<Type>> types = new ArrayList<DataType<Type>>();
         DataType<Type> type = new DataType<Type>(String.class, Object.class);
         types.add(type);
-        Operation<Type> operation = new Operation<Type>("foo", null, types, null, false, null);
+        DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null);
         Method method = findMethod(operation, methods);
         assertEquals("foo", method.getName());
         assertEquals(String.class, method.getParameterTypes()[0]);
@@ -75,7 +78,8 @@
         DataType<Type> type2 = new DataType<Type>(String.class, Object.class);
         types.add(type);
         types.add(type2);
-        Operation<Type> operation = new Operation<Type>("foo", null, types, null, false, null);
+        DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null);
         Method method = findMethod(operation, methods);
         assertNull(method);
     }
@@ -84,7 +88,8 @@
         List<DataType<Type>> types = new ArrayList<DataType<Type>>();
         DataType<Type> type = new DataType<Type>(Integer.class, Object.class);
         types.add(type);
-        Operation<Type> operation = new Operation<Type>("foo", null, types, null, false, null);
+        DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null);
         Method method = findMethod(operation, methods);
         assertNull(method);
     }
@@ -93,7 +98,8 @@
         List<DataType<Type>> types = new ArrayList<DataType<Type>>();
         DataType<Type> type = new DataType<Type>(Integer.class, Object.class);
         types.add(type);
-        Operation<Type> operation = new Operation<Type>("foo", null, types, null, false, null);
+        DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null);
         Method method = findMethod(operation, methods);
         assertNull(method);
     }
@@ -102,7 +108,8 @@
         List<DataType<Type>> types = new ArrayList<DataType<Type>>();
         DataType<Type> type = new DataType<Type>(Integer.TYPE, Object.class);
         types.add(type);
-        Operation<Type> operation = new Operation<Type>("foo", null, types, null, false, null);
+        DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        Operation<Type> operation = new Operation<Type>("foo", inputType, null, null, false, null);
         Method method = findMethod(operation, methods);
         assertEquals("foo", method.getName());
         assertEquals(Integer.TYPE, method.getParameterTypes()[0]);
@@ -111,7 +118,7 @@
     public void testPrimitiveParamFindOperation() throws NoSuchMethodException {
         Method method = Foo.class.getMethod("foo", Integer.TYPE);
         Operation<?> operation = findOperation(method, operations);
-        assertEquals(Integer.TYPE, operation.getParameterTypes().get(0).getPhysical());
+        assertEquals(Integer.TYPE, operation.getInputType().getLogical().get(0).getPhysical());
     }
 
 
@@ -129,9 +136,10 @@
         operations.add(operation);
 
         List<DataType<Type>> types = new ArrayList<DataType<Type>>();
+        DataType<List<DataType<Type>>> inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
         DataType<Type> type = new DataType<Type>(String.class, Object.class);
         types.add(type);
-        operation = new Operation<Type>("foo", null, types, null, false, null);
+        operation = new Operation<Type>("foo", inputType, null, null, false, null);
         operations.add(operation);
 
         types = new ArrayList<DataType<Type>>();
@@ -139,19 +147,22 @@
         DataType<Type> type2 = new DataType<Type>(String.class, Object.class);
         types.add(type);
         types.add(type2);
-        operation = new Operation<Type>("foo", null, types, null, false, null);
+        inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        operation = new Operation<Type>("foo", inputType, null, null, false, null);
         operations.add(operation);
 
         types = new ArrayList<DataType<Type>>();
         type = new DataType<Type>(Integer.class, Object.class);
         types.add(type);
-        operation = new Operation<Type>("foo", null, types, null, false, null);
+        inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        operation = new Operation<Type>("foo", inputType, null, null, false, null);
         operations.add(operation);
 
         types = new ArrayList<DataType<Type>>();
         type = new DataType<Type>(Integer.TYPE, Object.class);
         types.add(type);
-        operation = new Operation<Type>("foo", null, types, null, false, null);
+        inputType = new DataType<List<DataType<Type>>>(Object[].class, types);
+        operation = new Operation<Type>("foo", inputType, null, null, false, null);
         operations.add(operation);
 
     }

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ServiceContractTestCase.java Fri Sep  8 14:37:43 2006
@@ -44,7 +44,7 @@
         Operation<Type> operation = new Operation<Type>("foo", null, null, null, false, null);
         Map<String, Operation<Type>> ops = new HashMap<String, Operation<Type>>();
         ops.put("foo", operation);
-        contract.setCallbacksOperations(ops);
+        contract.setCallbackOperations(ops);
         assertEquals(contract, operation.getServiceContract());
         assertTrue(operation.isCallback());
     }

Modified: incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java?view=diff&rev=441661&r1=441660&r2=441661
==============================================================================
--- incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java (original)
+++ incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/ArtifactFactory.java Fri Sep  8 14:37:43 2006
@@ -53,7 +53,7 @@
     }
 
     public static Connector createConnector() {
-        return new ConnectorImpl();
+        return new ConnectorImpl(createWireService(), null);
     }
 
     public static WireService createWireService() {



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