You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2010/07/16 18:34:40 UTC
svn commit: r964852 - in /tuscany/sca-java-2.x/trunk/modules:
assembly/src/main/java/org/apache/tuscany/sca/interfacedef/
assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/
core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/
Author: kelvingoodson
Date: Fri Jul 16 16:34:40 2010
New Revision: 964852
URL: http://svn.apache.org/viewvc?rev=964852&view=rev
Log:
communicate differences in interfaces wrt @Remotable annotation
Modified:
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java?rev=964852&r1=964851&r2=964852&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java Fri Jul 16 16:34:40 2010
@@ -40,6 +40,24 @@ public interface InterfaceContractMapper
Compatibility compatibility,
boolean ignoreCallback,
boolean silent) throws IncompatibleInterfaceContractException;
+
+ /**
+ * @param source The source interface contract
+ * @param target The target interface contract
+ * @param compatibility The compatibility style
+ * @param ignoreCallback
+ * @param silent
+ * @return
+ * @throws IncompatibleInterfaceContractException
+ * this interface is intended to incrementally replace the variant without the audit trail
+ * the presence of both interfaces implies a state of partial development
+ */
+ boolean checkCompatibility(InterfaceContract source,
+ InterfaceContract target,
+ Compatibility compatibility,
+ boolean ignoreCallback,
+ boolean silent,
+ StringBuffer audit) throws IncompatibleInterfaceContractException;
/**
* Test if the source data type is compatible with the target data type. The
@@ -155,6 +173,11 @@ public interface InterfaceContractMapper
* @return true if the source interface contract is a compatible subset of the target interface contract
*/
boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target);
+ /*
+ * the variant of isCompatibleSubset with the audit parameter is intended to supersed the other
+ * -- the presence of both indicates a partial development state
+ */
+ boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target, StringBuffer audit);
/**
* Check that two interfaces are mutually compatible. The interfaces are mutually compatible if the two
Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java?rev=964852&r1=964851&r2=964852&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java Fri Jul 16 16:34:40 2010
@@ -327,6 +327,85 @@ public class InterfaceContractMapperImpl
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#checkCompatibility(org.apache.tuscany.sca.interfacedef.InterfaceContract, org.apache.tuscany.sca.interfacedef.InterfaceContract, org.apache.tuscany.sca.interfacedef.Compatibility, boolean, boolean, java.lang.StringBuffer)
+ * this variant of the checkCompatibility method is intended to supersede the one without an audit argument
+ * Presence of both method variants indicates a state of partial development
+ */
+ public boolean checkCompatibility(InterfaceContract source,
+ InterfaceContract target, Compatibility compatibility,
+ boolean ignoreCallback, boolean silent, StringBuffer audit)
+ throws IncompatibleInterfaceContractException {
+
+ if (source == target) {
+ // Shortcut for performance
+ return true;
+ }
+
+ if (source == null || target == null) {
+ return false;
+ }
+
+ if (source.getInterface() == target.getInterface()) {
+ return ignoreCallback
+ || isCallbackCompatible(source, target, silent);
+ }
+
+ if (source.getInterface() == null || target.getInterface() == null) {
+ return false;
+ }
+
+ if (source.getInterface().isDynamic()
+ || target.getInterface().isDynamic()) {
+ return ignoreCallback
+ || isCallbackCompatible(source, target, silent);
+ }
+
+ if (source.getInterface().isRemotable() != target.getInterface()
+ .isRemotable()) {
+ if (!silent) {
+ audit.append("Remotable settings do not match: "+ source + "," + target); // TODO see if serialization is sufficient
+ throw new IncompatibleInterfaceContractException(
+ "Remotable settings do not match", source, target);
+ } else {
+ return false;
+ }
+ }
+
+ for (Operation operation : source.getInterface().getOperations()) {
+ Operation targetOperation = map(target.getInterface(), operation);
+ if (targetOperation == null) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException(
+ "Operation " + operation.getName()
+ + " not found on target", source, target);
+ } else {
+ return false;
+ }
+ }
+
+ if (!silent) {
+ if (audit == null)
+ audit = new StringBuffer();
+ if (!isCompatible(operation, targetOperation,
+ Compatibility.SUBSET, true, audit)) {
+ throw new IncompatibleInterfaceContractException(
+ "Operations called " + operation.getName()
+ + " are not compatible " + audit, source,
+ target);
+ }
+ } else {
+ if (!isCompatible(operation, targetOperation,
+ Compatibility.SUBSET)) {
+ return false;
+ }
+ }
+ }
+
+ return ignoreCallback || isCallbackCompatible(source, target, silent);
+ }
+
public boolean checkCompatibility(InterfaceContract source,
InterfaceContract target,
Compatibility compatibility,
@@ -396,6 +475,8 @@ public class InterfaceContractMapperImpl
return ignoreCallback || isCallbackCompatible(source, target, silent);
}
+
+
protected boolean isCallbackCompatible(InterfaceContract source, InterfaceContract target, boolean silent)
throws IncompatibleInterfaceContractException {
if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) {
@@ -464,7 +545,21 @@ public class InterfaceContractMapperImpl
return true;
}
+ /*
+ * the variant of isCompatibleSubset with the audit parameter is intended to supersede the other
+ * -- the presence of both indicates a partial development state
+ */
+ public boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target, StringBuffer audit) {
+
+ try {
+ return checkCompatibility(source, target, Compatibility.SUBSET, false, false, audit);
+ } catch (IncompatibleInterfaceContractException e) {
+ return false;
+ }
+ }
+
public boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target) {
+
try {
return checkCompatibility(source, target, Compatibility.SUBSET, false, false);
} catch (IncompatibleInterfaceContractException e) {
Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java?rev=964852&r1=964851&r2=964852&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java Fri Jul 16 16:34:40 2010
@@ -748,7 +748,7 @@ public class EndpointReferenceBinderImpl
boolean match = false;
match = interfaceContractMapper.isCompatibleSubset(endpointReference.getReference().getInterfaceContract(),
- endpoint.getComponentServiceInterfaceContract());
+ endpoint.getComponentServiceInterfaceContract(), matchAudit);
if (!match){
matchAudit.append("Match failed because the linterface contract mapper failed ");