summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly/src
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly/src')
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java10
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java19
2 files changed, 23 insertions, 6 deletions
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 7a917e5560..5ce1baa54c 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
@@ -78,15 +78,21 @@ public interface InterfaceContractMapper {
* 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.
+ * Please note this compatibility check is NOT symmetric. But the following should be guaranteed:
+ * <ul>
+ * <li>(source, target, SUB) == (target, source, SUPER)
+ * <li>(source, target, MUTUAL) == (source, target, SUB) && (target, source, SUB) == (source, target, SUPER) && (source, target, SUPER)
*
* @param source The source operation
* @param target The target operation
- * @param compatibilityType TODO
+ * @param compatibilityType The type of compatibility
* @return true if the source operation is compatible with the target
* operation
*/
boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType);
+
+ boolean isCompatibleByReference(Operation source, Operation target, Compatibility compatibilityType);
+ boolean isCompatibleByValue(Operation source, Operation target, Compatibility compatibilityType);
/**
* An interface A is a Compatible Subset of a second interface B if and only if all of points 1 through 6
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 dc1c0c0a4e..5c561b2ddf 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
@@ -116,6 +116,10 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
} // end method isEqual
public boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType) {
+ return isCompatible(source, target, compatibilityType, true);
+ }
+
+ public boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType, boolean byValue) {
if (source == target) {
return true;
}
@@ -133,7 +137,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
return false;
}
- boolean remotable = source.getInterface().isRemotable();
+ boolean passByValue = (source.getInterface().isRemotable()) && byValue;
// if (source.getInterface().isRemotable()) {
// return true;
@@ -164,7 +168,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
return true;
}
- if (!isCompatible(targetOutputType, sourceOutputType, remotable)) {
+ if (!isCompatible(targetOutputType, sourceOutputType, passByValue)) {
return false;
}
@@ -174,7 +178,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
int size = sourceInputType.size();
for (int i = 0; i < size; i++) {
- if (!isCompatible(sourceInputType.get(i), targetInputType.get(i), remotable)) {
+ if (!isCompatible(sourceInputType.get(i), targetInputType.get(i), passByValue)) {
return false;
}
}
@@ -186,7 +190,7 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
boolean found = true;
for (DataType sourceFaultType : source.getFaultTypes()) {
found = false;
- if (isCompatible(targetFaultType, sourceFaultType, remotable)) {
+ if (isCompatible(targetFaultType, sourceFaultType, passByValue)) {
// Target fault type can be covered by the source fault type
found = true;
break;
@@ -198,6 +202,13 @@ public class InterfaceContractMapperImpl implements InterfaceContractMapper {
}
return true;
+ }
+ public boolean isCompatibleByReference(Operation source, Operation target, Compatibility compatibilityType) {
+ return isCompatible(source, target, compatibilityType, false);
+ }
+
+ public boolean isCompatibleByValue(Operation source, Operation target, Compatibility compatibilityType) {
+ return isCompatible(source, target, compatibilityType, true);
}
// FIXME: How to improve the performance for the lookup