summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java44
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java23
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java27
3 files changed, 66 insertions, 28 deletions
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 e294f9c270..44dbeda11f 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
@@ -494,27 +494,39 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
InterfaceContract serviceContract = getComponentServiceInterfaceContract();
InterfaceContract bindingContract = getBindingInterfaceContract();
-
+
if ((serviceContract != null) &&
(bindingContract != null)){
boolean bindingHasCallback = bindingContract.getCallbackInterface() != null;
try {
- if ((serviceContract.getClass() != bindingContract.getClass()) &&
- (serviceContract instanceof JavaInterfaceContract)) {
- interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(serviceContract),
- bindingContract,
- Compatibility.SUBSET,
- !bindingHasCallback, // ignore callbacks if binding doesn't have one
- false);
- } else {
- interfaceContractMapper.checkCompatibility(serviceContract,
- bindingContract,
- Compatibility.SUBSET,
- !bindingHasCallback, // ignore callbacks if binding doesn't have one
- false);
- }
+/*
+ interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(serviceContract),
+ getGeneratedWSDLContract(bindingContract),
+ Compatibility.SUBSET,
+ !bindingHasCallback, // ignore callbacks if binding doesn't have one
+ false);
+*/
+
+ // Use the normalized contract if the interface types are different or if
+ // a normalized contract has been previously generate, for example, by virtue
+ // of finding a JAXWS annotation on a Java class that references a WSDL file
+ if (serviceContract.getClass() != bindingContract.getClass() ||
+ serviceContract.getNormalizedWSDLContract() != null ||
+ bindingContract.getNormalizedWSDLContract() != null) {
+ interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(serviceContract),
+ getGeneratedWSDLContract(bindingContract),
+ Compatibility.SUBSET,
+ !bindingHasCallback, // ignore callbacks if binding doesn't have one
+ false);
+ } else {
+ interfaceContractMapper.checkCompatibility(serviceContract,
+ bindingContract,
+ Compatibility.SUBSET,
+ !bindingHasCallback, // ignore callbacks if binding doesn't have one
+ false);
+ }
} catch (Exception ex){
throw new ServiceRuntimeException("Component " +
this.getComponent().getName() +
@@ -817,7 +829,7 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
if (contractBuilder == null){
throw new ServiceRuntimeException("Contract builder not found while calculating WSDL contract for " + this.toString());
}
- contractBuilder.build(getComponentServiceInterfaceContract(), null);
+ contractBuilder.build(interfaceContract, null);
}
}
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 3873185e6b..5f5bbb19ce 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
@@ -325,15 +325,25 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
if ((referenceContract != null) &&
(bindingContract != null)){
-
+
boolean bindingHasCallback = bindingContract.getCallbackInterface() != null;
try {
-
- if ((referenceContract.getClass() != bindingContract.getClass()) &&
- (referenceContract instanceof JavaInterfaceContract)) {
+/*
+ interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(referenceContract),
+ getGeneratedWSDLContract(bindingContract),
+ Compatibility.SUBSET,
+ !bindingHasCallback, // ignore callbacks if binding doesn't have one
+ false);
+*/
+ // Use the normalized contract if the interface types are different or if
+ // a normalized contract has been previously generate, for example, by virtue
+ // of finding a JAXWS annotation on a Java class that references a WSDL file
+ if (referenceContract.getClass() != bindingContract.getClass() ||
+ referenceContract.getNormalizedWSDLContract() != null ||
+ bindingContract.getNormalizedWSDLContract() != null) {
interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(referenceContract),
- bindingContract,
+ getGeneratedWSDLContract(bindingContract),
Compatibility.SUBSET,
!bindingHasCallback, // ignore callbacks if binding doesn't have one
false);
@@ -344,7 +354,6 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
!bindingHasCallback, // ignore callbacks if binding doesn't have one
false);
}
-
} catch (Exception ex){
throw new ServiceRuntimeException("Component " +
this.getComponent().getName() +
@@ -608,7 +617,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
if (contractBuilder == null){
throw new ServiceRuntimeException("Contract builder not found while calculating WSDL contract for " + this.toString());
}
- contractBuilder.build(getComponentReferenceInterfaceContract(), null);
+ contractBuilder.build(interfaceContract, null);
}
}
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 dfeebe2ec6..96d44b3bc2 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
@@ -44,7 +44,10 @@ import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
import org.apache.tuscany.sca.definitions.Definitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.util.Audit;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
@@ -776,7 +779,10 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
private boolean haveMatchingInterfaceContracts(EndpointReference endpointReference, Endpoint endpoint, Audit matchAudit){
matchAudit.append("Match interface of " + endpointReference.toString() + " to " + endpoint.toString() + " ");
- if (endpointReference.getReference().getInterfaceContract() == null){
+ InterfaceContract endpointReferenceContract = endpointReference.getReference().getInterfaceContract();
+ InterfaceContract endpointContract = endpoint.getComponentServiceInterfaceContract();
+
+ if (endpointReferenceContract == null){
matchAudit.append("Match because there is no interface contract on the reference ");
matchAudit.appendSeperator();
return true;
@@ -784,7 +790,8 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
// TODO - is there a better test for this. Would have to cast to the
// correct iface type to get to the resolved flag
- if (endpoint.getComponentServiceInterfaceContract().getInterface().getOperations().size() == 0){
+ // We need to rely on normailzed interfaces in this case!!
+ if (endpointContract.getInterface().getOperations().size() == 0){
// the interface contract is likely remote but unresolved
// we discussed this on the ML and decided that we could
// live with this for the case where there is no central matching of references
@@ -793,13 +800,23 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder {
matchAudit.appendSeperator();
return true;
}
+
+ // If the contracts are not of the same type or normalized interfaces are available
+ // use them
+ if (endpointReferenceContract.getClass() != endpointContract.getClass() ||
+ endpointReferenceContract.getNormalizedWSDLContract() != null ||
+ endpointContract.getNormalizedWSDLContract() != null) {
+ endpointReferenceContract = ((RuntimeEndpointReference)endpointReference).getGeneratedWSDLContract(endpointReferenceContract);
+ endpointContract = ((RuntimeEndpoint)endpoint).getGeneratedWSDLContract(endpointContract);
+ }
boolean match = false;
- match = interfaceContractMapper.isCompatibleSubset(endpointReference.getReference().getInterfaceContract(),
- endpoint.getComponentServiceInterfaceContract(), matchAudit);
+ match = interfaceContractMapper.isCompatibleSubset(endpointReferenceContract,
+ endpointContract,
+ matchAudit);
if (!match){
- matchAudit.append("Match failed because the linterface contract mapper failed ");
+ matchAudit.append("Match failed because the interface contract mapper failed ");
} else {
matchAudit.append("Match because the interface contract mapper succeeded ");
}