summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-08-18 15:28:56 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-08-18 15:28:56 +0000
commit99107098916fecc8c788f441452e9608037ae425 (patch)
treea3e9f2ae065968c8944c199285635cb7208946c5 /sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
parent0d9a353f01726808a0093a8d7524c1e1bc894138 (diff)
TUSCANY-3653 - Read JAXWS annotations in Java interfaces (JAXWSJavaIntefaceProcessor) and, in the JavaIntefaceProcessor, post process these to reconfigure the Java interface based on what is found. The case where WSDL is referenced is tricky and still has holes. The WSDL is read and is attached to the Java interface as a normalized interface and is used during interface matching. Binding implementations that care about WSDL should really check the normalized interface rather than the service interface itself. This is still a TODO.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@986740 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java27
1 files changed, 22 insertions, 5 deletions
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 ");
}