From 45608ba818d35c57fdd0b00a4b1904a680fbf55f Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 19 Feb 2010 23:38:00 +0000 Subject: Align the interfaceContractMapper to the spec Remove the conversation related legacy code git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@912034 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/interfacedef/Compatibility.java | 29 +++ .../sca/interfacedef/ConversationSequence.java | 29 --- .../apache/tuscany/sca/interfacedef/Interface.java | 13 -- .../sca/interfacedef/InterfaceContractMapper.java | 195 ++++++++++++++------- .../apache/tuscany/sca/interfacedef/Operation.java | 12 -- .../impl/InterfaceContractMapperImpl.java | 101 +++++------ .../sca/interfacedef/impl/OperationImpl.java | 16 -- .../impl/ContractCompatibilityTestCase.java | 19 +- .../binding/ws/wsdlgen/BindingWSDLGenerator.java | 24 --- .../sca/builder/impl/ComponentBuilderImpl.java | 7 +- .../impl/CompositeComponentTypeBuilderImpl.java | 5 +- .../sca/builder/impl/CompositeWireApplierImpl.java | 2 +- .../builder/impl/EndpointReferenceBuilderImpl.java | 2 +- .../tuscany/sca/builder/impl/WireBuilderImpl.java | 8 +- .../tuscany/sca/builder/impl/WireMatcherImpl.java | 2 +- .../org/apache/tuscany/sca/runtime/Invocable.java | 12 -- .../core/assembly/impl/RuntimeEndpointImpl.java | 22 +-- .../impl/RuntimeEndpointReferenceImpl.java | 22 +-- .../runtime/impl/EndpointReferenceBinderImpl.java | 2 +- .../JavaCallbackRuntimeWireProcessor.java | 3 +- .../java/invocation/JavaImplementationInvoker.java | 23 --- .../wsdl/impl/WSDLInterfaceIntrospectorImpl.java | 64 +------ .../wsdl/impl/WSDLOperationIntrospectorImpl.java | 2 - .../wsdl/xml/WSDLInterfaceProcessor.java | 2 +- ...licyAnnotatedInterfaceIntrospectorTestCase.java | 9 - .../impl/RemoteServiceAdminImpl.java | 21 ++- 26 files changed, 248 insertions(+), 398 deletions(-) create mode 100644 sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Compatibility.java delete mode 100644 sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java (limited to 'sca-java-2.x/trunk/modules') diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Compatibility.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Compatibility.java new file mode 100644 index 0000000000..e05a05476a --- /dev/null +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Compatibility.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.interfacedef; + +/** + * Types of compatibility + */ +public enum Compatibility { + SUPERSET, // The source is a superset of the target + SUBSET, // The source is a subset of the target + MUTUAL, // The source is the same set as the target + INCOMPATIBLE // The source is not compatible with the target +} \ No newline at end of file diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java deleted file mode 100644 index 247a432330..0000000000 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.interfacedef; - -/** - * Enum of the Conversation Sequence values. - * - * @version $Rev$ $Date$ - */ -public enum ConversationSequence { - CONVERSATION_NONE, CONVERSATION_START, CONVERSATION_CONTINUE, CONVERSATION_END -} diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java index cab7057b57..a0659bd68f 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java @@ -57,19 +57,6 @@ public interface Interface extends Cloneable, PolicySubject { */ boolean isRemotableSet(); - // FIXME: [rfeng] We need to re-consider the conversational as an intent - /** - * Test if the interface is conversational - * @return - */ - boolean isConversational(); - - /** - * Set whether the interface is conversational - * @param conversational - */ - void setConversational(boolean conversational); - /** * Returns the operations defined on this interface. * diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java index 8dfeb29833..7a917e5560 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java @@ -26,64 +26,9 @@ package org.apache.tuscany.sca.interfacedef; */ public interface InterfaceContractMapper { /** - * Check the compatibility of the source and the target interface contracts. - *

- * 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:

- *

    - *
  1. the source interface and the target interface MUST either both be - * remotable or they are both local - *
  2. 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 - *
  3. 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. - *
  4. the order of the input and output types also MUST BE the same. - *
  5. the set of Faults and Exceptions expected by the source MUST BE the - * same or be a superset of those specified by the service. - *
  6. other specified attributes of the two interfaces MUST match, - * including Scope and Callback interface - *
- *

- *

- * This relationship implies that the source contract is a subset of the target - * contract - ie all the operations of the source must be present in the target, but - * the target can in principle contain additional operations not present in the - * source - *

- *

- * Please note this test is not symmetric: the success of isCompatible(A, B) - * does NOT imply isCompatible(B, A) - * * @param source The source interface contract * @param target The target interface contract - * @return true if the source contract can be supported by the target - * contract - */ - boolean isCompatible(InterfaceContract source, InterfaceContract target); - - /** - * Check that two interface contracts are equal. The contracts are equal if the two contracts have the - * same set of operations, with each operation having the same signature. - * @param source - the source contract - * @param target - the target contract - * @return - */ - boolean isEqual(InterfaceContract source, InterfaceContract target); - - /** - * Check that two interfaces are equal. The interfaces are equal if the two interfaces have the - * same set of operations, with each operation having the same signature. - * @param source an interface - * @param target a second interface - * @return true if the two interfaces are equal, otherwise return false - */ - public boolean isEqual(Interface source, Interface target); - - /** - * @param source - * @param target + * @param compatibility The compatibility style * @param ignoreCallback * @param silent * @return @@ -91,6 +36,7 @@ public interface InterfaceContractMapper { */ boolean checkCompatibility(InterfaceContract source, InterfaceContract target, + Compatibility compatibility, boolean ignoreCallback, boolean silent) throws IncompatibleInterfaceContractException; @@ -106,34 +52,149 @@ public interface InterfaceContractMapper { * * @param source The source data type * @param target The target data type - * @return + * @param passByValue A flag to indicate how the compatibility is checked + *

+ * @return true if the source data type is the same or subtype of the target data type */ - boolean isCompatible(DataType source, DataType target, boolean remotable); + boolean isCompatible(DataType source, DataType target, boolean passByValue); /** - * Check if source operation is compatible with the target operation + * Check if source operation is compatible with the target operation. A source operation is + * compatible with the target operation means the following: + * + *
    + *
  1. compatibility for the two operations is defined as compatibility + * of the signature, i.e., the operation name, the input types, and the output types are the same + * + *
  2. the order of the input and output types of the source operation is the same as the order of + * the input and output types for the corresponding target operation + *
  3. the set of Faults and Exceptions expected by the source operation is the same as or is + * a SUPERSET of the set of Faults and Exceptions specified by the corresponding target operation + *
+ * + * Simply speaking, any request from the source operation can be processed by the target operation and + * the normal response or fault/exception from the target operation can be handled by the source operation. + * + * Please note this compatibility check is NOT symmetric. * * @param source The source operation * @param target The target operation + * @param compatibilityType TODO * @return true if the source operation is compatible with the target * operation */ - boolean isCompatible(Operation source, Operation target, boolean remotable); + boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType); /** - * @param source - * @param target - * @return + * An interface A is a Compatible Subset of a second interface B if and only if all of points 1 through 6 + * in the following list apply: + *
    + *
  1. interfaces A and B are either both remotable or else both local + *
  2. the set of operations in interface A is the same as or is a subset of the set of operations in + * interface B + *
  3. compatibility for individual operations of the interfaces A and B is defined as compatibility + * of the signature, i.e., the operation name, the input types, and the output types are the same + *
  4. the order of the input and output types for each operation in interface A is the same as the + * order of the input and output types for the corresponding operation in interface B + *
  5. the set of Faults and Exceptions expected by each operation in interface A is the same as or is + * a superset of the set of Faults and Exceptions specified by the corresponding operation in interface B + *
  6. for checking the compatibility of 2 remotable interfaces which are in different interface + * languages, both are mapped to WSDL 1.1 (if not already WSDL 1.1) and compatibility checking is done + * between the WSDL 1.1 mapped interfaces.
    + * For checking the compatibility of 2 local interfaces which are in different interface languages, the + * method of checking compatibility is defined by the specifications which define those interface types, + * which must define mapping rules for the 2 interface types concerned. + * + *
+ * + * The callback interfaces are not considered her. + * + * @param source The source interface + * @param target The target interface + * @return true if the source interface is a compatible subset of the target interface + */ + boolean isCompatibleSubset(Interface source, Interface target); + + /** + * An interface A is a Compatible Subset of a second interface B if and only if all of points 1 through 7 + * in the following list apply: + *
    + *
  1. interfaces A and B are either both remotable or else both local + *
  2. the set of operations in interface A is the same as or is a subset of the set of operations in + * interface B + *
  3. compatibility for individual operations of the interfaces A and B is defined as compatibility + * of the signature, i.e., the operation name, the input types, and the output types are the same + *
  4. the order of the input and output types for each operation in interface A is the same as the + * order of the input and output types for the corresponding operation in interface B + *
  5. the set of Faults and Exceptions expected by each operation in interface A is the same as or is + * a superset of the set of Faults and Exceptions specified by the corresponding operation in interface B + *
  6. for checking the compatibility of 2 remotable interfaces which are in different interface + * languages, both are mapped to WSDL 1.1 (if not already WSDL 1.1) and compatibility checking is done + * between the WSDL 1.1 mapped interfaces.
    + * For checking the compatibility of 2 local interfaces which are in different interface languages, the + * method of checking compatibility is defined by the specifications which define those interface types, + * which must define mapping rules for the 2 interface types concerned. + *
  7. if either interface A or interface B declares a callback interface then both interface + * A and interface B declare callback interfaces and the callback interface declared on interface B is a + * compatible subset of the callback interface declared on interface A, according to points 1 through 6 + * above + *
+ * + * @param source The source interface contract + * @param target The target interface contract + * @return true if the source interface contract is a compatible subset of the target interface contract */ - boolean isCompatible(Interface source, Interface target); + boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target); /** - * Map the source operation to a compatible operation in the target - * interface + * Check that two interfaces are mutually compatible. The interfaces are mutually compatible if the two + * interfaces have the same set of operations, with each operation having the same signature (name, input + * types, output types and fault/exception types). + * + * @param source an interface + * @param target a second interface + * @return true if the two interfaces are mutually compatible, otherwise return false + */ + public boolean isMutuallyCompatible(Interface source, Interface target); + + /** + * An interface A is Compatible with a second interface B if and only if all of points 1 through 7 in the + * following list apply:

+ *

    + *
  1. interfaces A and B are either both remotable or else both local + *
  2. the set of operations in interface A is the same as the set of operations in interface B + *
  3. compatibility for individual operations of the interfaces A and B is defined as compatibility + * of the signature, i.e., the operation name, the input types, and the output types are the same + *
  4. the order of the input and output types for each operation in interface A is the same as the + * order of the input and output types for the corresponding operation in interface B + *
  5. the set of Faults and Exceptions expected by each operation in interface A is the + * same as the set of Faults and Exceptions specified by the corresponding operation in interface B + *
  6. for checking the compatibility of 2 remotable interfaces which are in different interface + * languages, both are mapped to WSDL 1.1 (if not already WSDL 1.1) and compatibility checking is done + * between the WSDL 1.1 mapped interfaces. + *
    For checking the compatibility of 2 local interfaces which are in different interface languages, + * the method of checking compatibility is defined by the specifications which define those interface types, + * which must define mapping rules for the 2 interface types concerned. + *
  7. if either interface A or interface B declares a callback interface then both interface + * A and interface B declare callback interfaces and the callback interface declared on interface A is + * compatible with the callback interface declared on interface B, according to points 1 through 6 above + * + * @param source - the source interface contract + * @param target - the target interface contract + * @return true if the source and target interface contracts are mutually compatible + */ + boolean isMutuallyCompatible(InterfaceContract source, InterfaceContract target); + + /** + * Map the source operation to a compatible operation in the target interface * * @param target The target interface * @param source The source operation - * @return A compatible operation + * @return A compatible operation if the target interface is compatible superset of the source interface */ Operation map(Interface target, Operation source); + } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java index 55f00b82c8..773c7be0f7 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java @@ -110,18 +110,6 @@ public interface Operation extends Cloneable, PolicySubject { */ void setInterface(Interface interfaze); - /** - * Get the sequence of the conversation - * @return - */ - ConversationSequence getConversationSequence(); - - /** - * Set the sequence of conversation for the operation - * @param sequence - */ - void setConversationSequence(ConversationSequence sequence); - /** * Indicate if the operation is non-blocking * @return diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java index 03a39bc840..dc1c0c0a4e 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.interfacedef.impl; import java.util.List; +import org.apache.tuscany.sca.interfacedef.Compatibility; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException; import org.apache.tuscany.sca.interfacedef.Interface; @@ -33,24 +34,24 @@ import org.apache.tuscany.sca.interfacedef.Operation; */ public class InterfaceContractMapperImpl implements InterfaceContractMapper { - public boolean isCompatible(DataType source, DataType target, boolean remotable) { + public boolean isCompatible(DataType source, DataType target, boolean passByValue) { if (source == target) { return true; } - if (!remotable) { + if (!passByValue) { if (source == null || target == null) { return false; } // For local case return target.getPhysical().isAssignableFrom(source.getPhysical()); } else { - // FIXME: How to test if two remotable data type is compatible? - // return target.getLogical().equals(source.getLogical()); + // FIXME: [rfeng] How to test if two remotable data type is compatible? + // We will need to understand the different typing system used by the databindings + // We should probably delegate to some extensions here return true; } } - /** * Check that two interface contracts are equal. The contracts are equal if the two contracts have the @@ -60,21 +61,21 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { * @param target * @return */ - public boolean isEqual(InterfaceContract source, InterfaceContract target) { - // Are the forward interfaces equal? - if( isEqual( source.getInterface(), target.getInterface()) ) { - // Is there a Callback interface? - if( source.getCallbackInterface() == null && target.getCallbackInterface() == null ) { - return true; - } else { - if( isEqual( source.getCallbackInterface(), target.getCallbackInterface()) ) { - return true; - } // end if - } // end if - } // end if - return false; + public boolean isMutuallyCompatible(InterfaceContract source, InterfaceContract target) { + // Are the forward interfaces equal? + if (isMutuallyCompatible(source.getInterface(), target.getInterface())) { + // Is there a Callback interface? + if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) { + return true; + } else { + if (isMutuallyCompatible(source.getCallbackInterface(), target.getCallbackInterface())) { + return true; + } // end if + } // end if + } // end if + return false; } // end method isEqual - + /** * Check that two interfaces are equal. The interfaces are equal if the two interfaces have the * same set of operations, with each operation having the same signature. @@ -82,13 +83,13 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { * @param target * @return */ - public boolean isEqual(Interface source, Interface target) { + public boolean isMutuallyCompatible(Interface source, Interface target) { if (source == target) { // Shortcut for performance return true; } // end if if (source == null || target == null) { - return false; + return false; } // end if if (source.isDynamic() || target.isDynamic()) { @@ -98,26 +99,23 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { if (source.isRemotable() != target.isRemotable()) { return false; } - if (source.isConversational() != target.isConversational()) { + if (source.getOperations().size() != target.getOperations().size()) { return false; } - if( source.getOperations().size() != target.getOperations().size() ) { - return false; - } for (Operation operation : source.getOperations()) { Operation targetOperation = getOperation(target.getOperations(), operation.getName()); if (targetOperation == null) { return false; } - if (!isCompatible(operation, targetOperation, source.isRemotable())) { + if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) { return false; } } return true; } // end method isEqual - public boolean isCompatible(Operation source, Operation target, boolean remotable) { + public boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType) { if (source == target) { return true; } @@ -135,6 +133,8 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return false; } + boolean remotable = source.getInterface().isRemotable(); + // if (source.getInterface().isRemotable()) { // return true; // } @@ -212,22 +212,23 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { public boolean checkCompatibility(InterfaceContract source, InterfaceContract target, + Compatibility compatibility, boolean ignoreCallback, boolean silent) throws IncompatibleInterfaceContractException { if (source == target) { // Shortcut for performance return true; } - - if (source == null || target == null){ + + if (source == null || target == null) { return false; } - - if (source.getInterface() == target.getInterface()){ + + if (source.getInterface() == target.getInterface()) { return ignoreCallback || isCallbackCompatible(source, target, silent); } - - if (source.getInterface() == null || target.getInterface() == null){ + + if (source.getInterface() == null || target.getInterface() == null) { return false; } @@ -242,13 +243,6 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return false; } } - if (source.getInterface().isConversational() != target.getInterface().isConversational()) { - if (!silent) { - throw new IncompatibleInterfaceContractException("Interaction scopes do not match", source, target); - } else { - return false; - } - } for (Operation operation : source.getInterface().getOperations()) { Operation targetOperation = map(target.getInterface(), operation); @@ -261,7 +255,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { } if (!source.getInterface().isRemotable()) { // FIXME: for remotable operation, only compare name for now - if (!isCompatible(operation, targetOperation, false)) { + if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) { if (!silent) { throw new IncompatibleInterfaceContractException("Target operations are not compatible", source, target); @@ -275,8 +269,8 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return ignoreCallback || isCallbackCompatible(source, target, silent); } - - protected boolean isCallbackCompatible(InterfaceContract source, InterfaceContract target, boolean silent) throws IncompatibleInterfaceContractException { + protected boolean isCallbackCompatible(InterfaceContract source, InterfaceContract target, boolean silent) + throws IncompatibleInterfaceContractException { if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) { return true; } @@ -288,14 +282,6 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { } } - if (source.getCallbackInterface().isConversational() != target.getCallbackInterface().isConversational()) { - if (!silent) { - throw new IncompatibleInterfaceContractException("Interaction scopes do not match", source, target); - } else { - return false; - } - } - for (Operation operation : source.getCallbackInterface().getOperations()) { Operation targetOperation = getOperation(target.getCallbackInterface().getOperations(), operation.getName()); @@ -322,7 +308,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return true; } - public boolean isCompatible(Interface source, Interface target) { + public boolean isCompatibleSubset(Interface source, Interface target) { if (source == target) { // Shortcut for performance return true; @@ -338,25 +324,22 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { if (source.isRemotable() != target.isRemotable()) { return false; } - if (source.isConversational() != target.isConversational()) { - return false; - } for (Operation operation : source.getOperations()) { Operation targetOperation = getOperation(target.getOperations(), operation.getName()); if (targetOperation == null) { return false; } - if (!isCompatible(operation, targetOperation, source.isRemotable())) { + if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) { return false; } } return true; } - public boolean isCompatible(InterfaceContract source, InterfaceContract target) { + public boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target) { try { - return checkCompatibility(source, target, false, false); + return checkCompatibility(source, target, Compatibility.SUBSET, false, false); } catch (IncompatibleInterfaceContractException e) { return false; } @@ -379,7 +362,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper { return null; } else { for (Operation op : target.getOperations()) { - if (isCompatible(source, op, target.isRemotable())) { + if (isCompatible(source, op, Compatibility.SUBSET)) { return op; } } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java index 26144e92cb..48eb9e42d4 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java @@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentHashMap; import javax.xml.namespace.QName; -import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.Operation; @@ -49,7 +48,6 @@ public class OperationImpl implements Operation { private DataType> inputType; private List faultTypes; private Interface interfaze; - private ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE; private boolean nonBlocking; private boolean wrapperStyle; private WrapperInfo wrapper; @@ -145,20 +143,6 @@ public class OperationImpl implements Operation { this.interfaze = interfaze; } - /** - * @return the conversationSequence - */ - public ConversationSequence getConversationSequence() { - return conversationSequence; - } - - /** - * @param conversationSequence the conversationSequence to set - */ - public void setConversationSequence(ConversationSequence conversationSequence) { - this.conversationSequence = conversationSequence; - } - /** * @return the nonBlocking */ diff --git a/sca-java-2.x/trunk/modules/assembly/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java b/sca-java-2.x/trunk/modules/assembly/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java index acdaae799e..603d393e5c 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java +++ b/sca-java-2.x/trunk/modules/assembly/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java @@ -29,6 +29,7 @@ import java.util.Map; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.interfacedef.Compatibility; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException; import org.apache.tuscany.sca.interfacedef.Interface; @@ -58,7 +59,7 @@ public class ContractCompatibilityTestCase { public void testNoOperation() throws Exception { InterfaceContract source = new MockContract("FooContract"); InterfaceContract target = new MockContract("FooContract"); - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); } @Test @@ -73,7 +74,7 @@ public class ContractCompatibilityTestCase { Map targetOperations = new HashMap(); targetOperations.put("op1", opSource2); target.getInterface().getOperations().addAll(targetOperations.values()); - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); } @Test @@ -89,7 +90,7 @@ public class ContractCompatibilityTestCase { targetOperations.put("op2", opSource2); target.getInterface().getOperations().addAll(targetOperations.values()); try { - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); fail(); } catch (IncompatibleInterfaceContractException e) { // expected @@ -118,7 +119,7 @@ public class ContractCompatibilityTestCase { Map targetOperations = new HashMap(); targetOperations.put("op1", opTarget); target.getInterface().getOperations().addAll(targetOperations.values()); - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); } @Test @@ -144,7 +145,7 @@ public class ContractCompatibilityTestCase { targetOperations.put("op1", opTarget); target.getInterface().getOperations().addAll(targetOperations.values()); try { - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); fail(); } catch (IncompatibleInterfaceContractException e) { // expected @@ -202,7 +203,7 @@ public class ContractCompatibilityTestCase { Map targetOperations = new HashMap(); targetOperations.put("op1", opTarget); target.getInterface().getOperations().addAll(targetOperations.values()); - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); } /** @@ -250,7 +251,7 @@ public class ContractCompatibilityTestCase { targetOperations.put("op1", opTarget); target.getInterface().getOperations().addAll(targetOperations.values()); try { - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); fail(); } catch (IncompatibleInterfaceContractException e) { // expected @@ -279,7 +280,7 @@ public class ContractCompatibilityTestCase { Map targetOperations = new HashMap(); targetOperations.put("op1", opTarget); target.getInterface().getOperations().addAll(targetOperations.values()); - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); } @Test @@ -299,7 +300,7 @@ public class ContractCompatibilityTestCase { Map targetOperations = new HashMap(); targetOperations.put("op1", opTarget); target.getInterface().getOperations().addAll(targetOperations.values()); - mapper.checkCompatibility(source, target, false, false); + mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false); } /** diff --git a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java index 25791394fe..7bd3832b4a 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java +++ b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java @@ -41,7 +41,6 @@ import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; @@ -225,28 +224,6 @@ public class BindingWSDLGenerator { wsBinding.setBindingInterfaceContract(icontract); } - // TODO - fix up the conversational flag and operation sequences in case the contract has come from WSDL - // as we don't yet support requires="conversational" or sca:endConversation annotations - // in WSDL interface descriptions (see section 1.5.4 of the Assembly Specification V1.0) - if (contract.getInterfaceContract().getInterface() != null ) { - icontract.getInterface().setConversational(contract.getInterfaceContract().getInterface().isConversational()); - - for (Operation operation : icontract.getInterface().getOperations()){ - Operation serviceOperation = null; - - for (Operation tmpOp : contract.getInterfaceContract().getInterface().getOperations()){ - if (operation.getName().equals(tmpOp.getName())) { - serviceOperation = tmpOp; - break; - } - } - - if (serviceOperation != null ){ - operation.setConversationSequence(serviceOperation.getConversationSequence()); - } - } - } - /* // Look at all the Web Service bindings of the SCA service to see if any // of them have an existing generated WSDL definitions document. If found, @@ -328,7 +305,6 @@ public class BindingWSDLGenerator { wsdlDefinition.setDefinition(def); wsdlInterface.setWsdlDefinition(wsdlDefinition); wsdlInterface.setRemotable(true); - wsdlInterface.setConversational(contract.getInterface().isConversational()); wsdlInterface.setUnresolved(false); wsdlInterface.setRemotable(true); PortType portType = (PortType)def.getAllPortTypes().values().iterator().next(); diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java index 45e41d29ef..2be14e4c6d 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java @@ -59,6 +59,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.definitions.Definitions; +import org.apache.tuscany.sca.interfacedef.Compatibility; import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; @@ -1119,7 +1120,7 @@ public class ComponentBuilderImpl { boolean isCompatible = true; String incompatibilityReason = ""; try{ - isCompatible = interfaceContractMapper.checkCompatibility(topInterfaceContract, bottomInterfaceContract, false, false); + isCompatible = interfaceContractMapper.checkCompatibility(topInterfaceContract, bottomInterfaceContract, Compatibility.SUBSET, false, false); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); @@ -1139,7 +1140,7 @@ public class ComponentBuilderImpl { /** * Interface contract from higher in the implementation hierarchy takes precedence * When it comes to checking compatibility the top level reference interface is a - * superset of the promoted reference interface so treat the treat the promoted + * superset of the promoted reference interface so treat the promoted * (bottom) interface as the source * * @param topContract the top contract @@ -1159,7 +1160,7 @@ public class ComponentBuilderImpl { boolean isCompatible = true; String incompatibilityReason = ""; try{ - isCompatible = interfaceContractMapper.checkCompatibility(bottomInterfaceContract, topInterfaceContract, false, false); + isCompatible = interfaceContractMapper.checkCompatibility(bottomInterfaceContract, topInterfaceContract, Compatibility.SUBSET, false, false); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java index 36b8c2ac40..2ea8c5ac5e 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java @@ -46,6 +46,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.definitions.Definitions; +import org.apache.tuscany.sca.interfacedef.Compatibility; import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; @@ -426,7 +427,7 @@ public class CompositeComponentTypeBuilderImpl { boolean isCompatible = true; String incompatibilityReason = ""; try{ - isCompatible = interfaceContractMapper.checkCompatibility(topInterfaceContract, bottomInterfaceContract, false, false); + isCompatible = interfaceContractMapper.checkCompatibility(topInterfaceContract, bottomInterfaceContract, Compatibility.SUBSET, false, false); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); @@ -464,7 +465,7 @@ public class CompositeComponentTypeBuilderImpl { boolean isCompatible = true; String incompatibilityReason = ""; try{ - isCompatible = interfaceContractMapper.checkCompatibility(bottomInterfaceContract, topInterfaceContract, false, false); + isCompatible = interfaceContractMapper.checkCompatibility(bottomInterfaceContract, topInterfaceContract, Compatibility.SUBSET, false, false); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeWireApplierImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeWireApplierImpl.java index 32f41b19be..3167b8cdb6 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeWireApplierImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeWireApplierImpl.java @@ -192,7 +192,7 @@ public class CompositeWireApplierImpl implements CompositeBuilder { // a superset of // the component reference interface if (resolvedReference.getInterfaceContract() == null || interfaceContractMapper - .isCompatible(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) { + .isCompatibleSubset(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) { //resolvedReference.getTargets().add(resolvedService); if (wire.isReplace()) { diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java index 62c6b1031a..e2b3c1200e 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java @@ -216,7 +216,7 @@ public class EndpointReferenceBuilderImpl { for (ComponentService targetComponentService : targetComponent.getServices()) { if (reference.getInterfaceContract() == null || - interfaceContractMapper.isCompatible(reference.getInterfaceContract(), + interfaceContractMapper.isCompatibleSubset(reference.getInterfaceContract(), targetComponentService.getInterfaceContract())) { if (intentsMatch(reference.getRequiredIntents(), targetComponentService.getRequiredIntents())) { diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java index fcc27a57b0..4b6a551a8e 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java @@ -302,7 +302,7 @@ public class WireBuilderImpl { // a superset of // the component reference interface if (resolvedReference.getInterfaceContract() == null || interfaceContractMapper - .isCompatible(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) { + .isCompatibleSubset(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) { //resolvedReference.getTargets().add(resolvedService); if (wire.isReplace()) { @@ -350,7 +350,7 @@ public class WireBuilderImpl { continue; for (ComponentService targetComponentService : targetComponent.getServices()) { - if (reference.getInterfaceContract() == null || interfaceContractMapper.isCompatible(reference + if (reference.getInterfaceContract() == null || interfaceContractMapper.isCompatibleSubset(reference .getInterfaceContract(), targetComponentService.getInterfaceContract())) { if (intentsMatch(reference.getRequiredIntents(), targetComponentService.getRequiredIntents())) { @@ -405,7 +405,7 @@ public class WireBuilderImpl { if (targetComponentService != null) { // Check that target component service provides a superset of the component reference interface - if (reference.getInterfaceContract() == null || interfaceContractMapper.isCompatible(reference + if (reference.getInterfaceContract() == null || interfaceContractMapper.isCompatibleSubset(reference .getInterfaceContract(), targetComponentService.getInterfaceContract())) { if (bindingName != null) { @@ -532,7 +532,7 @@ public class WireBuilderImpl { // Check that the target component service provides // a superset of the component reference interface - if (reference.getInterfaceContract() == null || interfaceContractMapper.isCompatible(reference + if (reference.getInterfaceContract() == null || interfaceContractMapper.isCompatibleSubset(reference .getInterfaceContract(), targetComponentService.getInterfaceContract())) { if (bindingName != null) { // the user has selected a binding as part of the target name diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java index 7a8fc1a844..761f53ff11 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java @@ -50,7 +50,7 @@ public class WireMatcherImpl implements WireBuilder { public boolean build(EndpointReference endpointReference, Endpoint endpoint, BuilderContext context) { InterfaceContract sourceIC = endpointReference.getComponentReferenceInterfaceContract(); InterfaceContract targetIC = endpoint.getComponentServiceInterfaceContract(); - if (!interfaceContractMapper.isCompatible(sourceIC, targetIC)) { + if (!interfaceContractMapper.isCompatibleSubset(sourceIC, targetIC)) { return false; } for (PolicyBuilder policyBuilder : builderExtensionPoint.getPolicyBuilders()) { diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java index a52f478436..d3012477b4 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java @@ -56,18 +56,6 @@ public interface Invocable { */ CompositeContext getCompositeContext(); - - /** - * Get the node URI - * @return The node URI - */ - String getNodeURI(); - /** - * Get the domain URI - * @return The domain URI - */ - String getDomainURI(); - /** * Unbind the invocable from the composite context */ diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index e0b866ddb9..6f784fc255 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -46,6 +46,7 @@ import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor; import org.apache.tuscany.sca.core.invocation.RuntimeInvoker; import org.apache.tuscany.sca.core.invocation.impl.InvocationChainImpl; import org.apache.tuscany.sca.core.invocation.impl.PhaseManager; +import org.apache.tuscany.sca.interfacedef.Compatibility; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.Operation; @@ -99,9 +100,6 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint protected InterfaceContract bindingInterfaceContract; protected InterfaceContract serviceInterfaceContract; - private String domainURI; - private String nodeURI; - /** * No-arg constructor for Java serilization */ @@ -131,8 +129,6 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint this.policySets = copy.policySets; this.uri = copy.uri; - this.nodeURI = copy.nodeURI; - this.domainURI = copy.domainURI; this.remote = copy.remote; this.unresolved = copy.unresolved; @@ -148,12 +144,6 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint public void bind(CompositeContext compositeContext) { this.compositeContext = compositeContext; - if (nodeURI != null) { - this.nodeURI = compositeContext.getNodeURI(); - } - if (domainURI != null) { - this.domainURI = compositeContext.getDomainURI(); - } bind(compositeContext.getExtensionPointRegistry(), compositeContext.getEndpointRegistry()); } @@ -211,7 +201,7 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint for (InvocationChain chain : getInvocationChains()) { Operation op = chain.getTargetOperation(); - if (interfaceContractMapper.isCompatible(operation, op, op.getInterface().isRemotable())) { + if (interfaceContractMapper.isCompatible(operation, op, Compatibility.SUBSET)) { invocationChainMap.put(operation, chain); return chain; } @@ -583,12 +573,4 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint } } - public String getDomainURI() { - return domainURI; - } - - public String getNodeURI() { - return nodeURI; - } - } diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index e2cd2960ba..6dc8e63c17 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -47,6 +47,7 @@ import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor; import org.apache.tuscany.sca.core.invocation.RuntimeInvoker; import org.apache.tuscany.sca.core.invocation.impl.InvocationChainImpl; import org.apache.tuscany.sca.core.invocation.impl.PhaseManager; +import org.apache.tuscany.sca.interfacedef.Compatibility; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.Operation; @@ -99,9 +100,6 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen protected InterfaceContract bindingInterfaceContract; protected InterfaceContract referenceInterfaceContract; - private String domainURI; - private String nodeURI; - private String xml; /** @@ -133,8 +131,6 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen this.policySets = copy.policySets; this.uri = copy.uri; - this.domainURI = copy.domainURI; - this.nodeURI = copy.nodeURI; this.remote = copy.remote; this.unresolved = copy.unresolved; this.status = copy.status; @@ -151,12 +147,6 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen public void bind(CompositeContext compositeContext) { this.compositeContext = compositeContext; - if (nodeURI != null) { - this.nodeURI = compositeContext.getNodeURI(); - } - if (domainURI != null) { - this.domainURI = compositeContext.getDomainURI(); - } bind(compositeContext.getExtensionPointRegistry(), compositeContext.getEndpointRegistry()); } @@ -201,7 +191,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen if (cached == null) { for (InvocationChain chain : getInvocationChains()) { Operation op = chain.getSourceOperation(); - if (interfaceContractMapper.isCompatible(operation, op, op.getInterface().isRemotable())) { + if (interfaceContractMapper.isCompatible(operation, op, Compatibility.SUBSET)) { invocationChainMap.put(operation, chain); return chain; } @@ -541,13 +531,5 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen } } } - - public String getDomainURI() { - return domainURI; - } - - public String getNodeURI() { - return nodeURI; - } } diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index 33255d6573..d50554a777 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -596,7 +596,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { } boolean match = false; - match = interfaceContractMapper.isCompatible(endpointReference.getReference().getInterfaceContract(), + match = interfaceContractMapper.isCompatibleSubset(endpointReference.getReference().getInterfaceContract(), endpoint.getComponentServiceInterfaceContract()); if (!match){ diff --git a/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java b/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java index c652b95d73..6cd16202ba 100644 --- a/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java +++ b/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java @@ -82,8 +82,7 @@ public class JavaCallbackRuntimeWireProcessor implements RuntimeWireProcessor { Interface implType = javaInterfaceFactory.createJavaInterface(impl.getJavaClass()); // Ignore the remotable/conversational testing implType.setRemotable(iface.isRemotable()); - implType.setConversational(iface.isConversational()); - return interfaceContractMapper.isCompatible(iface, implType); + return interfaceContractMapper.isCompatibleSubset(iface, implType); } catch (InvalidInterfaceException e) { logger.log(Level.WARNING, e.getMessage(), e); return false; diff --git a/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java b/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java index 108fa428da..de6d33fe87 100644 --- a/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java +++ b/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java @@ -26,7 +26,6 @@ import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.scope.ScopeContainer; import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil; @@ -70,7 +69,6 @@ public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics if (op == null) { op = this.operation; } - ConversationSequence sequence = op.getConversationSequence(); Object payload = msg.getBody(); Object contextId = null; @@ -129,27 +127,6 @@ public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics } } - if (sequence != ConversationSequence.CONVERSATION_NONE ){ - try { -// // If the exception is not a business exception then end the conversation -// boolean businessException = false; -// -// for (DataType dataType : operation.getFaultTypes()){ -// if ((dataType.getPhysical() == e.getCause().getClass()) && -// (contextId != null) ){ -// businessException = true; -// break; -// } -// } - - if (!isChecked && contextId != null) { - scopeContainer.remove(contextId); - } - } catch (Exception ex){ - // TODO - sure what the best course of action is here. We have - // a system exception in the middle of a business exception - } - } if (!isChecked) { if (cause instanceof RuntimeException) { throw (RuntimeException)cause; diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java index 76d42f2f44..dd19407abe 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java @@ -29,7 +29,6 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; @@ -47,8 +46,6 @@ import org.apache.tuscany.sca.xsd.XSDFactory; */ public class WSDLInterfaceIntrospectorImpl { private static final QName POLICY_REQUIRES = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "requires"); - private static final QName POLICY_CONVERSATIONAL = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "conversational"); - public static final QName POLICY_END_CONVERSATION = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "endsConversation"); private static final QName CALLBACK_ATTRIBUTE = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "callback" ); @@ -68,9 +65,6 @@ public class WSDLInterfaceIntrospectorImpl { for (Object o : portType.getOperations()) { javax.wsdl.Operation wsdlOp = (javax.wsdl.Operation)o; Operation operation = getOperation(wsdlOp, wsdlDefinition, resolver, xsdFactory, monitor); - if(isEndConversation(wsdlOp)) { - operation.setConversationSequence(ConversationSequence.CONVERSATION_END); - } operations.add(operation); } return operations; @@ -82,7 +76,6 @@ public class WSDLInterfaceIntrospectorImpl { wsdlInterface.setPortType(portType); wsdlInterface.setCallbackInterface(callback); wsdlInterface.getOperations().addAll(introspectOperations(portType, wsdlDefinition, resolver, monitor)); - wsdlInterface.setConversational(isConversational(portType)); } public static Operation getOperation(javax.wsdl.Operation wsdlOp, @@ -126,62 +119,17 @@ public class WSDLInterfaceIntrospectorImpl { Vector policyAttributes = (Vector) o; Enumeration policyItents = policyAttributes.elements(); - while(policyItents.hasMoreElements()) { + while (policyItents.hasMoreElements()) { QName intentName = policyItents.nextElement(); - - //ignores conversational, as it will have it's own - //attribute in the wsdl interface model - if(! intentName.equals(POLICY_CONVERSATIONAL)) { - // Add each intent to the list - Intent intent = policyFactory.createIntent(); - intent.setName(intentName); - - wsdlInterface.getRequiredIntents().add(intent); - } - } - - } - } - - private boolean isConversational(PortType portType) { - boolean conversational = false; - - Object o; - try { - o = portType.getExtensionAttribute(POLICY_REQUIRES); - } catch (NoSuchMethodError e) { - // That method does not exist on older WSDL4J levels - o =null; - } - if(o != null && o instanceof Vector) { - Vector policyAttributes = (Vector) o; - - if(policyAttributes.contains(POLICY_CONVERSATIONAL)) { - return true; + // Add each intent to the list + Intent intent = policyFactory.createIntent(); + intent.setName(intentName); + + wsdlInterface.getRequiredIntents().add(intent); } } - - return conversational; - } - - private boolean isEndConversation(javax.wsdl.Operation operation) { - boolean endConversation = false; - - Object o; - try { - o = operation.getExtensionAttribute(POLICY_END_CONVERSATION); - } catch (NoSuchMethodError e) { - // That method does not exist on older WSDL4J levels - o = null; - } - if(o != null && o instanceof String) { - endConversation = Boolean.valueOf((String)o); - } - - return endConversation; - } } diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java index a223b5cbd7..3fd476c46f 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java @@ -36,7 +36,6 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; @@ -220,7 +219,6 @@ public class WSDLOperationIntrospectorImpl { operationModel.setName(operation.getName()); operationModel.setFaultTypes(getFaultTypes()); operationModel.setNonBlocking(oneway); - operationModel.setConversationSequence(ConversationSequence.CONVERSATION_NONE); operationModel.setInputType(getInputType()); operationModel.setOutputType(getOutputType()); diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java index b9f724c82a..a04b3136d7 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java @@ -373,7 +373,7 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor