summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-02-25 23:00:57 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-02-25 23:00:57 +0000
commitd7c15da034109074d717d3f9f0c3325a54b597dd (patch)
tree553365305a3bad892346fb83cf92187b24ca0288 /sca-java-2.x/trunk/modules/assembly/src
parentf026711cd4af3326d8e40a428954f822f65e4c80 (diff)
Add the check for local-by-reference, local-by-value and remote invocations for binding.sca
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@916483 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-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