diff options
Diffstat (limited to '')
25 files changed, 226 insertions, 376 deletions
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/Compatibility.java index 247a432330..e05a05476a 100644 --- 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/Compatibility.java @@ -16,14 +16,14 @@ * specific language governing permissions and limitations * under the License. */ - package org.apache.tuscany.sca.interfacedef; /** - * Enum of the Conversation Sequence values. - * - * @version $Rev$ $Date$ + * Types of compatibility */ -public enum ConversationSequence { - CONVERSATION_NONE, CONVERSATION_START, CONVERSATION_CONTINUE, CONVERSATION_END -} +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/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. - * <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/> - * <p> - * 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 - * </p> - * <p> - * 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 + * <ul> + * <li>true: Check the two types as compatible "by-value" (can be copied) + * <li>false: Check the two types as compatible "by-reference" (can be assigned) + * </ul> + * @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: + * + * <ol> + * <li>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 + * + * <li>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 + * <li>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 + * </ol> + * + * 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: + * <ol> + * <li>interfaces A and B are either both remotable or else both local + * <li>the set of operations in interface A is the same as or is a subset of the set of operations in + * interface B + * <li>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 + * <li>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 + * <li>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 + * <li>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.<br> + * 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. + * + * </ol> + * + * <b>The callback interfaces are not considered her.</b> + * + * @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: + * <ol> + * <li>interfaces A and B are either both remotable or else both local + * <li>the set of operations in interface A is the same as or is a subset of the set of operations in + * interface B + * <li>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 + * <li>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 + * <li>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 + * <li>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.<br> + * 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. + * <li>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 + * </ol> + * + * @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:<p> + * <ol> + * <li>interfaces A and B are either both remotable or else both local + * <li>the set of operations in interface A is the same as the set of operations in interface B + * <li>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 + * <li>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 + * <li>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 + * <li>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. + * <br>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. + * <li>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 @@ -111,18 +111,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<List<DataType>> inputType; private List<DataType> faultTypes; private Interface interfaze; - private ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE; private boolean nonBlocking; private boolean wrapperStyle; private WrapperInfo wrapper; @@ -146,20 +144,6 @@ public class OperationImpl implements Operation { } /** - * @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 */ public boolean isNonBlocking() { 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<String, Operation> targetOperations = new HashMap<String, Operation>(); 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<String, Operation> targetOperations = new HashMap<String, Operation>(); 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<String, Operation> targetOperations = new HashMap<String, Operation>(); 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<String, Operation> targetOperations = new HashMap<String, Operation>(); 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<String, Operation> targetOperations = new HashMap<String, Operation>(); 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<QName> policyAttributes = (Vector<QName>) o; Enumeration<QName> 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<QName> policyAttributes = (Vector<QName>) 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<WSDLInterfa if( wsdlCallbackInterface != null ) { // If there is both a callback interface declared on the forward interface and also one declared on the // interface.wsdl element, then the two interfaces must match [ASM80011] - if( !interfaceContractMapper.isEqual(intrinsicWSDLCallbackInterface, wsdlCallbackInterface) ) { + if( !interfaceContractMapper.isMutuallyCompatible(intrinsicWSDLCallbackInterface, wsdlCallbackInterface) ) { Monitor.error(context.getMonitor(), WSDLInterfaceProcessor.class.getName(), "interface-wsdlxml-validation-messages", "IncompatibleCallbacks", intrinsicWSDLCallbackInterface.getName().toString(), diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java index 4172eb2955..45f4fa78f9 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java @@ -26,9 +26,7 @@ import javax.wsdl.PortType; import javax.xml.namespace.QName; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; import org.apache.tuscany.sca.interfacedef.wsdl.xml.AbstractWSDLTestCase; @@ -67,7 +65,6 @@ public class WSDLPolicyAnnotatedInterfaceIntrospectorTestCase extends AbstractWS public final void testIntrospectPortType() throws InvalidInterfaceException { WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor()); Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType"); - Assert.assertTrue(contract.isConversational()); boolean foundIntent = false; @@ -79,11 +76,5 @@ public class WSDLPolicyAnnotatedInterfaceIntrospectorTestCase extends AbstractWS Assert.assertTrue(foundIntent); - for(Operation operation : contract.getOperations()) { - if(operation.getName().equals("cancel")) { - Assert.assertEquals(operation.getConversationSequence(), ConversationSequence.CONVERSATION_END); - } - } - } } diff --git a/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java b/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java index 63b25322e5..38a7dd130c 100644 --- a/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java +++ b/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java @@ -254,16 +254,19 @@ public class RemoteServiceAdminImpl implements RemoteServiceAdmin, ManagedServic if (rsaEvent.getExportReference() != null) { ep = rsaEvent.getExportReference().getExportedEndpoint(); } - props.put("endpoint.service.id", ep.getServiceId()); - props.put("endpoint.framework.uuid", ep.getFrameworkUUID()); - props.put("endpoint.id", ep.getId()); - props.put("objectClass", ep.getInterfaces()); - props.put("service.imported.configs", ep.getConfigurationTypes()); - props.put("timestamp", Long.valueOf(System.currentTimeMillis())); - Object bindings = ep.getProperties().get("org.osgi.sca.bindings"); - if (bindings != null) { - props.put("org.osgi.sca.bindings", bindings); + + if (ep != null) { + props.put("endpoint.service.id", ep.getServiceId()); + props.put("endpoint.framework.uuid", ep.getFrameworkUUID()); + props.put("endpoint.id", ep.getId()); + props.put("objectClass", ep.getInterfaces()); + props.put("service.imported.configs", ep.getConfigurationTypes()); + Object bindings = ep.getProperties().get("org.osgi.sca.bindings"); + if (bindings != null) { + props.put("org.osgi.sca.bindings", bindings); + } } + props.put("timestamp", Long.valueOf(System.currentTimeMillis())); props.put("event", rsaEvent); return new Event(topic, props); } |